Connect Four implementation in Scala
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Connect Four in Scala


This was written for practice with Scala.

Build Status Coverage Status


Use sbt to run.

brew install sbt
sbt compile

If you encounter an OutOfMemory exception when compiling, use the following command to run sbt

env SBT_OPTS="-XX:MaxPermSize=256M" sbt


There is a simple console UI you can run using:

sbt run

Spec Running

You can use sbt to run the tests.

sbt test

Specs use the specs scala library available here:

Specs are provided as part of the connect_four.specs package.

You should expect a result that looks like the following:

[info] BoardSpec
[info] A new board should
[info] + have a height of 6, width of 7, and length of 42
[info] + be empy
[info] + have empty spaces
[info] + have appropriate position indices
[info] + test for bounded indices
[info] + convert index objects to array indices
[info] + return a marker when updatePosition called
[info] + return true when move is valid
[info] + return appropriate marker after move
[info] + return appropriate marker after move 2
[info] + should return posIs true when appropriate
[info] + have available moves
[info] + detect when there are no moves remaining
[info] Total for specification BoardSpec
[info] Finished in 501 ms
[info] 13 examples, 30 expectations, 0 failure, 0 error


sbt coverage test coverageReport
# results in target/scala-2.11/scoverage-report/index.html