| Stephen Wong | |
| Dung Nguyen | |
| Rice University |
| Sun’s Tic-Tac-Toe | ||
| What can we learn from this? | ||
| Arrays | ||
| For-loops | ||
| Nested Conditionals | ||
| What aren’t we learning? | ||
| Delineation of concepts from implementation | ||
| Abstraction | ||
| Design | ||
| It’s not really about TicTacToe… | ||
| It’s a vehicle to teach something BIGGER. | ||
| Abstraction | ||
| Design Process | ||
| Fundamental Principles | ||
| Rules of the Game | ||
| Board configurations | ||
| Legal moves | ||
| Next Move Strategies | ||
| Random | ||
| Min-Max | ||
| Etc. | ||
| Player Management | ||
| Turn taking | ||
| Win/lose/draw notification | ||
| Fault handling | ||
| Math/FP: Map(l, S) = {l(x) | x Î S} | ||
| Express our algorithm in terms of mapping, not iteration: |
||
| min(…) à map(l, min-accum) | ||
| max(…) à map(l, max-accum) | ||
| MVC separates model from view | |
| Commands and Visitors isolate rules from behaviors | |
| State pattern models game behavior | |
| Calculating the next move is a Strategy | |
| Abstract functions – lambda’s | ||
| Higher order functions – Mapping | ||
| Declarative programming | ||
| Invariant: Min-Max Principle | ||
| Variant: | ||
| Full depth-first search | ||
| Alpha-beta pruning | ||
| Design Pattern for Games: | |
| http://www.exciton.cs.rice.edu/research/SIGCSE02 | |
| Patterns for Decoupling Data Structures and Algorithms: | |
| http://www.exciton.cs.rice.edu/research/SIGCSE02 | |