Hacker News new | past | comments | ask | show | jobs | submit login

Nice work, but unfortunately it doesn't seem to implement the card draw algorithm correctly, which leads to unplayable games pretty quickly (the card draw algorithm must pick the same number of 1s and 2s over a short time horizon for the game to be playable).

The actual algorithm used by Threes is as follows:

1. At start, shuffle a deck containing 4 each of ones, twos, and threes.

2. For each round, roll a 21-sided die. If it's a one and the largest value on the board V is >= 48, choose a tile that is randomly chosen from the range 3 to V/8 inclusive. Otherwise, take the next tile off the stack.

3. If the stack is empty, refill it as above.

Here's a Scala implementation of this logic: https://github.com/mwylde/Threes.scala/blob/master/src/main/....




Yeah, I know- it's just drawing a random number. I didn't have space to improve on that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: