EmielMols 12 years ago

Detection of the game-over state seems buggy: I had moves left on a full board then got the 'GG' modal.

sphericalgames 12 years ago

I got 4 x 16s first row, 4 x 8s second row, 4 x 4s 3rd row and 4 x 2s on last row just by pressing up.

Then it says game over.

This is wrong because I should be able to shift left / right and merge those same numbers that are matching in a row.

It seems it is game over if all 16 cells are filled in regardless if a move is still possible.

  • TobbenTM 12 years ago

    No, the problem is the it think it's over when you do a move and no numbers can merge. The board may be full, and you may have possibilities but you did a move where no numbers could merge.

    Also; this version does not implement the random spawn (10% chance to spawn a 4 instead of a 2)

    Still impressive for it's size though.

_xhok 12 years ago

Wow, compressing the code further by doing find-replaces on the code. That is hardcore.

  • userbinator 12 years ago

    I still see a lot of redundancy there (e.g. "class", "Math", "font"). Maybe a real LZ packer could shrink it even more...

rwinn 12 years ago

My original submission is here: https://news.ycombinator.com/item?id=7406605

Got nuked for some reason by HN's algorithm dropping it from nr 4 to the second page :(

  • agf 12 years ago

    More comments than votes?

    • rwinn 12 years ago

      Something like that. I think it had more comments than votes all the way up, it was when it hit 40 comments it got dropped.

      Crappy algo, I would think that lots of comments indicates that people find it interesting... Next time I won't reply to peoples comments :/

evan_ 12 years ago

I wrote a <1k version of Threes, a similar game, for js1k:

http://js1k.com/2014-dragons/demo/1667

  • necubi 12 years ago

    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/....

    • evan_ 12 years ago

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

shocks 12 years ago

Good, but it's not the same game. Any move places a two. The original places a two or a four, and only if you can make a combo during that move.

Good code though! :)

jasonlotito 12 years ago

So, it places another block even if you don't move blocks, which vastly simplifies the game.

  • nullc 12 years ago

    I noticed this too... it means you don't have to risk getting pieces on the wrong side of your pile just to keep moving things along.