Games-Go-AGA-DataObjects
view release on metacpan or search on metacpan
lib/Games/Go/AGA/DataObjects/Game.pm view on Meta::CPAN
use strict;
use warnings;
# the Game class is useful for tournament pairing
package Games::Go::AGA::DataObjects::Game;
use Moo;
use namespace::clean;
use Carp;
use Scalar::Util qw(refaddr weaken);
use Try::Tiny;
use Games::Go::AGA::Parse::Util qw( Rank_to_Rating );
use Games::Go::AGA::DataObjects::Types qw( isa_Int isa_CodeRef isa_Handicap isa_Komi );
our $VERSION = '0.152'; # VERSION
sub isa_Player { die("$_[0] is not a Games::Go::AGA::DataObjects::Player\n") if (ref $_[0] ne 'Games::Go::AGA::DataObjects::Player') }
has black => (
is => 'rw',
isa => \&isa_Player,
weak_ref => 1, # Players have Games, Games have Players, so weaken
trigger => sub
{
my $self = shift;
$self->_set_player('black', @_);
},
);
has white => (
is => 'rw',
isa => \&isa_Player,
weak_ref => 1,
( run in 0.703 second using v1.01-cache-2.11-cpan-65fba6d93b7 )