Edit README.md
This commit is contained in:
97
README.md
97
README.md
@@ -1,4 +1,99 @@
|
||||
# Gomoku
|
||||
# Table of Contents / Table des Matières
|
||||
|
||||
## 🇬🇧 English
|
||||
1. [Documentation](#documentation)
|
||||
2. [How to Compile and Run the Game](#how-to-compile-and-run-the-game)
|
||||
3. [Command-Line Options for the Gomoku Game](#command-line-options-for-the-gomoku-game)
|
||||
4. [Example Usage](#example-usage)
|
||||
5. [Notes](#notes)
|
||||
6. [Structure](#structure)
|
||||
|
||||
## 🇫🇷 Français
|
||||
1. [La documentation](#la-documentation)
|
||||
2. [Comment compiler et lancer le jeu ?](#comment-compiler-et-lancer-le-jeu-)
|
||||
3. [Options de Commande pour le Jeu Gomoku](#options-de-commande-pour-le-jeu-gomoku)
|
||||
4. [Exemple d'utilisation](#exemple-dutilisation)
|
||||
5. [Remarques](#remarques)
|
||||
6. [Structure](#structure-1)
|
||||
|
||||
|
||||
# 🇬🇧 Gomoku
|
||||
|
||||
## Documentation
|
||||
|
||||
> docs/index.html
|
||||
|
||||
## How to Compile and Run the Game
|
||||
|
||||
```bash
|
||||
javac -d build src/*java
|
||||
java -cp build GomokuGame
|
||||
```
|
||||
|
||||
## Command-Line Options for the Gomoku Game
|
||||
|
||||
Here are the different command-line options available to configure and launch the Gomoku game:
|
||||
|
||||
* `--save <path>`: Loads a saved game from the specified path.
|
||||
|
||||
* Example: `--save path/to/game`
|
||||
|
||||
* `--pvp`: Enables player versus player (PvP) mode.
|
||||
|
||||
* Example: `--pvp`
|
||||
|
||||
* `--size <width> <height>`: Sets the game board size.
|
||||
|
||||
* Example: `--size 15 15`
|
||||
|
||||
* `--nbToken <number>`: Sets the number of tokens available for each player.
|
||||
|
||||
* Example: `--nbToken 50`
|
||||
|
||||
* `--difficulty <level>`: Sets the AI difficulty level (1, 2, or 3).
|
||||
|
||||
* Example: `--difficulty 2`
|
||||
|
||||
* `--nbTokenToWin <number>`: Sets the number of tokens in a row needed to win.
|
||||
|
||||
* Example: `--nbTokenToWin 5`
|
||||
|
||||
## Example Usage
|
||||
|
||||
```bash
|
||||
java -cp build GomokuGame --pvp --size 15 15 --nbToken 50 --difficulty 2 --nbTokenToWin 5
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
* If an option is used incorrectly or parameters are invalid, default values will be applied.
|
||||
* The minimum board size is 3x3. If a smaller size is specified, the game will not start.
|
||||
|
||||
## Structure
|
||||
|
||||

|
||||
|
||||
To begin, we created two enumerations: one for colors, named `Color`, and another for the cardinal directions, named `Cardinal`. Colors are used for the tokens placed on the board. The directions help us navigate the grid of cells, which are linked in all eight cardinal directions.
|
||||
|
||||
We have an abstract class representing the player, called `Player`, which has two subclasses:
|
||||
|
||||
* `Human`, which asks the user to play their turn,
|
||||
* `GomokuAI`, which represents a computer-controlled player.
|
||||
|
||||
For the game area, we have a `GomokuCell` class that represents a cell with all its neighbors in the eight directions, as well as the color of the token placed in that cell. Another class, `GomokuBoard`, contains the top-left cell of the board. From this cell, we traverse the entire board. This class generates the board, board extensions, etc.
|
||||
|
||||
To run the game, we have the `GomokuGame` class, which has a `main` method and accepts parameters if the user wants. It creates the game and the game loop, and contains:
|
||||
|
||||
* Both players,
|
||||
* The board,
|
||||
* The number of aligned cells required to win,
|
||||
* The current player,
|
||||
* The renderer.
|
||||
|
||||
For rendering, we have an abstract class `GomokuRenderer` that is implemented by `ConsoleRenderer`, allowing the board to be displayed in the terminal. The abstract class exists to facilitate replacing the renderer in the future if needed.
|
||||
|
||||
|
||||
# 🇫🇷 Gomoku
|
||||
|
||||
## La documentation
|
||||
> docs/index.html
|
||||
|
||||
Reference in New Issue
Block a user