The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::Go::Cinderblock::Delta - A changeset between 2 states

SYNOPSIS

 my $delta = $state1->delta_to($state2);
 my $current_turn = $delta->turn->{after};

DESCRIPTION

Games::Go::Cinderblock::Delta represents a set of changes between 2 states with the same rulemap. Each change is not necessarily defined; that would imply that that particular change does not occur.

This class has the following basic attributes:

board

Format for changes on the board: {color => {add => [nodes], remove => [nodes]}, ...}

For example, a capture by black: {b => {add => [[0,1]]}, w => {remove => [[0,0]]}}

turn

This change generally tends to occur on every move.

 {before => 'b', after => 'w'}

captures

In the event of a capturing move, the captures value of the capturing side will change.

 {b => {before => 0, after => 1}}

METHODS

to_args

Decompose into arguments that could be used to initialize an identical delta. Rulemap not included.

Useful for JSON serialization.

TODO

time!

If states are given a timestamp, it would be <prudent> to give deltas a representation of the time change.

2 options:

Nested data structure for changes in remaining time for each player. time-system-dependent, but time systems would be a part of rulemap, I imagine. I like this idea.

The number of milliseconds between the 2 states. This is a bad idea because it doesn't account for the twin paradox.