6 SOLVING PUZZLES

The uses of graph search algorithms extend beyond searching paths between physical places or virtual links between items. They also apply to a wide range of more abstract problems, such as solving puzzles or devising strategies in games.

Many puzzles can be represented by a set of discrete states that capture the different configurations of the puzzle. Solving the puzzle might then consist of using a sequence of steps to transition from the initial state to some predefined goal state. This could correspond to moving discs on a Tower of Hanoi puzzle, moving people in a river-crossing puzzle, or rearranging tiles in a slider ...

Get Graph Algorithms the Fun Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.