| 1 | # | ||
| 2 | # Games::Chess:Piece::General | ||
| 3 | # | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | |||
| 7 | |||
| 8 | package Games::Chess::Piece::General; | ||
| 9 | |||
| 10 | use Games::Chess::Piece; | ||
| 11 | |||
| 12 | use vars qw(@ISA); | ||
| 13 | |||
| 14 | @ISA = qw(Games::Chess::Piece); | ||
| 15 | |||
| 16 | |||
| 17 | # | ||
| 18 | # ::new() | ||
| 19 | # | ||
| 20 | |||
| 21 | sub new ($) | ||
| 22 | { | ||
| 23 | my $class = shift; | ||
| 24 | |||
| 25 | my $this = Games::Chess::Piece->new(@_); | ||
| 26 | |||
| 27 | bless($this, $class); | ||
| 28 | |||
| 29 | return $this; | ||
| 30 | } | ||
| 31 | |||
| 32 | |||
| 33 | # | ||
| 34 | # ::can_occupy() | ||
| 35 | # | ||
| 36 | |||
| 37 | sub can_occupy ($$$) | ||
| 38 | { | ||
| 39 | return undef; | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | # | ||
| 44 | # ::can_capture() | ||
| 45 | # | ||
| 46 | # Default implementation of can_capture() calls can_move() since most pieces have | ||
| 47 | # the same rules for captures and moves. Pawns, in particular, will override | ||
| 48 | # can_capture() so that their different capabilities are represented. | ||
| 49 | # | ||
| 50 | |||
| 51 | sub can_capture ($$$) | ||
| 52 | { | ||
| 53 | return can_occupy(@_); | ||
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | # | ||
| 58 | # End of file. | ||
| 59 | # | ||
| 60 |