Skip to content

belfastelixir/xyozys_gen_statem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xy Ozys

Aka. Tic-Tac-Toe, Noughts and Crosses etc.

Description

A solution of the code kata challenge hosted by April Meetup of the Belfast FP group.

This solution is written in Elixir and was written by @evadne and using pre-computed state using 'gen_statem'.

Challenge

Implement a library which enables playing games of Xy Ozys.

Rules

  • Expose similar API to that defined in the Spec, however you may diverge for lang idiom reasons.
  • Implement using functional programming.
  • Write tests for the public API.

Spec

Functions

Start a new game:

new() # => Game

Player makes a move:

turn(Game, Cell, Player) # => Ok(Game) | Error(Reason)

Query the game state:

status(Game) # => Status

Types

Game    # Reference to the game
Cell    # Reference to a position within the game board
Player  # 'X' or 'O'
Status  # "Tie", "X Wins", "O Wins", "X's Turn", "O's Turn"
Reason  # Reason that `turn` operation was invalid e.g. "Game over", "Not X's turn" etc.

About

tic-tac-toe with gen_statem (in Elixir)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%