Game Development Reference
In-Depth Information
Topics Covered In This Chapter:
— The bool() Function
— Evaluating Non-Boolean Values as Booleans
How to Play Reversi
In this chapter we will make a game called Reversi. Reversi (also called Othello) is a
board game that is played on a grid (so we will use a Cartesian coordinate system with XY
coordinates, like we did with Sonar.) It is a game played with two players. Our version of
the game will have a computer AI that is more advanced than the AI we made for Tic Tac
Toe. In fact, this AI is so good that it will probably beat you almost every time you play. (I
know I lose whenever I play against it!)
If you would like to see a video of Reversi being played, there is a demonstration on this
topic's website. Go to the URL http://inventwithpython.com/videos and find the "Reversi
Demo Video" video.
Reversi has an 8 x 8 board with tiles that are black on one side and white on the other
(our game will use O's and X's though). The starting board looks like Figure 15-1. Each
player takes turn placing down a new tile of their color. Any of the opponent's tiles that are
between the new tile and the other tiles of that color is flipped. The goal of the game is to
have as many of the tiles with your color as possible. For example, Figure 15-2 is what it
looks like if the white player places a new white tile on space 5, 6.
Search WWH ::




Custom Search