diff --git a/6_pgn.js b/6_pgn.js index 7fb5c14d..9837fa71 100644 --- a/6_pgn.js +++ b/6_pgn.js @@ -251,7 +251,7 @@ function LoadPGNRecord(o) { throw `"${s}" -- ${error}`; } - node = node.make_move(move); + node = node.make_move(move, true); } } diff --git a/8_tree.js b/8_tree.js index 8e605b39..2838ca5e 100644 --- a/8_tree.js +++ b/8_tree.js @@ -8,13 +8,15 @@ const node_prototype = { - make_move: function(s) { + make_move: function(s, force_new_node) { // s must be exactly a legal move, including having promotion char iff needed (e.g. e2e1q) - for (let child of this.children) { - if (child.move === s) { - return child; + if (!force_new_node) { + for (let child of this.children) { + if (child.move === s) { + return child; + } } }