Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 14x 14x 8x 2x 6x 6x 14x 14x 14x 6x 6x 6x 8x 14x 14x | // Generated by ReScript, PLEASE EDIT WITH CARE
let defaults = {
windowMs: 300
};
function inverse(move) {
let match = move.length;
if (match !== 1) {
if (match !== 2 || move.substring(1, 2) !== "'") {
return;
} else {
return move.substring(0, 1);
}
} else {
return move + `'`;
}
}
function step(state, move, timestamp, configOpt) {
let config = configOpt !== undefined ? configOpt : defaults;
let match = inverse(move);
let result;
if (state !== undefined && match !== undefined) {
let previousTimestamp = state[1];
let previousMove = state[0];
result = previousMove === match && timestamp >= previousTimestamp && timestamp - previousTimestamp <= config.windowMs ? previousMove : undefined;
} else {
result = undefined;
}
let nextState = result !== undefined ? undefined : [
move,
timestamp
];
return [
nextState,
result
];
}
let initial;
export {
defaults,
initial,
step,
}
/* No side effect */
|