summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-22 15:29:25 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commitd5bdd1fdd6229353c06606fc83c27196d5c0f42a (patch)
tree572a271f1455c0109808c944cd894749a61c3f82
parentf8c759a3d71576463c3a9fa71a1e60d621a977ce (diff)
downloadrommel-in-the-desert-d5bdd1fdd6229353c06606fc83c27196d5c0f42a.tar.gz
Simplify checkpointing logic.
-rw-r--r--rules.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index 2f1d249..ec19468 100644
--- a/rules.js
+++ b/rules.js
@@ -7049,10 +7049,10 @@ exports.setup = function (seed, scenario, options) {
}
exports.is_checkpoint = function (a, b) {
- if (!a.log) return true
- let ax = a.log[a.log.length-2].startsWith(".h2")
- let bx = b.log[b.log.length-2].startsWith(".h2")
- return bx && (!ax || a.log.length !== b.log.length)
+ let an = 0, bn = 0
+ for (let line of a.log) if (line.startsWith(".h2")) ++an
+ for (let line of b.log) if (line.startsWith(".h2")) ++bn
+ return an !== bn
}
exports.view = function(state, current) {