News

MAME Developer Nicola Salmoria Builds ‘Threes!’ Playing Bot

TouchArcade Rating:

While us plebs are busy focusing on doing everything we can to to mash two 768’s together, analytically minded folks on our forums are going hog wild deconstructing the algorithms powering the game of Threes! ($5.99). I’m really not sure I’ve ever seen anything like it, at least not on our forums, but our Threes! thread has almost entirely shifted from discussing game strategies to straight up trying to figure out the inner workings of the game to accurately predict what the next cards the game gives you are going to be.

MAME creator Nicola Salmoria has even joined the party, building a Threes! AI simulator that allowed him to come to the following conclusion:

I would have to check some poor game in detail to see if the program made some obvious mistake, but my first impression is that these results prove that, even playing with a reasonably good strategy, the randomness of the game can frequently force an early defeat (or conversely that, even playing with a not so good strategy, the randomness allows to to achieve decent scores frequently).

Nicola goes on in a later post mentioning the scores his Threes AI was getting:

I made my AI play two real games yesterday, to verify that the simulation was working correctly. The AI scored 21,624 and 31,524, which is in accordance with what I expected. Actually even better, because the game doesn’t yet show when a bonus card is coming next, and that makes a significant difference.

In other words, the Threes! playing AI he built can reliably score higher than most normal people playing the game. The rest of the same post also has some amazing insights, including the fact that the AI does things that a human player would think to be wrong, as it seemingly intentionally defers merging cards until there are a bunch to merge at once. Salmora provides this observation which could be helpful to humans playing Threes!:

If you have many cards ready to merge, it’s as good as having empty spaces, because they don’t block your moves. But you also have more control, because you delay the choice of which cards to merge.

THREES_trailer

Additionally, Threes! wizard kamikaze28 is still hot on the trail of figuring out how card drawing works and he believes he has cracked it. Here’s the conclusions he’s come to (but you really should read the whole post:

Apart from the obvious application of this knowledge, that is to keep track of the cards you draw to infer the current stack and predict future draws, one can draw some rules of thumb:

  • If there are four 1s (or 2s) on the board without their counterpart, you will draw them within the next 8 basic cards.
  • More generally: if the difference between the number of 1s and 2s on the board is 4, the next 4 to 8 draws of basic cards will reduce this difference back to 0.
  • Using the rules from above, you can anticipate the values of bonus cards. This will come in especially handy with the next update when the next card indicator will show a ‘+’ when the next card is a bonus card.

From my point of view, this is a very well designed algorithm. It is simple yet it guarantees the necessary balance of 1s and 2s for the game to work and even if you go the extra mile and count your cards (without error), your ability to reliably predict cards beyond the next one is limited to the latter third of each stack.

In other related news, Threes! co-creator Asher Vollmer also stopped by the thread to mention what they’re working on in their upcoming update: Tweaking upcoming card display, as well as the ability to skip signing your name at the end of every game along with a bunch of bug fixes and anti-score hacking stuff. Sounds awesome.

Let’s just hope the Threes! AI doesn’t become sentient. We’re going to be in real trouble then.

  • Threes!

    Threes is tiny puzzle that grows on you. This is the buy-once-play-forever version. ³ Apple Game of the Year 2014!! ³…
    TA Rating:
    $5.99
    Buy Now