From 31e792971696c2e56c72b8923eb546334bb581de Mon Sep 17 00:00:00 2001 From: Aubin DORIVAL Date: Fri, 28 Mar 2025 10:28:49 +0100 Subject: [PATCH] to string and setState + doc --- doc/Cardinal.html | 2 +- doc/Color.html | 2 +- doc/Coordinate.html | 2 +- doc/GomokuAI.html | 2 +- doc/GomokuBoard.html | 2 +- doc/GomokuCell.html | 32 ++++++++++++++++++++++++++++++-- doc/GomokuGame.html | 2 +- doc/Human.html | 2 +- doc/Player.html | 2 +- doc/allclasses-index.html | 2 +- doc/allpackages-index.html | 2 +- doc/constant-values.html | 2 +- doc/help-doc.html | 2 +- doc/index-all.html | 13 ++++++++++--- doc/index.html | 2 +- doc/member-search-index.js | 2 +- doc/overview-tree.html | 2 +- doc/package-summary.html | 2 +- doc/package-tree.html | 2 +- doc/search.html | 2 +- src/GomokuCell.java | 17 +++++++++++++++++ 21 files changed, 75 insertions(+), 23 deletions(-) diff --git a/doc/Cardinal.html b/doc/Cardinal.html index 93c7fe1..8e20630 100644 --- a/doc/Cardinal.html +++ b/doc/Cardinal.html @@ -1,7 +1,7 @@ - + Cardinal diff --git a/doc/Color.html b/doc/Color.html index ba123bd..5b60daf 100644 --- a/doc/Color.html +++ b/doc/Color.html @@ -1,7 +1,7 @@ - + Color diff --git a/doc/Coordinate.html b/doc/Coordinate.html index c37cfcb..7a2ef5f 100644 --- a/doc/Coordinate.html +++ b/doc/Coordinate.html @@ -1,7 +1,7 @@ - + Coordinate diff --git a/doc/GomokuAI.html b/doc/GomokuAI.html index 7e063df..d48cbd4 100644 --- a/doc/GomokuAI.html +++ b/doc/GomokuAI.html @@ -1,7 +1,7 @@ - + GomokuAI diff --git a/doc/GomokuBoard.html b/doc/GomokuBoard.html index ab2a3ff..e24525e 100644 --- a/doc/GomokuBoard.html +++ b/doc/GomokuBoard.html @@ -1,7 +1,7 @@ - + GomokuBoard diff --git a/doc/GomokuCell.html b/doc/GomokuCell.html index 346a6c7..af636d3 100644 --- a/doc/GomokuCell.html +++ b/doc/GomokuCell.html @@ -1,7 +1,7 @@ - + GomokuCell @@ -80,10 +80,12 @@ loadScripts(document, 'script');
  • getNeighbour(Cardinal)
  • getAllNeighbour()
  • getSate()
  • +
  • setState(Color)
  • isEmpty()
  • isPlayed()
  • isPlayable()
  • linkCell(Cardinal, GomokuCell)
  • +
  • toString()
  • @@ -190,12 +192,18 @@ loadScripts(document, 'script');
    This method link the cell at the Cardinal position on the current cell.
    +
    void
    +
    setState(Color c)
    +
     
    +
    String
    +
    toString()
    +
     

    Methods inherited from class java.lang.Object

    -clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait @@ -296,6 +304,14 @@ loadScripts(document, 'script');
  • +
    +

    setState

    +
    +
    public void setState(Color c)
    +
    +
    +
  • +
  • isEmpty

    @@ -349,6 +365,18 @@ loadScripts(document, 'script');
  • +
  • +
    +

    toString

    +
    +
    public String toString()
    +
    +
    Overrides:
    +
    toString in class Object
    +
    +
    +
    +
  • diff --git a/doc/GomokuGame.html b/doc/GomokuGame.html index bead3bf..60d22e4 100644 --- a/doc/GomokuGame.html +++ b/doc/GomokuGame.html @@ -1,7 +1,7 @@ - + GomokuGame diff --git a/doc/Human.html b/doc/Human.html index 5ec8bcd..57c3a85 100644 --- a/doc/Human.html +++ b/doc/Human.html @@ -1,7 +1,7 @@ - + Human diff --git a/doc/Player.html b/doc/Player.html index 0e01506..36976af 100644 --- a/doc/Player.html +++ b/doc/Player.html @@ -1,7 +1,7 @@ - + Player diff --git a/doc/allclasses-index.html b/doc/allclasses-index.html index 6f7042b..c33cdb0 100644 --- a/doc/allclasses-index.html +++ b/doc/allclasses-index.html @@ -1,7 +1,7 @@ - + All Classes and Interfaces diff --git a/doc/allpackages-index.html b/doc/allpackages-index.html index 5b8f1bf..38bddb8 100644 --- a/doc/allpackages-index.html +++ b/doc/allpackages-index.html @@ -1,7 +1,7 @@ - + All Packages diff --git a/doc/constant-values.html b/doc/constant-values.html index f683c11..754ddbd 100644 --- a/doc/constant-values.html +++ b/doc/constant-values.html @@ -1,7 +1,7 @@ - + Constant Field Values diff --git a/doc/help-doc.html b/doc/help-doc.html index 9072757..a44152f 100644 --- a/doc/help-doc.html +++ b/doc/help-doc.html @@ -1,7 +1,7 @@ - + API Help diff --git a/doc/index-all.html b/doc/index-all.html index df948d1..549ccda 100644 --- a/doc/index-all.html +++ b/doc/index-all.html @@ -1,7 +1,7 @@ - + Index @@ -53,7 +53,7 @@ loadScripts(document, 'script');

    Index

    -B C D E F G H I L M N P R S V W X Y 
    All Classes and Interfaces|All Packages|Constant Field Values +B C D E F G H I L M N P R S T V W X Y 
    All Classes and Interfaces|All Packages|Constant Field Values

    B

    BLACK - Enum constant in enum class Color
    @@ -229,6 +229,8 @@ loadScripts(document, 'script');
     
    SE - Enum constant in enum class Cardinal
     
    +
    setState(Color) - Method in class GomokuCell
    +
     
    startGame() - Method in class GomokuGame
     
    state - Variable in class GomokuCell
    @@ -238,6 +240,11 @@ loadScripts(document, 'script');
    SW - Enum constant in enum class Cardinal
     
    +

    T

    +
    +
    toString() - Method in class GomokuCell
    +
     
    +

    V

    valueOf(String) - Static method in enum class Cardinal
    @@ -276,7 +283,7 @@ the order they are declared.
    y - Variable in class Coordinate
     
    -B C D E F G H I L M N P R S V W X Y 
    All Classes and Interfaces|All Packages|Constant Field Values +B C D E F G H I L M N P R S T V W X Y 
    All Classes and Interfaces|All Packages|Constant Field Values diff --git a/doc/index.html b/doc/index.html index 2a94f6d..ad31daa 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,7 +1,7 @@ - + Generated Documentation (Untitled) diff --git a/doc/member-search-index.js b/doc/member-search-index.js index 7d9ac47..d610888 100644 --- a/doc/member-search-index.js +++ b/doc/member-search-index.js @@ -1 +1 @@ -memberSearchIndex = [{"p":"","c":"Color","l":"BLACK"},{"p":"","c":"GomokuGame","l":"boardHeight"},{"p":"","c":"GomokuGame","l":"boardWidth"},{"p":"","c":"GomokuBoard","l":"boardWith"},{"p":"","c":"GomokuBoard","l":"bordHeight"},{"p":"","c":"Cardinal","l":"Cardinal()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuAI","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Human","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Player","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Color","l":"Color()","u":"%3Cinit%3E()"},{"p":"","c":"Coordinate","l":"Coordinate(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"","c":"GomokuGame","l":"DEFAULT_BOARD_HEIGHT"},{"p":"","c":"GomokuGame","l":"DEFAULT_BOARD_WIDTH"},{"p":"","c":"GomokuGame","l":"DEFAULT_TOKENS_COUNT"},{"p":"","c":"GomokuAI","l":"difficulty"},{"p":"","c":"Cardinal","l":"E"},{"p":"","c":"GomokuBoard","l":"firstCell"},{"p":"","c":"GomokuBoard","l":"get(int, int)","u":"get(int,int)"},{"p":"","c":"GomokuCell","l":"getAllNeighbour()"},{"p":"","c":"GomokuGame","l":"getBoard()"},{"p":"","c":"Player","l":"getName()"},{"p":"","c":"GomokuCell","l":"getNeighbour(Cardinal)"},{"p":"","c":"GomokuCell","l":"getSate()"},{"p":"","c":"GomokuAI","l":"GomokuAI()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuBoard","l":"GomokuBoard(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"","c":"GomokuCell","l":"GomokuCell(Color)","u":"%3Cinit%3E(Color)"},{"p":"","c":"GomokuGame","l":"GomokuGame()","u":"%3Cinit%3E()"},{"p":"","c":"Human","l":"Human()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuCell","l":"isEmpty()"},{"p":"","c":"GomokuCell","l":"isPlayable()"},{"p":"","c":"GomokuCell","l":"isPlayed()"},{"p":"","c":"GomokuCell","l":"linkCell(Cardinal, GomokuCell)","u":"linkCell(Cardinal,GomokuCell)"},{"p":"","c":"GomokuGame","l":"load(Path)","u":"load(java.nio.file.Path)"},{"p":"","c":"GomokuGame","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"","c":"Cardinal","l":"N"},{"p":"","c":"Player","l":"name"},{"p":"","c":"Cardinal","l":"NE"},{"p":"","c":"GomokuCell","l":"neighbour"},{"p":"","c":"GomokuGame","l":"newGame()"},{"p":"","c":"Color","l":"NIL"},{"p":"","c":"Cardinal","l":"NW"},{"p":"","c":"Player","l":"Player()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuGame","l":"player1"},{"p":"","c":"GomokuGame","l":"player2"},{"p":"","c":"GomokuAI","l":"random"},{"p":"","c":"Cardinal","l":"S"},{"p":"","c":"GomokuGame","l":"save(Path)","u":"save(java.nio.file.Path)"},{"p":"","c":"Cardinal","l":"SE"},{"p":"","c":"GomokuGame","l":"startGame()"},{"p":"","c":"GomokuCell","l":"state"},{"p":"","c":"Cardinal","l":"SW"},{"p":"","c":"Cardinal","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"","c":"Color","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"","c":"Cardinal","l":"values()"},{"p":"","c":"Color","l":"values()"},{"p":"","c":"Cardinal","l":"W"},{"p":"","c":"Color","l":"WHITE"},{"p":"","c":"Coordinate","l":"x"},{"p":"","c":"Coordinate","l":"y"}];updateSearchResults(); \ No newline at end of file +memberSearchIndex = [{"p":"","c":"Color","l":"BLACK"},{"p":"","c":"GomokuGame","l":"boardHeight"},{"p":"","c":"GomokuGame","l":"boardWidth"},{"p":"","c":"GomokuBoard","l":"boardWith"},{"p":"","c":"GomokuBoard","l":"bordHeight"},{"p":"","c":"Cardinal","l":"Cardinal()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuAI","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Human","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Player","l":"chooseMove(GomokuBoard)"},{"p":"","c":"Color","l":"Color()","u":"%3Cinit%3E()"},{"p":"","c":"Coordinate","l":"Coordinate(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"","c":"GomokuGame","l":"DEFAULT_BOARD_HEIGHT"},{"p":"","c":"GomokuGame","l":"DEFAULT_BOARD_WIDTH"},{"p":"","c":"GomokuGame","l":"DEFAULT_TOKENS_COUNT"},{"p":"","c":"GomokuAI","l":"difficulty"},{"p":"","c":"Cardinal","l":"E"},{"p":"","c":"GomokuBoard","l":"firstCell"},{"p":"","c":"GomokuBoard","l":"get(int, int)","u":"get(int,int)"},{"p":"","c":"GomokuCell","l":"getAllNeighbour()"},{"p":"","c":"GomokuGame","l":"getBoard()"},{"p":"","c":"Player","l":"getName()"},{"p":"","c":"GomokuCell","l":"getNeighbour(Cardinal)"},{"p":"","c":"GomokuCell","l":"getSate()"},{"p":"","c":"GomokuAI","l":"GomokuAI()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuBoard","l":"GomokuBoard(int, int)","u":"%3Cinit%3E(int,int)"},{"p":"","c":"GomokuCell","l":"GomokuCell(Color)","u":"%3Cinit%3E(Color)"},{"p":"","c":"GomokuGame","l":"GomokuGame()","u":"%3Cinit%3E()"},{"p":"","c":"Human","l":"Human()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuCell","l":"isEmpty()"},{"p":"","c":"GomokuCell","l":"isPlayable()"},{"p":"","c":"GomokuCell","l":"isPlayed()"},{"p":"","c":"GomokuCell","l":"linkCell(Cardinal, GomokuCell)","u":"linkCell(Cardinal,GomokuCell)"},{"p":"","c":"GomokuGame","l":"load(Path)","u":"load(java.nio.file.Path)"},{"p":"","c":"GomokuGame","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"","c":"Cardinal","l":"N"},{"p":"","c":"Player","l":"name"},{"p":"","c":"Cardinal","l":"NE"},{"p":"","c":"GomokuCell","l":"neighbour"},{"p":"","c":"GomokuGame","l":"newGame()"},{"p":"","c":"Color","l":"NIL"},{"p":"","c":"Cardinal","l":"NW"},{"p":"","c":"Player","l":"Player()","u":"%3Cinit%3E()"},{"p":"","c":"GomokuGame","l":"player1"},{"p":"","c":"GomokuGame","l":"player2"},{"p":"","c":"GomokuAI","l":"random"},{"p":"","c":"Cardinal","l":"S"},{"p":"","c":"GomokuGame","l":"save(Path)","u":"save(java.nio.file.Path)"},{"p":"","c":"Cardinal","l":"SE"},{"p":"","c":"GomokuCell","l":"setState(Color)"},{"p":"","c":"GomokuGame","l":"startGame()"},{"p":"","c":"GomokuCell","l":"state"},{"p":"","c":"Cardinal","l":"SW"},{"p":"","c":"GomokuCell","l":"toString()"},{"p":"","c":"Cardinal","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"","c":"Color","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"","c":"Cardinal","l":"values()"},{"p":"","c":"Color","l":"values()"},{"p":"","c":"Cardinal","l":"W"},{"p":"","c":"Color","l":"WHITE"},{"p":"","c":"Coordinate","l":"x"},{"p":"","c":"Coordinate","l":"y"}];updateSearchResults(); \ No newline at end of file diff --git a/doc/overview-tree.html b/doc/overview-tree.html index bf4b96a..44330e0 100644 --- a/doc/overview-tree.html +++ b/doc/overview-tree.html @@ -1,7 +1,7 @@ - + Class Hierarchy diff --git a/doc/package-summary.html b/doc/package-summary.html index a82f21a..97e8d9c 100644 --- a/doc/package-summary.html +++ b/doc/package-summary.html @@ -1,7 +1,7 @@ - + Unnamed Package diff --git a/doc/package-tree.html b/doc/package-tree.html index f143bde..8b32c6a 100644 --- a/doc/package-tree.html +++ b/doc/package-tree.html @@ -1,7 +1,7 @@ - + Class Hierarchy diff --git a/doc/search.html b/doc/search.html index 99a272e..79f36e1 100644 --- a/doc/search.html +++ b/doc/search.html @@ -1,7 +1,7 @@ - + Search diff --git a/src/GomokuCell.java b/src/GomokuCell.java index 3d8ef44..10e1de0 100644 --- a/src/GomokuCell.java +++ b/src/GomokuCell.java @@ -1,4 +1,5 @@ import java.util.EnumMap; +import java.util.concurrent.ExecutionException; /** * This class is cell of the board of the Gomoku game. @@ -47,6 +48,17 @@ public class GomokuCell{ return this.state; } + //------------------Sets-------------------------- + + /** + * + */ + public void setState(Color c){ + if (!this.isPlayable()) + throw new IllegalStateException("This cell is not playable !" + this.toString()); + this.state = c; + } + //------------------Booleans-------------------------- @@ -86,4 +98,9 @@ public class GomokuCell{ this.neighbour.put(car, cell); } + //------------------Overides-------------------------- + @Override + public String toString() { + return this.neighbour.toString() + this.state.toString(); + } }