Adding randomness: shuffling the tiles

Now we managed to have a numeric representation of the tiles, but it's very easy to guess the content of each tile. We already know 0th and 1st tile values are 0, 2nd and 3rd are equal to 1, and so on.

We have to add randomness to the game by shuffling the tiles. Randomness is very important in games. Except for some genres such as adventures and puzzles that require the player to retry the same identical level until he solves a specific problem, randomness adds variety to games that would instead offer the same, boring, challenge. Just think about a card solitaire in which you know where each card is. Or a minesweeper game where you know the position of each mine. That's why the generation of random scenarios ...

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.