API Docs for: 0.0.2
Show:

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:

Example:

 var controller = new chess.controller.TacticController({
     databaseId:4,
     alwaysPlayStartingColor:true
 });
 controller.loadRandomGame();

Methods

addMove

(
  • move
)

Add a move to current model

Parameters:

Returns:

undefined

flipBoard

()

Flip board. The only thing this method does is to fire the flipBoard event.

Returns:

undefined

getCurrentModel

()

Return active game

Returns:

object chess.model.Game

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:

undefined

loadPreviousGame

()

Load previous game from selected database. For info, see loadNextGame

Returns:

undefined

loadRandomGame

()

Load random game from current database

Returns:

void

nextMove

()

Go to next move

Returns:

undefined

pauseGame

()

Pause auto play of moves

Returns:

undefined

playMoves

()

Start auto play of moves in current game from current position

Returns:

undefined

previousMove

()

Go to previous move

Returns:

undefined

selectDatabase

(
  • database
)

Select a database

Parameters:

toEnd

()

Go to end of current game

Returns:

undefined

toStart

()

Go to start of current game

Returns:

undefined

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:

commentBefore

Event fired when the Comment before a move dialog should be shown.

Event Payload:

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

selectDatabase

Select database event

Event Payload: