2 player adversarial knapsack on a radial graph
Rules of the game
You are playing against the computer. You = Green, Computer = Orange.
You see 64 pouches. Each pouch has a price and a weight. So $2 /3 means the pouch costs $2 and weighs 3 lbs.
To begin, click on any pouch. From then on, you can only click on a pouch the previous pouch is connected to.
When BOTH you and the computer cross 100 lbs, whoever makes the most money per pound wins!
Getting Stuck: If all the pouches you are connected to have already been clicked, you are stuck.
If you or the computer gets stuck, whoever makes the most money per pound wins!
Advice:
Beware of pouches with negative dollar amount!
If you start in thev innermost circle or the outermost, your chances of winning are remote.
It is hard to beat the computer. But keep trying!
Beating the computer by making the computer get stuck is a nice strategy :)
Notes:
Source Code in Scala
Do NOT zoom in !!! The game is set up for fixed 900x900 coordinate space, not relative coordinates.
This is my first scala.js program, inspired by Shadaj
As of July 2013, you can't use any Java built-in libraries in Scala.js, so I rely on JS for random numbers, not scala.util.Random
Thanks to Sébastien Doeraene for helping out with Scala.js
Krishnan Raman, Data Scientist, Twitter (kraman@twitter.com)