Created
July 15, 2020 18:00
-
-
Save dsetzer/cafbc71be93d1925678b8dd30f0f5745 to your computer and use it in GitHub Desktop.
Generates previous games from within the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
span: { label: 'Previous Games', type: 'number', value: '100' }, | |
outh: { label: 'Print Hashes', type: 'checkbox', value: false } | |
}; | |
Object.entries(config).forEach((c) => window[c[0]] = c[1].value); | |
let hashes = new Map(), lastGame = engine.history.first(); | |
let currentId = lastGame.id, currentHash = lastGame.hash; | |
for(let i = currentId, result, len = currentId - span; i >= len; i--){ | |
hashes.set(i, String(currentHash)); | |
currentHash = SHA256((currentHash)); | |
} | |
let logGame = (hash, id) => log(`Game: ${id}, Bust: ${gameResultFromHash(hash)}${outh?', Hash: '+hash:''}`); | |
hashes.forEach(logGame); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment