In the future, please format your code according to the FAQ. It helps us better understand your code as we try to help. Basically, it helps us help you!
If you have trouble finding it, click here
Also, in the future, please give more information about what happens in the game when you run your code.