Mikhael Goikhman > Games-Affenspiel-0.1.0 > Games::Affenspiel

Download:
Games-Affenspiel-0.1.0.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1.0   Source  

NAME ^

Games::Affenspiel - Play the Affenspiel game

SYNOPSIS ^

    # automatical random play script
    use Games::Affenspiel::Board;

    my $board = Games::Affenspiel::Board->new;
    $board->show;

    for (1 .. 5000) {
        sleep(1);
        my ($bar, $gap_position, $direction) = $board->choose_random_move;
        print "Move bar $bar in direction $direction to $gap_position\n";
        $board->show;
    }

ABSTRACT ^

Games::Affenspiel is a set of Perl classes implementing the Affenspiel game play.

DESCRIPTION ^

This package is intended to provide a basis for interactive (not yet) and automatic playing and manipulating of Affenspiel games.

Current built-in board configurations:

    0) 4x5; one 2x2, four 1x1, four 1x2, one 2x1 bars, two gaps
    1) 4x5; one 2x2 bar, 16 gaps (just a test board)
    2) 4x5; one 2x2, four 1x1, two 1x2, three 2x1 bars, two gaps

Currently installed scripts (run with --help):

    * affenspiel-random-moves
    * affenspiel-random-solve
    * affenspiel-solve

The Rules of Affenspiel ^

Board

The regular Affenspiel board is comprised of 20 cells, 4 rows (numbered 1 to 4) of 5 columns (numbered 1 to 5). The cell position is written in (y, x) notation.

The original board has two gaps and following bars: one 2x2, four 1x1, four 1x2, one 2x1. The position of the left-top corner of the bar is taken as the position of the bar.

Initial board

In the initial state, the 2x2 square bar is in position (1, 2),

    +----+
    |A/\A|
    |V[]V|
    | <> |
    |AOOA|
    |VOOV|
    +----+

The goal

In the final (solved) state, the 2x2 square bar is in position (4, 2)), Here is an example final board (there are many solutions):

    +----+
    |AOAA|
    |VAVV|
    |OV<>|
    | /\O|
    | []O|
    +----+

Moves

Each piece may be moved to left/right/up/down inside the board if there are enough gap(s) in that direction. No bar rotation is allowed.

CLASSES ^

    Games::Affenspiel
    Games::Affenspiel::Board

SEE ALSO ^

http://www.artsoft.org/affenspiel/

http://migo.sixbit.org/software/paffenspiel/

AUTHOR ^

Mikhael Goikhman <migo@homamail.com>

syntax highlighting: