Teaching article

Two correct routes can be compared by different criteria

Evaluate different valid solutions against a stated criterion.

One route may use fewer forward moves while another uses fewer turns. Check that both solve the task first, then apply the same stated cost rule rather than assuming shortest means best in every context.

Two paths can succeed while using different numbers of turns.

Decide what the comparison counts

Apply the same cost rule to both solutions. Counting moves for one route and all commands for another would produce an inconsistent comparison.

Check both reach the goal. Count defined actions. Compare constraints.

Which criterion decides here? Compare prepared traces.

Shorter is only better when that criterion matters.

Resources

Further reading

Read next

Explore Coding and computational thinking. Browse all teaching articles.