implemented main game logic

the game is now fully functional