Complete code for game