I hope so. Thank you.kazaftan, lemme spell it out for you, since you can't seem to be bother to read the AUP. This sounds like you're looking for someone to do your homework for you. This board take a very dim view of folks trying to get others to do their homework for them. A little bit of research and using your own brain will solve this problem for you.
Don't try to convert someone else's solution from C#. Write your own. Use your brain. You can do it.