← the terminal · instructor

W31 // CAPSTONE: STATE AND SHIPS

APR 21 · Ch 13 Sec 4-6 · DUE: Ships placing correctly

This week's deckPPTX

// RUN OF SHOW (8:45-10:15)
8:45

Stand-up: last week's deliverable graded, questions answered

9:00

This week's presentation

9:20

At the keyboard: guided type-along

9:45

Build time: assignment or project work

10:10

Close: commit, push, and preview next week's reading

// THE POINT THIS WEEK
Centralized state object. Render vs logic. Utility functions. Ship placement.
// TALKING POINTS
State holds the fleet
  • Ships live in the state object, not on the screen
  • Placement writes coordinates into state; render paints from it
  • Validate placement: in bounds, no overlaps, or reject it
Debugging by inspection
  • console.log(state) after every action; the truth is in the object
  • If the screen looks wrong but state is right, the bug is in render
  • If state is wrong, the bug is in logic; halve the search first
// LINKS