Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Spaceplan (jhollands.co.uk)
252 points by dcminter on Aug 12, 2016 | hide | past | favorite | 66 comments


I love it! Found myself doing mental calculations for the most effective thing to buy next, and the next thing I knew I'd written a script to automatically buy it:

    var clickBestThing = function(){
       var things = [...document.querySelectorAll("#manufacture__container > div")].map(function(e){
        var res = {e};
        [...e.getElementsByTagName("span")].map(function(s){
          res[s.id] = +s.innerText.replace(/[^0-9]/g, '')
        })
        if(e.id === "item__spudGun" || e.id === "item__potatoLauncher") res.powerGain *= 1000;
        res.score = res.cost / res.powerGain;
        // res.score = res.cost / res.spudGain;
        res.name = e.getElementsByClassName("manufacture__name")[0].innerText;
        return res
      }).sort(function(a,b){return a.score - b.score})

      window.things = things;

      var bestThing = things[0];
      if(!things[things.length-1].score) bestThing = things[things.length-1]
      console.info("clicking " + bestThing.name)
      things[0].e.click();
    }
    var timer = setInterval(clickBestThing, 5000)
Of course it's much easier to `power = 999...`, but this feels more like automation and less like cheating.


You can actually improve this a little with a better scoring function. Suppose we currently produce p, and A costs cA, for a power gain of pA. Likewise for B. Under the assumption that we will buy at least one more of A and B, we can look at whether A then B or B then A is faster, which is:

cA/p + cB/(p+pA) < cB/p + cA/(p+pA)

Solving this, we get cA * (p+pA)/pA < cB * (p+pB)/pB Since the left side is all in A, if we pick the item minimizing that quantity, it is faster to buy it before any other item. So changing res.score to be res.cost * (cur_power + res.powerGain)/res.powerGain is going to be a bit faster


Ahh of course! I had the thought to take this into account but couldn't wrap my head around the math last night.

cA/p is just the time it would take to earn the money to buy A at the current production level - seems much simpler now.

I think the last term should be `cA/(p+pB)`. When I solve from there[1] I get `cB * pB < cA * pA`, which means that the most optimal item A will have the largest product `cA * pA`.

This would translate to:

    res.score = res.cost*res.powerGain
    ...
    }).sort(function(a,b){return b.score - a.score})   
Does that check out? It seems too simple, and now that I'm thinking more about it I think this would be functionally equal to what I already have. Did I do my inequality[1] wrong?

1. http://i.imgur.com/pyMY3zr.jpg


Slight modification so it doesn't automatically buys the item but just highlights the best one

https://gist.github.com/thexa4/2da63028a1d8007dedbd0ba9432c8...



Nice! After clicking the button a few times my first inclination was also to open the console and see how I could make my life easier.


Typical Noob idiot coming through, first of all i've got to praise you for doing that the amount of effort that took must be high, but being the typical noob idiot I am I have to also wonder how I actually use this? reply


No need to be self deprecating - this isn't 4chan :)

Copy and paste the code in your browser's javascript console. In Chrome it's under View/Developer/JavaScript Console.

For a good intro on how this works: https://www.khanacademy.org/computing/computer-programming/h...


I might just be tired and dense. But does watts per second make sense here? Shouldn't the accumulated power be in joules (or Watt hours?) and the per second value just be watts?


In our universe, energy would be accumulated (measured in joules or watt-seconds), and each upgrade bought would produce more power (measured in watts or joules per second). But the game might be taking place in an alternate timeline where James Joule and James Watt were switched at birth (also born at the same time).


This is the best explanation.


Yes. Yes it should.

...I'd complain but I'm too busy micromanaging space potatoes.


A really well executed Incremental game[1] and the best part about it is that it has an ending. Even a retro end-game sequence. Well done. I really enjoyed it.

[1] https://en.wikipedia.org/wiki/Incremental_game


See Cookie Clicker for the original (or early) quirky game: http://orteil.dashnet.org/cookieclicker/


Nicely done! I just finished with no cheats and thoroughly enjoyed myself.

The level of polish is what kept me clicking 285 times just to 'start' the game. Very cool.


And here's the Stranger Things Soundtrack[1] to play in the background.

[1] https://youtu.be/5sy2qLtrQQQ


