NAME

Game::Marad - a board game for two players

SYNOPSIS

use Game::Marad;
my $game = Game::Marad->new;
$game->move( 1, 1, 0, 0 );    # 1, "ok"
$game->turn;                  # 1
$game->player;                # 1
...

DESCRIPTION

This module is an implementation of Marad (originally devised for a cardboard sheet with coins on it, and then Common LISP). With Curses installed the bin/pmarad script will play the game in a terminal window. Otherwise a client should not be too difficult to implement, study the module and bin/pmarad to work out these details.

METHODS

board

Returns a reference to the game board. Callers should not modify this, only read from it.

is_owner x y

Returns true if the current player owns the piece on the given point, false otherwise.

move_count

Returns the current move count (how far a piece moved will move). This is shared between players for each turn pair.

move srcx srcy dstx dsty

Attempts to move from the source point in the direction of the destination point, if that is legal. Returns a list 0 and an error message when the move fails, and 1 and undef when the move is okay. In this case the game state has been updated; in the prior case no changes have been made.

new

Constructor. Returns a new game in the initial game state.

player

Returns the player 0 or 1 whose turn it is to move.

size

Returns the size of the game board, 9.

score

Returns an array reference containing the current score. Clients again should not modify this, only read from it.

BUGS

None known.

SEE ALSO

gemini://thrig.me/game/marad.gmi - game rules

https://thrig.me/src/marad.git - Common LISP implementation

COPYRIGHT AND LICENSE

Copyright 2022 Jeremy Mates

This program is distributed under the (Revised) BSD License: https://opensource.org/licenses/BSD-3-Clause