Creating the tiles

As said, we won't use a standard card deck, but tiles with basic shapes on them. We can place any number of tiles, as long as it's an even number, because any tile must have its match. So, if you want to play with ten symbols, you must have 20 tiles in game.

That's exactly what we are going to do. We will create twenty tiles, each one represented by a number from 0 to 9. Since there are two tiles for each value, we will have two zeros, two ones, two twos, and so on until two nines.

Now you may wonder: why are we representing ten tiles with numbers from 0 to 9? Wouldn't it be better to use the classic 1-10 range? Obviously representing numbers from 1 to 10 seems more meaningful, but keep in mind when you code you should always ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.