There goes my Saturday morning! Time to go stick my wrists in a bucket of ice.

Kudos to the developers. Really lovely game, intuitive and entertaining, well-built.


Why is everyone clicking so much? Once you get your first few 'taters the extra gain from clicking is so small as to be pointless.


Once I figured there would be lots of clicking, I went into the console and typed the following to automate the Kinetigen:

var ki = setInterval(function() { kinetigenClick(); kinetigenRelease(); }, 10);

Then later on at a certain point in the game, I had to stop it:

clearInterval(ki);


Tried pasting your code into the console, but i'm getting the following error:

(program):1 Uncaught ReferenceError: kinetigenClick is not defined

What am I doing wrong?


Never before have I been so eager to shoot potatoes into the sun.


Why do you keep doing this? :(

You put a clicker in front of me and baam. Lost a hour.


Loading 'Cookie' library -- haha, nice. Lost a lot of time to cookie clicker


I think I like it more than No Man's Sky. But I'm suing you for carpel tunnel.

Good stuff, thanks for sharing!


If you wanna avoid carpel tunnel, window.setInterval(kinetigenClick, 1) :P


I always feel cheat codes don't let me experience the game as its designer intended. But... always tempting. :)


Given how little obfuscation surrounds the click button, what if scripting it was what the developer intended?


I have no idea how to prevent people from 'hacking' my game, but I don't think I'd try to stop them — it's so fun to see what people are coming up with. I'm learning from it!


or even less annoying:

var x = 0; while(x < 10000) { x++; kinetigenClick(); kinetigenRelease(); }


Had to save+reset after bumping this up to 100000, but it only took a few seconds and now I have 6 million watts. Dropping my first Tater Tower. Beautiful, elegant cheat.


"Beautiful, elegant cheat."

That is the nicest thing anyone has ever called me.


power += 100000000000


Or open with a tablet, I couldn't do anything.


Reminds me of Larry Niven's Ringworld, or more specifically the Puppeteers and their planet-ships fleeing the galaxy.


For me, it was Liu Cixin's 'The Wandering Earth', with a heavy dose of Stephen Baxter hard-SF (ish) cosmic madness. And potatoes.


I learned so much about myself. Time to cook some potatoes.


Why do we accumulate watts? That's stupid.


Check Tipler. We won't need them now, we would be even much better off to save more, but we would need them to save the world on the galactic scale.


C'mon man, what's it take to post a link?

https://en.wikipedia.org/wiki/Frank_J._Tipler


Love potatoes. And saved the world in 2 hours. (without cheating)


Hmm... I seriously doubt that's possible. How?


Looks like Cookie clicker [1]

[1] http://orteil.dashnet.org/cookieclicker/


It's basically cookie clicker with an actual plot and an ending.


Here are some useful shortcuts:

power = n; (where n is whatever you need)

sol.mass = 3e7;

Cool game!


Okay, now that more people have played, what is everyone's fastest time getting to the end (without cheats)?

Fun game concept!


Took me about four hours, toward the end I was playing it more like a Tamagotchi (click the buttons every now and then and then leave it to rack up more power).

Also [[SPOILERS]] the ending sequence wedged after 'go be a hero', luckily when I refreshed the page it put me back to just before the black hole bit. Maybe it broke because I was on the solar system view and not the planet view or something? It worked the second time anyway.


This is bloody amazing. Best way to spend a quiet Saturday morning :)


Just came back to this... they've done a very good job of blocking "click" automation!


хороший один товарищ


Obviously a direct translation from English to Russian -- I doubt a Russian would ever actually say this.

They should change it to: молодец.


Неплохо, товарищ


Pomme de terra


Is this a Latvian game studio?


How do I obtain the planet boosters?

Also, thanks for ruining my dissertation...


Click "System Peeker" in the top middle of the screen, under "Planet Looker"


Cool, but does a clicker game really need to use 4 cores?


Beautifully done :)


POMME DE TERRE


nice ending scene with pomme de terre.


Very fun! Only cheated a little.


Great game! Thanks for sharing :D


so I did `for i in {1..10000}; do xdotool click 1; done` and ... the game crashed :(


Do `setInterval(kinetigenClick, 1)` instead.


Frighteningly addictive.


Surprisingly addictive.


Loved it




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: