I have a series of tile layouts stored in a list, eg:
That's just an example but I have about 30 or so. Think of them as a bunch of rubber stamps. I bombard an empty grid with these 'stamps' and after I place each one, I check that no lines of 3 have been made - if they have I remove them as I don't want any matches to already be made at the start.
Building the grid this way ensures that there are plenty of moves available to the player at the start of the game.
After so many attempts at stamping down my lil pre-defined patterns, I stop doing it, and fill in any blank squares with random tiles - again, making sure they don't make any lines of three or more.
1. **- 2. *-* 3. *- --* -*- *- -*
That's just an example but I have about 30 or so. Think of them as a bunch of rubber stamps. I bombard an empty grid with these 'stamps' and after I place each one, I check that no lines of 3 have been made - if they have I remove them as I don't want any matches to already be made at the start.
Building the grid this way ensures that there are plenty of moves available to the player at the start of the game.
After so many attempts at stamping down my lil pre-defined patterns, I stop doing it, and fill in any blank squares with random tiles - again, making sure they don't make any lines of three or more.