2 Search fundamentals
This chapter covers
- The intuition of planning and searching
- Identifying problems suited to be solved using search algorithms
- Representing problem spaces in a way suitable to be processed by search algorithms
- Understanding and designing fundamental search algorithms to solve problems
What are planning and searching?
When we think about what makes us intelligent, the ability to plan before carrying out actions is a prominent attribute. Before going on a trip to a different country, before starting a new project, before writing functions in code, planning happens. Planning happens at different levels of detail in different contexts to strive for the best possible outcome when carrying out the tasks involved in accomplishing goals (figure 2.1).
Figure 2.1 Example of how plans change in projects

Plans rarely work out perfectly in the way we envision at the start. We live in a world where things are constantly changing, so it is impossible to account for all the variables and unknowns along the way. Regardless of the plan we started with, we almost always deviate. We need to (again) make a new plan from our current point going forward as unexpected events occur that require another iteration of planning to meet the goals. As a result, the final plan that is carried out is usually quite different from the original one.