chess.view.command.Controller Class
Controller for the command line view
Item Index
Methods
addControllerEvents
()
Add listeners to the controller
errorMessage
-
msg
Fire a "sendErrorMessage" event. A chess.view.command.Panel view will listen to this event and display the error message on screen
Parameters:
-
msg
String
getCommandArguments
-
message
Extract command arguments from command message. The whole message would be returned when message is not a valid command.
Parameters:
-
message
String
Returns:
Example:
var args = controller.getCommandArguments('move e4'); // will return "e4"
getValidCommand
-
command
Return valid command name
Parameters:
-
command
String
Returns:
isValidGrade
-
arg
Returns true if passed argument is a valid move grade/short comment, i.e. !,?,!!,??,!? or ?!
Parameters:
-
arg
Object
Returns:
message
-
msg
Fire a "sendMessage" event. Listening views may display this message on screen (example a chess.view.command.Panel view).
Parameters:
-
msg
String
onInvalidMove
()
Show invalid move message
receiveMove
-
controller
-
move
Receive move from main controller and display move message on screen
Parameters:
-
controller
chess.controller.Controller -
move
chess.model.Move
recieveMoveUpdate
-
model
-
move
Receive move update from main controller and fire a message event which will be displayed by a chess.view.command.Panel view
Parameters:
-
model
chess.model.Game -
move
chess.model.Move
showHelp
()
Show command line help screen