Hacker News new | ask | show | jobs
by dlsym 4125 days ago
Food / Poison break even was at 88. A chart would be interesting.

However - since R2D2 seems like a slow learner it would be nice to speed up the time a little bit.

4 comments

Warning: I only glanced through the code real quickly, so I haven't checked to see if this has unintended side effects to the game logic, or to make sure it's a complete solution.

It looks like there's a variable that controls how quickly the board itself is updated:

  var boardGameUpdateInterval = 10;
And a function deciding how quickly the visual representation gets updated:

  var render = function () {
      setTimeout( function() {          
          requestAnimationFrame(render);
      }, 1000 / 15);

      if (gameTicks % boardGameUpdateInterval == 0) {
          updateBoard();
      }
  
      animateBoard();
  
      gameTicks++;
      renderer.render(scene, camera);
  };
  
They're global variables so it's pretty easy to just drop into the developer console and overwrite them.

I just changed the denominator of the setTimeout to 30 instead of 15, and the boardGameUpdateInterval to 5 instead of 10. Of course, you don't have to change the render speed to get the logic speedup, but I figured I'd do both.

This appears to have sped the simulation speed up by a factor of two.

ymmv

I've gone as far as ~1000 food ~100 poisson blocks to make sure it's on the right track. Speeding this up is a good idea, I'll make some time to add this and post an update. You can ping me on twitter @javierluraschi.
After ~30mins I got ratio of 0.77 (375 greens, 111 blacks), it got pretty good at avoiding blacks after reaching 0.7.
I am currently at 175 vs 75