This web page is a Java applet to play the board game of Reversi, also known as Othello. ("Othello" is a registered trademark. Since 1976 in the United States, the legal owner is Tsukuda Co. Ltd. of Japan, assigned to Anjar Co. in New York. Mattel Inc. once held a trademark for "Reversi" as a video game but that expired in 1989. There is no current trademark in the United States for "Reversi" as a board game.)
The playing board is a rectangular grid. Your positions are shown as black circles. Positions occupied by the computer are shown in white. You move first.
A legal move is any empty position that traps one or more of the computer's positions in a straight line (horizontal, vertical, or diagonal) between the empty position and another of your positions. The trapped positions are then "flipped" (reversed) and become your positions. To help you, legal moves are highlighted when you hold the mouse over an empty position.
If you can't move, then you lose your turn and the computer moves next. The game ends when nobody can move. The player with the most occupied positions is the winner.
You may change the size of the game board. The number of rows and columns may be changed independently. The standard size is 8x8. You may also select "easy" or "medium" difficulty. On "easy" play, the computer moves randomly. On "medium" play, the computer flips the maximum number of positions.
A more difficult level has not been implemented. This would require hundreds or thousands of lines of additional code to develop a better strategy. The extra code would detract from this game's primary purpose, which is to demonstrate graphical Java programming. Should you feel like doing the work, the program does contain hooks for two additional levels called "hard" and "expert".
If this web page begins with an error message saying that your browser does not support Java, then either your computer doesn't have Java, or Java is not enabled. If you see an empty rectangle where the applet should be, then you have Java but need a newer browser or a newer version of Java. For Internet Explorer 5 or later, Firefox, Mozilla, and Netscape 7.x or later on Windows, you may download the Sun Java run-time environment (JRE) from http://www.java.com/getjava/ on Sun's web site. This program was written on and tested against Sun Java 1.4.
The source code for this applet is available, even though writing a similar Java program is an assignment for students, and I'm sure that some students won't do their own homework. (Hint: eight directions of play don't need eight different sections of code.) You may also download the application as a ZIP archive with the executable Java class files and the documentation in Adobe Acrobat PDF format. More programming assignments and solutions can be found on my "Computer Programming Examples" web page.
Copyright (c) 2004 by Keith Fenske. Released under the GNU General Public License (GPL).