Document GomokuRenderer class file
This commit is contained in:
@@ -1,11 +1,73 @@
|
||||
|
||||
/**
|
||||
* Gomoku game renderer class.
|
||||
*
|
||||
* This class is responsible for rendering the Gomoku game.
|
||||
* It provides methods to initialize the renderer, update the game state,
|
||||
* and update the game status.
|
||||
*
|
||||
* The GomokuRenderer class is an abstract class that should be extended
|
||||
* by specific renderer implementations. The init method is called to initialize
|
||||
* the renderer with the game instance, and setup the renderer.
|
||||
* The update method is called to update the game state, such as updating the
|
||||
* board and tokens. The updateStatus method is called to display status messages
|
||||
* to the user, such as player turns or game results.
|
||||
*
|
||||
* @see ConsoleRenderer
|
||||
*/
|
||||
public abstract class GomokuRenderer {
|
||||
|
||||
/**
|
||||
* The Gomoku game instance.
|
||||
*
|
||||
* This instance is used to access the game state and perform rendering.
|
||||
*/
|
||||
protected GomokuGame game;
|
||||
|
||||
public abstract void init(GomokuGame game);
|
||||
/**
|
||||
* Initializes the Gomoku renderer with the game instance.
|
||||
*
|
||||
* @param game The Gomoku game instance to be rendered.
|
||||
*/
|
||||
public GomokuRenderer(GomokuGame game) {
|
||||
this.game = game;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor for the Gomoku renderer.
|
||||
*
|
||||
* This constructor is used when no game instance is provided.
|
||||
*/
|
||||
public GomokuRenderer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the Gomoku renderer.
|
||||
*
|
||||
* This method is called to initialize the renderer.
|
||||
* It should be overridden by specific renderer implementations to perform
|
||||
* any necessary setup.
|
||||
*/
|
||||
public abstract void init();
|
||||
|
||||
/**
|
||||
* Updates the Gomoku renderer.
|
||||
*
|
||||
* This method is called to render the current game state.
|
||||
* It should be overridden by specific renderer implementations to perform
|
||||
* the actual rendering of the game state.
|
||||
*/
|
||||
public abstract void update();
|
||||
|
||||
/**
|
||||
* Updates the game status.
|
||||
*
|
||||
* This method is called to display status messages to the user.
|
||||
* It should be overridden by specific renderer implementations to perform
|
||||
* the actual rendering of the game status.
|
||||
*
|
||||
* @param status The status message to be displayed.
|
||||
*/
|
||||
public abstract void updateStatus(String status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user