chess.controller.TacticController Class
Chess game controller for tactic puzzles, i.e. boards where you make a move in a a game and the next move is auto played.
Constructor
chess.controller.TacticController
-
config
Parameters:
-
config
Object
Example:
var controller = new chess.controller.TacticController({
databaseId:4,
alwaysPlayStartingColor:true
});
controller.loadRandomGame();
Item Index
Methods
Attributes
Methods
flipBoard
()
Flip board. The only thing this method does is to fire the flipBoard event.
Returns:
getCurrentModel
()
Return active game
Returns:
loadNextGame
()
Load next game in selected database. This method will only work if you have a grid with list of games. The only thing this method does is to fire the "nextGame" event which the list of games grid listens to. The grid will go to next game and fire it's selectGame event
Returns:
loadPreviousGame
()
Load previous game from selected database. For info, see loadNextGame
Returns:
loadRandomGame
()
Load random game from current database
Returns:
nextMove
()
Go to next move
Returns:
pauseGame
()
Pause auto play of moves
Returns:
playMoves
()
Start auto play of moves in current game from current position
Returns:
previousMove
()
Go to previous move
Returns:
toEnd
()
Go to end of current game
Returns:
toStart
()
Go to start of current game
Returns:
Attributes
alwaysPlayStartingColor
Boolean
True to always play starting color in game. Otherwise, you will play black if black is the winning color and white if white is the winning color. If no winner is registered in the game(result or by calculating final position), you will play white
Default: false
Events
commentAfter
Event fired when the Comment after a move dialog should be shown.
Event Payload:
-
currentModel
chess.model.Game -
move
Object
commentBefore
Event fired when the Comment before a move dialog should be shown.
Event Payload:
-
currentModel
chess.model.Game -
move
Object
flip
flip event. A board is example of a view listening to this event. When it's fired, the board will be flipped
newGameDialog
New game dialog event
nextGame
next game event