Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 36d396a

Browse files
Merge pull request #325 from TERNION-1121/othello_contribution
Add Othello/Reversi GUI Game
2 parents 4aaa733 + a046661 commit 36d396a

21 files changed

Lines changed: 629 additions & 0 deletions
55.2 KB
Binary file not shown.

projects/Othello/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<h1 align="center">⚫ Othello/Reversi ⚪ </h1>
2+
3+
A GUI-equipped, [Othello/Reversi](https://www.worldothello.org/about/about-othello/othello-rules/official-rules/english) game made in **Python3** using the `pygame` library. Featuring two-player as well as Play with Computer modes.
4+
5+
## 📜 Description
6+
Othello is a board-game played on a 8x8 board, with 64 discs that are black on one side and white on the other. Each player gets 32 such discs, out of which 2 from each player are kept on the board in the following manner:
7+
8+
![image](https://github.com/TERNION-1121/Othello-Reversi-Game/assets/97667653/ea03fdd8-9abc-4b14-bdc9-7d983fb38041)
9+
10+
<br>
11+
12+
A move consists of "outflanking" your opponent's disc(s), then flipping the "outflanked" disc(s) to your color.
13+
To outflank means, if your disc is kept on square X, and you have another disc on square Y, such that:
14+
- X and Y lie on the same row, or
15+
- X and Y lie on the same column, or
16+
- X and Y lie on the same diagonal,
17+
18+
If any one (or more) of the above is the case while playing, then the Opponent's discs between X and Y get flipped to your color.
19+
20+
<br>
21+
22+
Example:
23+
24+
> Here White disc A was already present on the board, after placing White disc B, the row of Black discs between White disc A and B got outflanked,
25+
26+
![06a8330dc692b7631a2e50660e4a7346](https://github.com/TERNION-1121/Othello-Reversi-Game/assets/97667653/84feed70-ee16-4f4f-baad-39a3ecc148ed)
27+
28+
> And thus the outflanked Black discs flipped to White.
29+
30+
![cd51ed676fb49538035a8bf006ffbe96](https://github.com/TERNION-1121/Othello-Reversi-Game/assets/97667653/bafe9059-7a32-4d93-aaa2-bfc97a311fce)
31+
32+
For a more comprehensive explanation of the game rules, check out this [link](https://www.worldothello.org/about/about-othello/othello-rules/official-rules/english).
33+
34+
<br>
35+
36+
### 🎯 Game Modes
37+
38+
#### ⚔ Two-Player Mode
39+
Two players can play the game, alternating their turns.
40+
41+
#### 🤖 Play with Computer
42+
Play with the computer! It makes use of the minimax algorithm with alpha-beta pruning.
43+
44+
Currently the algorithm makes use of the following heuristics for a position's evaluation:
45+
- Coin parity
46+
- Mobility
47+
- Corner Values
48+
49+
### How to Play the Game 🎮
50+
1. Download the source code. (Either clone the repository or download the whole code from GitHub)
51+
2. Make sure to install Python3 on your Computer along with `pip`. (Python3.10+ is required)
52+
3. Open your terminal, navigate to `~/PYTHON-BEGINNER-PROJECTS/projects/Othello` and type the command:
53+
```
54+
pip install -r requirements
55+
```
56+
5. Navigate to the `src` directory, run the `main.py` file and play the game!
57+
> P.S. You can change color modes using the 'L' key!
5.67 KB
Loading
16 KB
Loading
12.4 KB
Loading
15.8 KB
Loading
17.4 KB
Loading
30.7 KB
Loading
5.76 KB
Loading
16.3 KB
Loading

0 commit comments

Comments
 (0)