--- This module defines the ;Symbol; type and some helper functions.
module Logic.Symbol;

import Stdlib.Prelude open;

--- A symbol represents a token that can be placed in a square
type Symbol :=
  | --- The circle token
    O : Symbol
  | --- The cross token
    X : Symbol;

--- Equality for ;Symbol;s
==Symbol : Symbol  Symbol  Bool
  | O O := true
  | X X := true
  | _ _ := false;

--- Turns ;O; into ;X; and ;X; into ;O;
switch : Symbol  Symbol
  | O := X
  | X := O;

--- Textual representation of a ;Symbol;
showSymbol : Symbol  String
  | O := "O"
  | X := "X";
Last modified on 2024-07-11 16:35 UTC