Overview

We will start by writing a draw handler to render a Tic-Tac-Toe board, then add in an event handler.

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:

  1. Learn how to draw images in CodeWorld.
  2. Write the draw handler.
  3. Write the mouse handler.
  4. GameState and integration, troubleshooting.
Last modified August 18, 2023: 2022-2023 End State (7352e87)