keep a string of moves/comments when parsing PGN.

This commit is contained in:
2021-06-05 20:41:53 +02:00
parent 6c8c93f451
commit 638ad1fd2d
2 changed files with 10 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ class CHESS_JSON {
const MOVE_ACTIONS = 'actions';
const MOVE_VARIATIONS = 'variations';
const MOVE_MOVES = 'moves';
const MOVE_MOVES_STRING = 'movesStr';
const MOVE_CAPTURE = 'capture';
const MOVE_PROMOTE_TO = 'promoteTo';
const MOVE_CASTLE = 'castle';
@@ -29,10 +30,12 @@ class CHESS_JSON {
const PGN_KEY_ACTION_CLR_ARROW = "cal";
protected static $jsKeys = array('MOVE_FROM', 'MOVE_TO', 'MOVE_NOTATION', 'FEN','MOVE_COMMENT',
'MOVE_ACTION', 'MOVE_VARIATIONS', 'MOVE_MOVES','MOVE_CAPTURE','MOVE_PROMOTE_TO','MOVE_CASTLE',
'GAME_METADATA', 'GAME_EVENT', 'GAME_WHITE','GAME_BLACK', 'GAME_ECO',
protected static $jsKeys = array(
'MOVE_FROM', 'MOVE_TO', 'MOVE_NOTATION', 'FEN',
'MOVE_COMMENT', 'MOVE_ACTION', 'MOVE_VARIATIONS', 'MOVE_MOVES',
'MOVE_MOVES_STRING', 'MOVE_CAPTURE', 'MOVE_PROMOTE_TO', 'MOVE_CASTLE',
'GAME_METADATA', 'GAME_EVENT', 'GAME_WHITE', 'GAME_BLACK',
'GAME_ECO',
);
public static function toJavascript(){
@@ -42,4 +45,4 @@ class CHESS_JSON {
}
return 'ludo.CHESS_JSON_KEY = ' . json_encode($ret) .';';
}
}
}