GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GAMES::SEQUENTIAL (3)

.ds Aq ’

NAME

Games::Sequential - sequential games framework with OO interface

CONTENTS

SYNOPSIS



    package My::GamePos;
    use base qw(Games::Sequential::Position);

    sub apply { ... }

    package main;
    use My::GamePos;
    use Games::Sequential;

    my $pos = My::GamePos->new;
    my $game = Games::Sequential->new($pos);

    $game->debug(1);
    $game->move($mv);
    $game->undo;



DESCRIPTION

Games::Sequential is a framework for producing sequential games. Among other things it keeps track of the sequence of moves, and provides an unlimited undo() mechanism. It also has methods to clone() or take a snapshot() of a game.

Users must pass an object representing the initial state of the game as the first argument to new(). This object must provide the two methods copy() and apply(). You can use Games::Sequential::Position as a base class, in which case the copy() method will be provided for you. The apply() method must take a move and apply it to the current position, producing the next position in the game.

METHODS

Users must not modify the referred-to values of references returned by any of the below methods.
new $initialpos [@list] Create and return a new Games::Sequential object. The first argument must be an object representing the initial position of the game. The debug option can also be set here.
_init [@list] Internal method

Initialize a Games::Sequential object.

debug [$value] Return current debug level and, if invoked with an argument, set to new value.
peek_pos Return reference to current position. Use this for drawing the board etc.
peek_move Return reference to last applied move.
move $move Apply $move to the current position, keeping track of history. A reference to the new position is returned, or undef on failure.
undo Undo last move. A reference to the previous position is returned, or undef if there was no more moves to undo.

TODO

Implement the missing methods clone(), snapshot(), save() & resume().

SEE ALSO

The author’s website, describing this and other projects: <http://brautaset.org/software/>

AUTHOR

Stig Brautaset, <stig@brautaset.org>

COPYRIGHT AND LICENCE

Copyright (C) 2004-2005 by Stig Brautaset

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GAMES::SEQUENTIAL (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.