Incomplete / Under Construction
A Game Controller contains the game logic, necessary UI interaction handling, and renders everything needed for the game within the provided div element.
There is a required interface for the main GameController object, and the GameNotation object.
- Create a new directory under
js
directory - Create a GameController javascript class/object.
- Implement the following methods
Constructor takes two parameters:
- gameContainer
- This is the div element that your game needs to be put in
- isMobile
- Boolean flag for if running on mobile device
Example:
function CheckersController(gameContainer, isMobile) {
....
}
Returns the GameType id for your game. Add your game to GameType in PaiShoMain.js.
Example:
CheckersController.prototype.getGameTypeId = function() {
return GameType.Checkers.id;
};
Called when rewinding moves.
Called when rewinding moves.
Returns new game notation object for your game.
- moves
- Variable: Array of moves
- addMove(move)
- Add given move to
moves
- Add given move to
- notationTextForUrl()
- Return notation text as single line string
Called when the game should re-render.
Called when the user's move needs to be reset, from clicking the Undo Move link.
Should return the default string of the html content to put in the Help tab.