Changeset 6954 for lang/perl/Games-Go
- Timestamp:
- 02/20/08 02:34:40 (5 years ago)
- Location:
- lang/perl/Games-Go/trunk
- Files:
-
- 1 added
- 3 modified
-
bin/demo_play.pl (modified) (2 diffs)
-
bin/start_go.pl (modified) (4 diffs)
-
lib/Games/Go/Play.pm (modified) (2 diffs)
-
t/01.hit.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Games-Go/trunk/bin/demo_play.pl
r3798 r6954 3 3 use strict; 4 4 use warnings; 5 use FindBin; 6 use lib "$FindBin::Bin/../lib"; 5 7 use Games::Go::Play; 6 8 … … 9 11 $go->hit([3,3]); 10 12 $go->hit([3,4]); 11 $go->show;13 print $go->show; 12 14 13 15 exit; -
lang/perl/Games-Go/trunk/bin/start_go.pl
r6892 r6954 32 32 return; 33 33 } 34 $go->show;34 print $go->show; 35 35 my $play = run_loop( $go, $term ); 36 36 … … 40 40 if ( $in =~ m!^\s*(\d{1,2})\s*\,\s*(\d{1,2})\s*$! ) { 41 41 if ( $go->hit( [ $1, $2 ] ) ) { 42 $go->show;42 print $go->show; 43 43 } 44 44 else { … … 57 57 print "3,4"; # dummy 58 58 $go->hit( [ 3, 4 ] ); # dummy 59 $go->show;59 print $go->show; 60 60 } 61 61 elsif ( $in eq 'p' ) { … … 68 68 } 69 69 elsif ( $in eq 'g' ) { 70 $go->show;70 print $go->show; 71 71 } 72 72 elsif ( $in eq 'quit' ) { -
lang/perl/Games-Go/trunk/lib/Games/Go/Play.pm
r6892 r6954 64 64 sub show { 65 65 my ($self) = @_; 66 my $board = " "; 66 67 my $symbol = { 67 68 $BLACK => ' *', … … 70 71 $OUT => ' ', 71 72 }; 72 print " ";73 # print " "; 73 74 for ( my $x = 1 ; $x <= $self->{'size'} ; $x++ ) { 74 printf( "% 2s", $x ); 75 } 76 print "\n"; 75 # printf( "% 2s", $x ); 76 $board .= sprintf( "% 2s", $x ); 77 } 78 # print "\n"; 79 $board .= "\n"; 77 80 my $i = 0; 78 81 foreach my $x ( @{ $self->{'board'} } ) { 79 printf( "% 2s", $i ) if ($i); 82 # printf( "% 2s", $i ) if ($i); 83 $board .= sprintf( "% 2s", $i ) if ($i); 80 84 foreach ( @{$x} ) { 81 print $symbol->{$_}; 85 # print $symbol->{$_}; 86 $board .= $symbol->{$_}; 82 87 } 83 print "\n"; 88 # print "\n"; 89 $board .= "\n"; 84 90 $i++; 85 91 } 92 return $board; 86 93 } 87 94
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)