Skip to content

Instantly share code, notes, and snippets.

@nbogie
Last active November 21, 2022 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbogie/43f9818c292651f351441bc4b9affc6f to your computer and use it in GitHub Desktop.
Save nbogie/43f9818c292651f351441bc4b9affc6f to your computer and use it in GitHub Desktop.
type Player = "X" | "O"
type PosState = Player | ""
type BoardState = [
PosState,PosState,PosState,
PosState,PosState,PosState,
PosState,PosState,PosState
]
//type WinState = "draw" | "X won" | "O won" | "not finished"
type WinState = {state: "draw"} | { state: "not finished"} | {state:"won", winner:Player}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment