What the “tiles problem” usually means
“The tiles problem” is not a single, named problem in AI textbooks. The phrase most often points to one of two ideas:
- The sliding tile puzzle, a small puzzle that AI courses use to teach search.
- Tile coding, a reinforcement learning method that splits a continuous space into overlapping tiles.
This guide starts with the puzzle, because it is the easier entry point. Tile coding comes later. Covering a plane with tile shapes is a different question altogether. That question is about whether shapes can fill an endless surface under matching rules, and it is explained in what is the tiling problem.
The sliding tile puzzle
The 8-puzzle is played on a 3 by 3 grid. Eight numbered tiles fill eight of the nine squares, leaving one blank. You can slide a tile that sits next to the blank into the blank. The goal is a fixed arrangement, usually the numbers in order with the blank in a corner.
The 15-puzzle works the same way on a 4 by 4 grid, with fifteen numbered tiles.
Why it is a search problem
To treat the puzzle as an AI problem, describe it in four parts:
- State: one arrangement of the tiles and the blank.
- Start state: the arrangement you are given.
- Actions: the legal slides, which depend on where the blank is.
- Goal test: a check that says whether the board matches the goal.
A solver’s job is to find a sequence of slides that turns the start state into a goal state. Each slide usually counts as one move.
The search space grows fast. The 8-puzzle has about 181,440 reachable arrangements, which is half of 9!. The 15-puzzle has roughly ten trillion, which is half of 16!. Going from a 3 by 3 board to a 4 by 4 board multiplies the number of arrangements by tens of millions. That jump is why the puzzle is useful for teaching.
Not every arrangement can be solved
Half of all arrangements can never reach the goal. For example, if you swap two numbered tiles on a solved board, the puzzle can no longer be solved. A learner can check solvability before searching. For boards with an odd width, such as 3 by 3, count the inversions: pairs of numbered tiles that appear in the wrong relative order when you read the board row by row, ignoring the blank. If that count is even, the puzzle is solvable. If it is odd, it is not.
Searching for a solution
Breadth-first search and its limits
The simplest method is breadth-first search. It tries every move from the start, then every move from those positions, one layer at a time. It always finds a shortest solution. The cost is memory. It must remember every state it has seen, and that number grows quickly with depth. The 8-puzzle is small enough for this approach. The 15-puzzle is not.
Heuristics: misplaced tiles and Manhattan distance
A heuristic is an estimate of how many moves remain. Two common ones for the sliding puzzle are:
- Misplaced tiles: count the numbered tiles that are not in their goal positions.
- Manhattan distance: for each tile, count the horizontal and vertical steps from its position to its goal position, then add those counts together.
Both are admissible, which means they never overestimate the true number of moves. Each misplaced tile needs at least one move. Each slide moves one tile by one square, so the total distance is a lower bound on the moves required. Manhattan distance is never smaller than the misplaced-tile count, and in practice it guides search much better. The general idea of using estimates to steer search is covered in types of heuristic search in artificial intelligence.
A* with an admissible heuristic
A* search ranks each state by the moves already made plus the heuristic estimate of the moves left. If the heuristic is admissible, A* finds a shortest solution. On the 8-puzzle it explores far fewer states than breadth-first search does. Solutions to random 8-puzzle starts often take around 20 moves or more, so the search depth is real.
A puzzle has one player and no opponent. When another agent is trying to beat you, the search changes, and the methods are different. See adversarial search in artificial intelligence examples for that case.
Tile coding in reinforcement learning
Why a table fails for continuous states
In reinforcement learning, an agent learns how good each situation is, which is called its value. In a small grid world, you can store one value per cell. Many real tasks use continuous measurements such as position and velocity. There are endlessly many possible states, so a table is not enough. The agent has to generalize from the states it has visited to states it has not.
How tilings work
Tile coding handles this in a few steps:
- Split each input dimension into intervals. This forms a grid of tiles.
- Make several copies of the grid, called tilings, and shift each copy by a small offset.
- For any state, exactly one tile per tiling is active.
- The estimated value is the sum of the learned weights of the active tiles.
- After each experience, adjust those weights a little toward what actually happened.
The offsets matter. Nearby states share most of their active tiles, so an experience in one place helps its neighbors. Because the tilings are offset, the value estimate does not have one sharp grid edge.
Tile coding is also called CMAC, an older name for the same idea. It is a linear method: the features are fixed in advance, and only the weights are learned. Neural networks, in contrast, learn their features as they train.
Trade-offs in tile width and number of tilings
Wide tiles learn faster and generalize more, but they blur differences between states. Narrow tiles separate states more clearly, but each tile sees less data, so learning is slower and noisier. More tilings give smoother estimates, at the cost of more weights to store and update. Practitioners often scale the step size down by the number of tilings. No setting is best for every task. The right choice depends on the problem and on how much experience the agent gets. Mountain Car, a simple control problem with position and velocity as inputs, is a common test case for tile coding.
Key takeaways
- “The tiles problem” usually means the sliding tile puzzle or tile coding, so check which one a source means.
- In the sliding puzzle, the key ideas are the state space, solvability, admissible heuristics, and A* search.
- In tile coding, the key ideas are overlapping tilings, fixed features, and learned weights.
- Both show a broader lesson in AI: how you represent a problem often matters as much as the algorithm that runs on it.