Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8bc9c1e3e8
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (27 sloc) 1.06 kb
use v6;
use Druid::Game;
use Druid::Game::Observer;
=begin SUMMARY
Represents a generic Druid player. A player belongs to a certain game, has
a piece color in that game, and is responsible for choosing legal moves
and making them.
class Druid::Player is Druid::Base does Druid::Game::Observer {
=attr The game this C<Druid::Player> is playing.
has Druid::Game $!game handles <size layers colors heights make-move>;
=attr The color of this C<Druid::Player>'s pieces.
has Int $.color where { $_ == 1|2 };
# RAKUDO: This could be done with BUILD instead, as soon as BUILD can
# access private attributes. [perl #64388]
method new(Druid::Game :$game!, Int :$color! where { $_ == 1|2 }) {
my $player = self.bless( self.CREATE(), :game($game), :color($color) );
return $player;
method choose-move() { ... }
method swap() {
$!color = $!color == 1 ?? 2 !! 1;
method Str() { return <Vertical Horizontal>[$!color-1] }
# vim: filetype=perl6
Jump to Line
Something went wrong with that request. Please try again.