For Tetris I've done this:
I first focused on getting 1x1 blocks falling, then moved to rotating multi-block shapes, and merged those together to get falling multi-block shapes. And it's in a tutorial form, so that others can follow the same steps to learn TDD.
Angel Java Lopez wrote on 21.1.2013 23:40:
toggle quoted message
Show quoted text
Ummm.. for Tetris, I could write tests (one by one) to:
- Give me an empty "board"
- Put a Piece X at position x,y, get its position
- Put a Piece X at position x,y, run a cycle, get its new position
- Put a Piece Y at position x1,y1, Put Piece X at positions ... all
invalids because they are on Y
- Put a Piece Y at position x1,y1, touching floor, put Piece X above, next
cycle, Y and X are in the same position
- etc...
--
Esko Luontola
www.orfjackal.net