summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 11ca1dd..673ef5a 100644
--- a/rules.js
+++ b/rules.js
@@ -334,7 +334,7 @@ function clear_undo() {
function push_undo() {
game.undo.push(JSON.stringify(game, (k,v) => {
- if (k === 'undo') return undefined;
+ if (k === 'undo') return 0;
if (k === 'log') return v.length;
return v;
}));
@@ -343,7 +343,7 @@ function push_undo() {
function pop_undo() {
let undo = game.undo;
let save_log = game.log;
- Object.assign(game, JSON.parse(undo.pop()));
+ game = JSON.parse(undo.pop());
game.undo = undo;
save_log.length = game.log;
game.log = save_log;
@@ -2880,7 +2880,7 @@ exports.action = function (state, current, action, arg) {
S[action](arg, current);
else
throw new Error("Invalid action: " + action);
- return state;
+ return game;
}
exports.resign = function (state, current) {
@@ -2891,9 +2891,11 @@ exports.resign = function (state, current) {
if (current === TR)
goto_game_over(US, "Tripolitania resigned.");
}
- return state;
+ return game;
}
+exports.is_checkpoint = (a, b) => a.season !== b.season;
+
exports.view = function(state, current) {
game = state;