Changeset 6881

Show
Ignore:
Timestamp:
02/18/08 23:24:49 (5 years ago)
Author:
junichiro
Message:

lang/perl/Games-Go: To be able to pass.

Location:
lang/perl/Games-Go/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Games-Go/trunk/README

    r3771 r6881  
    11Games-Go-Play version 0.0.1 
    2  
    3 [ REPLACE THIS... 
    4  
    5   The README is used to introduce the module and provide instructions on 
    6   how to install the module, any machine dependencies it may have (for 
    7   example C compilers and installed libraries) and any other information 
    8   that should be understood before the module is installed. 
    9  
    10   A README file is required for CPAN modules since CPAN extracts the 
    11   README file from a module distribution so that people browsing the 
    12   archive can use it get an idea of the modules uses. It is usually a 
    13   good idea to provide version information here so that people can 
    14   decide whether fixes for the module are worth downloading. 
    15 ] 
    16  
    172 
    183INSTALLATION 
  • lang/perl/Games-Go/trunk/bin/start_go.pl

    r6878 r6881  
    6161        } 
    6262        elsif ( $in eq 'p' ) { 
    63  
    64             # [TODO]pass. 
    65             return; 
     63            $go->pass; 
    6664        } 
    6765        elsif ( $in eq 'resign' ) { 
  • lang/perl/Games-Go/trunk/lib/Games/Go/Play.pm

    r6878 r6881  
    1111 
    1212use base qw/Class::Accessor::Fast/; 
    13 __PACKAGE__->mk_accessors(qw(space black white out)); 
     13__PACKAGE__->mk_accessors(qw(space black white out pass)); 
    1414 
    1515our $B_SIZE = 19; 
     
    3434            'ji'      => 0, 
    3535        }, 
     36        'pass'  => 0, 
    3637    }; 
    3738 
     
    9192        return; 
    9293    } 
     94    $self->{'pass'} = 0; 
    9395    $self->{'board'}[ $points->[1] ][ $points->[0] ] = $symbol; 
    9496    $self->{'teban'} = $self->other_side( $self->{'teban'} ); 
     
    111113sub pass { 
    112114    my ($self) = @_; 
     115    $self->{'pass'}++; 
     116    if ($self->{'pass'} >= '2') { 
     117        $self->end; 
     118        return; 
     119    } 
    113120    $self->{'teban'} = $self->other_side( $self->{'teban'} ); 
    114121} 
     
    117124    my ( $self, $symbol ) = @_; 
    118125    return ( $symbol eq $BLACK ) ? $WHITE : $BLACK; 
     126} 
     127 
     128sub end { 
     129    my ($self) = @_; 
     130    print "[TODO] end.\n"; 
    119131} 
    120132 
     
    167179=item show 
    168180Show play field. 
     181=item end 
     182End the game. 
    169183=back 
    170184