Othello (also known as Reversi) is a two-player strategy board game played on an 8x8 board. The game is characterized by its simple rules but deep strategy. This project implements the Othello game using Java and provides a graphical user interface (GUI) with Swing.
The game allows two players to take turns placing their pieces on the board. Each move potentially flips the opponent's pieces, and the player with the most pieces on the board at the end of the game wins.
- Graphical User Interface (GUI): A Swing-based interface displaying the Othello board.
- Game Logic: Handles piece placement, flipping opponent pieces, and turn management.
- Game Status: Displays messages when the game ends with a winner or a tie.
- Error Handling: Shows error messages for invalid moves.
- Java Development Kit (JDK) 8 or higher
- An IDE like IntelliJ IDEA, Eclipse, or any text editor
-
Clone the Repository:
git clone https://github.com/yourusername/othello-game.git
-
Navigate to the Project Directory:
cd othello-game
-
Compile the Java Files:
javac -d bin src/OOP4/OthelloBoard/*.java
-
Run the Application:
java -cp bin OOP4.OthelloBoard.OthelloBoardGUI
- Starting the Game: Run the application using the command above.
- Playing the Game: Click on the board cells to place your pieces. Player 1 uses "X" and Player 2 uses "O".
- End of Game: The game will automatically display a message box when it ends, indicating the result.
Here's a screenshot of the game in action:
Contains the game logic for managing the board, making moves, and checking the game status. This class handles the rules of Othello, including piece flipping and move validation.
Provides the graphical interface for the game. It initializes the board, updates the display after each move, and handles user interactions. It also shows messages for invalid moves and game-over conditions.
If you have suggestions or improvements, feel free to fork the repository and submit a pull request. Please make sure to follow the project's coding style and guidelines.
This project is licensed under the MIT License. See the LICENSE file for details.
Happy gaming!