Overview
We will start by writing a draw handler to render a Tic-Tac-Toe board, then add in an event handler.
Warning
Every function you write should have a signature. Lack of signatures makes error messages very hard to understand.Basic Definitions
We will use the definitions below.
type Posn = (Int, Int)
type Player = Int
type Piece = (Player, Posn)
type Board = [Piece]
Danger: using (Double, Double)
for Posn
makes the draw handler
easier but the event handler harder.
The coordinates (0,0) will represent the lower left square on the tic-tac-toe board, and (0,1) will be the middle left square.
Timing
If this is not your first project in CodeWorld, it should take about a week.
Class days usage:
- Learn how to draw images in CodeWorld.
- Write the draw handler.
- Write the mouse handler.
- GameState and integration, troubleshooting.