Skip to content

Instantly share code, notes, and snippets.

@potench
Last active February 17, 2024 19:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potench/4753278 to your computer and use it in GitHub Desktop.
Save potench/4753278 to your computer and use it in GitHub Desktop.
Script to unlock all combinations in Little Alchemy

Little Alchemy Unlock all Combinations in Little Alchemy

Review

Wanted to finish Little Alchemy, but got made fun of for playing it - so I found a loophole. Thanks to @meatbody for trolling me into doing this.

Instructions

  1. Go to and Play Little Alchemy.
  2. Open your JavaScript console (Command + j or View >> Developer >> JavaScript Console)
  3. Copy paste the JavaScript below into the JavaScript console then hit ENTER
  4. Refresh the page to see all the unlocked combinations in the side panel
  5. If you run this script and already have a lot of combinations figured out it may run pretty slowly (not sure why, probably the $ name-attribute lookup)...

(3) Copy + Paste this into the console

(function cheat(combinations){var results=[],matches=[],total=5;buildMatchList();saveMatchList();console.log("--------------------------------");console.log("::work complete:: now refresh.");console.log("--------------------------------");function saveMatchList(){alchemy.history.parents=[];matches.map(function(r){alchemy.history.parents.push(r)});alchemy.saveProgress(true)}function buildMatchList(){var match,i,ii,iii,pos;for(i=0;i<combinations;i++){results[i]=alchemy.potentialOffspring(i)}for(i=0;i<results.length;i++){for(ii=0;ii<results[i].length;ii++){match=results[i][ii];if(!matches[match]){for(iii=0;iii<results.length;iii++){pos=results[iii].indexOf(match);if(pos>-1){if(isMatch([i,iii],match)){break}else if(isMatch([iii,iii],match)){break}}}if(!matches[match]){if(!isMatch([i,i],match)){console.log("!!!!!",match,getAlchemyName(match),i,getAlchemyName(i))}}}}}}function isMatch(m,match){var combo=alchemy.sex(m),pos=combo.indexOf(match)>-1,len=combo.length;if(len&&pos){matches[match]=m;console.log(total+":"+getAlchemyName(match)+" = "+getAlchemyName(m[0])+" + "+getAlchemyName(m[1]));total++;return true}return false}function getAlchemyName(id){return $(alchemy.originStr(id)).filter("h2").find("img").attr("alt")}})(450);

Screenshot of What Happens

What you should see after running the script

Unminified JavaScript

The unminified script is included below for your review.

/**
* Author @potenchious
*/
(function cheat (combinations) {
var results = [],
matches = [],
total = 5;
buildMatchList();
saveMatchList();
console.log("--------------------------------");
console.log("::work complete:: now refresh.");
console.log("--------------------------------");
function saveMatchList () {
alchemy.history.parents = [];
matches.map(function (r) { alchemy.history.parents.push(r); });
alchemy.saveProgress(true);
}
function buildMatchList () {
var match,
i,
ii,
iii,
pos;
for (i = 0; i < combinations; i++) { // all results
results[i] = alchemy.potentialOffspring(i);
}
for (i = 0; i < results.length; i++) {
for (ii = 0; ii < results[i].length; ii++) { // look for match in each array
match = results[i][ii]; // look for this match in main results
if(!matches[match]) {
for (iii = 0; iii < results.length; iii++ ) { // back through total results
pos = results[iii].indexOf(match); // found a potential combinator
if (pos > -1) {
if (isMatch([i,iii], match)) {
break;
} else if (isMatch([iii,iii], match)){ // might combine with self
break;
}
}
}
if (!matches[match]) { // means combines with self
if (!isMatch([i,i], match)) {
console.log("!!!!!", match, getAlchemyName(match),i, getAlchemyName(i));
}
}
}
}
}
}
function isMatch (m, match) {
var combo = alchemy.sex(m),
pos = combo.indexOf(match) > -1,
len = combo.length;
if (len && pos) {
matches[match] = m;
console.log(total + ":" + getAlchemyName(match) + " = " + getAlchemyName(m[0]) + " + " + getAlchemyName(m[1]) );
total++;
return true;
}
return false;
}
function getAlchemyName (id) {
return $(alchemy.originStr(id)).filter("h2").find("img").attr("alt");
}
})(450);
@rickylopezrios1017
Copy link

  • j

@VelocityFever
Copy link

"err: alchemy is not defined." You really need to update this...

@DINUMINER
Copy link

this game is so fun

@clevelandc
Copy link

dis doenst work,,,,,,,,

@MrQuackerson
Copy link

yea

@tirtamn
Copy link

tirtamn commented Feb 6, 2024

good

@i3djgf
Copy link

i3djgf commented Feb 17, 2024

there aint no control button on windows key board

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment