Game logic

I fear Shadi's wrath on this code.