Skip to content

Instantly share code, notes, and snippets.

Last active January 12, 2022 08:59
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
This script will generate past game results for Bustabit. Copy the script below and paste it in to a new script window on bustabit. Please note this version only generates the past results, not future results. The save to file option has never worked for me. Script produced by Dsetzer (original can be found at
//Script was produced by Dsetzer original can be found at
//In the script panel in Bustabit create a new script. Copy the script below and paste it in to the script window on bustabit.
//Please note this version will only give you past results and not future results.
//The script has a save to file option, but this has never worked for me.
var config = {
span: { label: 'Previous Games', type: 'number', value: '100' },
outh: { label: 'Include Hashes', type: 'checkbox', value: false },
ocsv: { label: 'Download CSV', type: 'checkbox', value: true}
Object.entries(config).forEach((c) => window[c[0]] = c[1].value);
let hashes = new Map(), lastGame = engine.history.first();
let currentId =, currentHash = lastGame.hash;
let games = new Array();
function downloadString(text, fileName) {
var blob = new Blob([ text ], { type: 'text/csv' });
var a = document.createElement('a'); = fileName;
a.href = URL.createObjectURL(blob);
a.dataset.downloadurl = [ 'text/csv',, a.href ].join(':'); = "none";
setTimeout(function () { URL.revokeObjectURL(a.href); }, 1500);
for(let i = currentId, result, len = currentId - span; i >= len; i--){
hashes.set(i, String(currentHash));
currentHash = SHA256((currentHash));
hashes.forEach((hash, id) =>{
let gameResult = gameResultFromHash(hash);
log(`Game: ${id}, Bust: ${gameResult}${outh?', Hash: '+hash:''}`);
if(ocsv) games.push(`${id}, ${gameResult}${outh?', '+hash:''}\n`);
games.unshift(`id, result${outh?', hash':''}`);
downloadString(games.join('\r\n'), 'game_results.csv');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment