Fixed several critical bugs and added features.

1)Fixed the bug with termination of the program on 19th figure.

2)Fixed the bug with figure repainting.

3)Added blue grid on the game screen.