Home

Awesome

fiar

Four in a Row - A game to learn Erlang

Contact Us

If you find any bugs or have a problem while using this library, please open an issue in this repo (or a pull request :)).

And you can check all of our open-source projects at inaka.github.io

The Game

Connect Four is a two-player connection game in which the players first choose a color and then take turns dropping colored discs from the top into a seven-column, seven-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The object of the game is to connect four of one's own discs of the same color next to each other vertically, horizontally, or diagonally before your opponent.

http://en.wikipedia.org/wiki/Connect_Four

Purpose

This is a project oriented to learning the erlang language, in fiar you will find topics such as:

Stages of the project

For a procedural learning, fiar is divided into small and separate issues, grouped by iterations.

How to use

Basic usage:

fiar:start().
ok

Match = fiar:start_match().
<0.163.0>

fiar:play(Match, Col).
next

play is called to make a move, and it is expected to return the atom won when the player won, drawn when de board is full and none won, and next when it is the next player's turn.

Example to vertically won:

fiar:start().
ok

Match = fiar:start_match().
<0.163.0>

fiar:play(Match, 1).
next

fiar:play(Match, 2).
next

fiar:play(Match, 1).
next

fiar:play(Match, 2).
next

fiar:play(Match, 1).
next

fiar:play(Match, 2).
next

fiar:play(Match, 1).
won

Run tests

Every module has its your own test file created with Common Test And you can run the whole suite with:

make devtests

Dependencies

Documentation