MODULE Main; IMPORT Board; IMPORT Trestle; IMPORT TrestleComm; IMPORT Point; IMPORT Fmt, IO; <* FATAL TrestleComm.Failure *> PROCEDURE Quit(b : Board.T) = BEGIN Trestle.Delete(b) END Quit; PROCEDURE Click(b : Board.T; p : Point.T) = BEGIN IO.Put("Got click at (" & Fmt.Int(p.h) & "," & Fmt.Int(p.v) & ")\n"); b.setState(p, VAL( (ORD(b.getState(p)) + 1) MOD NUMBER(Board.Piece), Board.Piece) ) END Click; VAR (* initialize the board *) board := NEW(Board.T, click := Click, quit := Quit).init(); BEGIN (* tell the graphics subsystem that a board is there... *) Trestle.Install(board); (* add a piece to the board.. *) board.setState(Point.T {3,3}, Board.Piece.Black); (* wait for the board to be deleted *) Trestle.AwaitDelete(board); END Main.