Wow! You've almost made it through this book. This is the last game we will develop together, and after we are done, you can proudly say that you have at least created eight games. That makes you definitely a game developer!
After all these action-packed games, it is time for another brain teaser. For this, we will create Game #8, Treasure Chest. It is a game in the likeness of the famous Bejewled (http://en.wikipedia.org/wiki/Bejewled).
In Treasure Chest, you have to line up at least three gems with the same color in a row by switching pieces that lie next to each other. To do this, you click on the first gem with your mouse and then on a neighboring gem. The position of these two gems is exchanged. If their new position results in valid line ups, the game will allow the exchange and you will be rewarded with some points. Also, the gems will vanish and the empty space will be filled by the gems from above. Empty spaces on the top will be filled randomly...