From cfb05f6c1119a9e9d292809c5c470084f6546c59 Mon Sep 17 00:00:00 2001 From: Cyprien111 <105004796+Cyprien111@users.noreply.github.com> Date: Mon, 31 Mar 2025 08:33:58 +0200 Subject: [PATCH] add Doc --- src/GomokuAI.java | 12 ++++++++++++ src/Human.java | 13 +++++++++++-- src/player.java | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/GomokuAI.java b/src/GomokuAI.java index 14c1148..90efcf6 100644 --- a/src/GomokuAI.java +++ b/src/GomokuAI.java @@ -2,10 +2,22 @@ import java.util.List; import java.util.Random; public class GomokuAI{ + + /** + * This class is an extends of the class Player, this allows the GomokuAI to choose his move. + */ + /** The random initialization */ Random random = new Random(); + /** The difficulty of the GomokuAI */ int difficulty = 0; + //------------------Methods-------------------------- + /** + * Return the coordinate of the move played by the Gomoku AI. + * @param Board The actual Gomoku board. + * @return The coordinate of the move played. + */ public Coordinate chooseMove(GomokuBoard board){ diff --git a/src/Human.java b/src/Human.java index ebefee8..c123f0d 100644 --- a/src/Human.java +++ b/src/Human.java @@ -2,9 +2,18 @@ import java.io.Console; import java.util.List; -public class Human{ +public class Human extends Player{ - + /** + * This class is an extends of the class Player, this allows the player to choose his move. + */ + + //------------------Methods-------------------------- + /** + * Return the coordinate of the move played by the player. + * @param Board The actual Gomoku board. + * @return The coordinate of the move played. + */ public Coordinate chooseMove(GomokuBoard board){ Console cons = System.console(); diff --git a/src/player.java b/src/player.java index 36fdda6..73138d0 100644 --- a/src/player.java +++ b/src/player.java @@ -1,14 +1,42 @@ -import java.util.List; abstract class Player{ + /** + * This class is an abstract class to choose between player and Gomoku AI. + */ + + /** The name of the Player */ private String name; + + //------------------Constructors-------------------------- + + /** + * The constructor of the Player. + * @param name The name of the player. + */ + public void Player(String name){ + this.name = name; + } + + //------------------Gets-------------------------- + + /** + * Return the name of the player. + * @return The name of the player. + */ public String getName() { return name; } - public abstract Coordinate chooseMove(GomokuBoard Board); + //------------------Methods-------------------------- + + /** + * Return the coordinate of the move played by the player. + * @param Board The actual Gomoku board. + * @return The coordinate of the move played. + */ + public abstract Coordinate chooseMove(GomokuBoard board); } \ No newline at end of file