Skip to content

Build Tic Tac Toe from a blank canvas

This is the first complete Hara program in the documentation.

You will begin with an empty browser canvas and build the game in six small parts. Along the way, ordinary Hara values become drawing commands, game rules, current state, pointer input, and a live render loop.

The runnable panels use a real browser-hosted Hara kernel and canvas. The examples are not screenshots, pseudocode, an iframe, or a reduced teaching runtime.

By the end, the program will have:

  • a board described as visible command data;
  • a small multi-file project shape;
  • immutable game values and legal-move rules;
  • an atom for the current game;
  • pointer events translated into possible moves;
  • rendering functions that return canvas commands;
  • a live frame loop with reset and touch input.

The important progression is:

data → rules → state → input → rendering → running program

Each part introduces one new boundary without replacing the model used in the previous part.

01 · DRAW

Turn ordinary values into visible output.

02–04 · DESCRIBE

Keep the game understandable as it grows.

05–06 · RUN

Connect the program to the browser and play it.

Follow the parts in order for the full construction. Each page also includes a focused practical, so you can pause and change the program before moving on.

Once the game is running, the same language can move into a larger browser project, local CLI project, editor-connected session, native host, or JVM application.

Continue with Choose your Hara setup to decide where your own project should live, or take the Hara language course to go deeper into streams, coroutines, bytes, and I/O.