Made a few changes and added the game rules checking in the example.