Firstly, we're not here to just write your code for you, so asking us if we know the code to do some significant task is not really on. Secondly, I have no real idea what you're asking, so please provide a FULL and CLEAR explanation of the problem rather than as few words as possible. Finally, you need to break your problem up into the smallest parts possible and then address each part individually. Do the parts yourself that you can and then ask specific questions about each other part separately. If you have multiple questions about multiple parts, start multiple threads. This "divide and conquer" technique is one of the most important things you can learn as not doing it is the biggest reason that beginners have trouble doing things, i.e. they try to do multiple steps in one and thus cannot do any.