/mnk-idris

m,n,k-game engine (and variations) implemented in Idris

Primary LanguageIdrisGNU General Public License v3.0GPL-3.0

mnk-idris

This is a small personal project to learn the dependently-typed language Idris while going through the book Type-Driven Development with Idris. It's a work in progress, so expect breaking changes.

This project implements a CLI m,n,k-game. Several variations can be selected when starting a new game: Misère, Connect Four input, Wild (Tic Tac Toe), and Order&Chaos.

For example, if you want to play an 8,5,4 game with Misère, Connect Four, Wild, and Order&Chaos all turned on, enter your terminal:

cd mnk-idris
idris MNKGame.idr
*MNKGame> :exec main
Welcome to MNK!
Enter m,n,k values and any extra game modes: 8 5 4 mis cf wild oc
Rules: Misere Wild ConnectFour Order&Chaos
     0   1   2   3   4   5   6   7
 0 |   |   |   |   |   |   |   |   |  0
 1 |   |   |   |   |   |   |   |   |  1
 2 |   |   |   |   |   |   |   |   |  2
 3 |   |   |   |   |   |   |   |   |  3
 4 |   |   |   |   |   |   |   |   |  4
     0   1   2   3   4   5   6   7

Order's turn
X-coordinate Piece: 3 X

After a while...

Order's turn
X-coordinate Piece: 6 X
     0   1   2   3   4   5   6   7
 0 |   |   |   |   |   |   |   |   |  0
 1 |   |   |   |   |   |   | X |   |  1
 2 |   |   |   |   |   | X | O |   |  2
 3 |   | X |   |   | X | O | X |   |  3
 4 |   | X | O | X | O | O | O |   |  4
     0   1   2   3   4   5   6   7

Winner: Chaos
Loser:  Order