A cell for every square
transcript
A game map is a grid of scores. Treasure is positive, and a hazard is negative. The player moves right or down. Which route scores the most?
Ten by ten has over forty eight thousand routes. Twenty by twenty has over thirty five billion. But it has only four hundred cells.
A spreadsheet adds the cell above and the cell on the left. It works out each cell once. Every route adds the same cells again. A table works like the sheet, and its cells read the neighbours.
Top row: two, minus three, four. Middle row: one, five, minus two. Bottom row: minus one, three, six. Fill row by row. Each cell takes the higher neighbour. The last cell holds seventeen.
Each cell holds the best total so far. It comes from above or from the left. Only the best is kept. No route is ever listed. One number replaces them all.
Count cells, not routes. A table of four hundred cells replaces thirty five billion routes. The neighbours a cell reads decide the order. Full breakdown in the lecture.