
Show HN: ThreesJS – iOS game Threes for the browser - angelaconstance
http://threes.meteor.com/
======
madsushi
This feels just like the real game. I am just missing the predictive/"test"
move that lets you see what would happen without actually moving the tiles.

~~~
silvertab
Agreed. It seems like such a small detail, and yet, playing this web version,
I realize how much I depend on it!

------
Encosia
I think the game mechanics are off slightly, compared to the iOS app.

I had this layout (with some other unrelated tiles):

    
    
      - - - -
      - - - -
      1 - - -
      2 - - -
    

And, pressed down to combine the 1 and 2, but it wouldn't let me until the
column was full of tiles to "push" them together. In the iOS app, swiping down
at that point would have combined the 1 and 2 into a 3 at the bottom-left
position.

I hate to nitpick though. Great job overall.

edit: Strange. I just tried again and can't reproduce that behavior now.

~~~
angelaconstance
Think I know what's happening here! My way of preventing too many keystrokes
in quick succession is pretty hacky—basically, if you keypress <300ms after
your last physical keypress, it doesn't fire an event. More appropriate would
be to only suppress the event if it's <300ms after the last keypress that
actually fired an event (vs all keypresses). Will fix ... :P

(The game mechanics should be identical to the iOS app though, with the
exception of the occasional high-number tiles provided. Also in my todo list
to figure out the algorithm the game uses to generate them, haha.)

------
rileyjshaw
I thought that this was an article about three.js :P

I got this far ([http://imgur.com/MR3lC4U](http://imgur.com/MR3lC4U)) before
realizing I should really get some sleep.

------
evan_
Looks great! I recently wrote a clone of Threes for the JS1k 2014 contest:

[http://js1k.com/2014-dragons/demo/1667](http://js1k.com/2014-dragons/demo/1667)

Such a great game.

------
damon_c
You must have figured out how they score the different numbers. 96 is like 780
points, 192 gets 3500, 384 gets around 6200 points, 768 gets 22000 or so...
Did you find an obvious pattern? I was curious about this but too busy
enjoying the game to think about it.

*edit Someone figured it out here: [http://bitsplitting.org/2014/02/11/threes-scoring/](http://bitsplitting.org/2014/02/11/threes-scoring/)

~~~
prezjordan
Article isn't loading for me, but each (3+) tile can be represented as 3 *
2^k, and it's score is calculated as 3^(k+1)

    
    
        3   -> 3 * 2^0 -> 3^1 -> 3 pts
        6   -> 3 * 2^1 -> 3^2 -> 9 pts
        192 -> 3 * 2^6 -> 3^7 -> 2,187 pts
    

I may have an off-by-one (degree) error though. It helps to be a big math geek
who looks for exponents everywhere.

------
hayksaakian
No touch control makes me sad.

Should call it Threes for PCs.

~~~
angelaconstance
Purposely made it nonfunctional (or mostly nonfunctional) on mobile devices,
to not step on the toes of the original creators—they're coming out with an
Android version soon!

~~~
sgdesign
That's really nice of you. Not many people would think of doing that.

------
nacs
Nicely implemented.

I found it interesting that you used Meteor to build this game -- I initially
thought it was a fully client-side Javascript only canvas-based game. Is there
any reason for using it considering this app doesn't appear to be using any
backend?

------
davepeck
This is excellent!

Out of curiosity, what distribution of "next" tiles is produced?

~~~
angelaconstance
Grabbed the strategy from this article
([http://www.kotaku.com.au/2014/02/tips-for-playing-threes-
the...](http://www.kotaku.com.au/2014/02/tips-for-playing-threes-the-new-
mobile-game-everyones-talking-about/))! Basically there is a deck of 12 cards
(four 1's, four 2's, four 3's) that is shuffled, drawn from, and reshuffled
when the deck is empty. Originally I just had it populate randomly from the
same distribution, but it resulted in a startlingly high frequency of terrible
boards with like 10 red tiles floating around and no blues.

As mentioned in an earlier comment and in the article, the actual iOS game
also inserts higher-number cards (6, 12, 24, ...) into the stack occasionally,
though I haven't added that element to this version yet.

~~~
davepeck
That's a good pointer, thanks. I've been thinking about building a simulator
to help qualify Threes strategies. In more advanced games, higher-number
"next" cards are somewhat critical. When you do add them, I'd love to hear how
you did it!

~~~
panic
I've been doing the same thing!

I believe the higher numbers work like this: every 21 turns, Threes generates
a number from 0-20. After this number of turns elapses, if the highest number
seen is 48 or greater, Threes skips drawing from the normal set of ones, twos,
and threes, and instead generates a "special spawn". The special spawn is a
number between 6 and <highest number seen> / 8 (I believe the distribution is
uniform).

Source: Threes writes a preference plist that allows it to resume games if the
app is killed in the background. The keys to look at are
"PseudoSpawnSpecialIndex" and "PseudoSpawnSpecialList".

------
podperson
Good job.

The simple alert at the end for the score is a bit of a weakness.

I agree about the partial slide movement testing. Perhaps hit the arrow to
test the move and double-tap it to actually make the move.

------
andyhmltn
This is awesome! I'm looking to do something similar and add new features as a
learning project. Any pointers on what you used or is it pure JS?

~~~
jbeja
It used meteor.js

------
kevinflo
Record so far is 7202. I kind of get the feeling that if you get the pattern
down you could go almost infinitely... is that impression correct?

------
ndrake
PuzzleScript version [http://bnhw.co.uk/threes/](http://bnhw.co.uk/threes/)

------
saltylicorice
This is wonderful. Adding the soundtrack was a nice touch.

------
glifchits
Love how it is way faster than the iOS version on my 4S.

~~~
evan_
How are you playing on an iOS device? Bluetooth keyboard?

~~~
glifchits
I was just referring to the native app. I know its apples and oranges.

------
zamalek
Awesome stuff! What's considered a passable score?

------
andrewfelix
Very nice.

Confusing name, I immediately though you were using three.js

------
thecasualgamer
The perfect combo: Intellectual and addicting!

------
Davertron
You got the color of the ones and twos swapped :p

Great job!

~~~
angelaconstance
Ack so embarrassing. Fixed now! ^^

~~~
Davertron
Ha I wasn't too serious about it...that was basically the only nitpick I could
find :)

------
n1ghtmare_
Wow ! This is absolutely awesome !

------
robertchung
Good luck

------
gdiocarez
Open Source? :3

------
dushyant
Nice

