Spatial Algorithms
What an algorithm is
An algorithm is simply a recipe: a finite list of clear, unambiguous steps that, if followed exactly, solves a problem every time. The word can sound forbidding, but you already use algorithms whenever you follow directions or a cooking method. What makes a list of steps an algorithm, rather than a vague plan, is that each step is precise enough for anyone, or any computer, to carry out in exactly the same way, and that the steps are guaranteed to finish. For spatial problems, the steps act on positions, grids, or networks: find a route across a maze, visit a set of locations, or trace a path through a network. Because the steps are definite, the same algorithm run by different people, or by a machine, produces the same result, which is precisely what makes algorithms trustworthy and worth writing down.
Testing by running it
Writing the steps is only the first half; the second is finding out whether they actually work. You test an algorithm by running it on real examples and watching each step closely. Take a grid-walking rule that says step right whenever the cell to the right is open, otherwise step down, and repeat until you reach the far corner. Running it on an actual grid, cell by cell, shows whether it really arrives, whether it ever gets stuck, and whether it takes a sensible route. Testing on more than one example matters, because a rule that works on an easy grid may fail when an obstacle blocks the way. Digital tools help here: a computer can run the algorithm on many grids in moments and reveal cases a single hand-trace would miss. Testing turns a hopeful design into evidence about what the algorithm really does.
Refining in a loop
Testing almost always uncovers something to improve, and that leads to the cycle at the core of this topic: design, test, refine, and test again. The first design captures the idea; the tests expose where it breaks, doubles back, or wastes steps; the refinement fixes those faults; and then you test once more to be sure the fix worked and introduced no new problem. A route-finding rule might first ignore obstacles, fail a test where a wall blocks its path, and be refined to try an alternative direction when blocked. Each loop makes the algorithm more correct or more efficient. Good solutions are reached by going round this loop several times, not by hoping the first attempt is perfect, and being willing to refine is what separates a working algorithm from a fragile one.
A simple rule, and why precision matters
Many spatial algorithms are pleasingly simple. To visit a set of points, a nearest-next rule says always move from where you are to the closest point you have not yet visited; it is easy to follow and usually gives a short route, though refining it can sometimes do better. What no algorithm can tolerate is a vague step. An instruction like move roughly towards the goal is not a valid step, because two people could carry it out differently and a computer could not run it at all. Every step must state a clear condition and a definite action, so that following it leaves no room for choice. When a step is found to be ambiguous during testing, refining it means rewriting it precisely, replacing roughly towards with an exact rule about which cell to enter next.
Communicating and justifying the solution
Finally, an algorithm is only finished when you can communicate it clearly and justify that it works. Communicating means writing the steps so another person can follow them without you there, often as a numbered list or a simple flow of decisions. Justifying means giving reasons to trust the algorithm: explaining why it always reaches the goal, why it cannot get stuck, and how the tests support those claims. This is the same standard as proof from earlier in the strand, now applied to a procedure rather than a figure. A good submission therefore presents three things together: the steps themselves, evidence from testing that they work, and a clear argument for why they are correct and reasonably efficient. That combination, a tested design you can explain and defend, is what it means to solve a spatial problem with an algorithm.