Skip to main content
Engineering LibreTexts

11.1: Flippy, an “Othello” Clone

  • Page ID
    13625
  • Figure 57

    Othello, also known by the generic name Reversi, has an 8 x 8 board with tiles that are black on one side and white on the other. The starting board looks like Figure 10-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 10-2 is what it looks like if the white player places a new white tile on space 5, 6.

    Figure 58

    The black tile at 5, 5 is in between the new white tile and the existing white tile at 5, 4. That black tile is flipped over and becomes a new white tile, making the board look like Figure 10-3. Black makes a similar move next, placing a black tile on 4, 6 which flips the white tile at 4, 5. This results in a board that looks like Figure 10-4.

    Figure 59

    Tiles in all directions are flipped as long as they are in between the player's new tile and existing tile. In Figure 10-5, the white player places a tile at 3, 6 and flips black tiles in both directions (marked by the lines). The result is in Figure 10-6.

    Figure 60

    As you can see, each player can quickly grab a majority of the tiles on the board in just one or two moves. Players must always make a move that captures at least one tile. The game ends when a player either cannot make a move, or the board is completely full. The player with the most tiles of their color wins.

    You can learn more about Reversi from Wikipedia: http://en.Wikipedia.org/wiki/Reversi

    A text version of this game that uses print() and input() instead of Pygame is featured in Chapter 15 of "Invent Your Own Computer Games with Python". You can read that chapter for details about how the computer AI’s algorithm was put together. http://inventwithpython.com/chapter15.html

    The computer AI for this game is pretty good, because it is easy for a computer to simulate every possible move and take the one that flips over the most tiles. It usually beats me whenever I play it.

    • Was this article helpful?