- // gameInfo (immutable once set) changes when a new game starts
- "gameInfo": function() {
- // Reset all variables
- this.endgameMessage = "";
- this.orientation = this.gameInfo.mycolor || "w"; //default orientation for observed games
- this.score = this.gameInfo.score; //mutable (if initially "*")
- this.moves = this.gameInfo.moves; //TODO: this is mutable; make a copy instead
- const L = this.moves.length;
- this.cursor = L-1;
- this.lastMove = (L > 0 ? this.moves[L-1] : null);
- },
- analyze: function() {
- if (this.analyze)
- {
- // Switched to analyze mode: game is over
- this.endGame("*");
- }
+ // game initial FEN changes when a new game starts
+ "game.fenStart": function() {
+ this.re_setVariables();