Skip to content

Instantly share code, notes, and snippets.

@tedkulp
Last active December 28, 2022 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedkulp/d54922972c6856cd850a45f6413f6f51 to your computer and use it in GitHub Desktop.
Save tedkulp/d54922972c6856cd850a45f6413f6f51 to your computer and use it in GitHub Desktop.
Antimatter Dimensions - Tickspeed Challenge Helper
// Written by Anth42
// Antimatter Dimensions - Tickspeed Challenge Helper
// https://pastebin.com/ebTjWEFP
//
// Updated for 2022 by Ted Kulp
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
setTimeout(() => {
jQuery.noConflict();
var ids = ['button.tickspeed-btn',
'.l-dimension-single-row:nth-child(1) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(2) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(3) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(4) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(5) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(6) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(7) button.o-primary-btn--buy-10-ad',
'.l-dimension-single-row:nth-child(8) button.o-primary-btn--buy-10-ad',
];
var increments = [1, 3, 4, 5, 6, 8, 10, 12, 15]
var to = setInterval(testValues, 200);
function testValues() {
var counts = ids.map(function (x) {
var element = jQuery(x);
if(!element) {
return -1;
}
var parent = element.parent().parent();
element.css('background', 'transparent');
var text = element.text();
var index = text.lastIndexOf("e");
var cost = -1;
if(index !== -1 && element.css('visibility') !== 'hidden' && parent.css('display') !== 'none') {
cost = parseInt(text.substr(index + 1));
}
return cost;
});
var results = [];
var minCost = 9999;
var minI = 8;
for (var i = 0; i < increments.length; i++) {
var countsClone = counts.slice();
if(countsClone[i] < 0) {
continue;
}
countsClone[i] += increments[i];
if (!hasDuplicates(countsClone)) {
var cost = countsClone[i];
if (cost <= minCost) {
minCost = cost;
minI = i;
}
results.push({
i: i,
cost: cost
});
} else {
}
}
jQuery(ids[minI]).css('background', 'green');
}
function hasDuplicates(array) {
array = array.filter(function(i) {
return i >= 0;
});
return (new Set(array)).size !== array.length;
}
}, 2500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment