NAME
Games::Cards::Bridge::Chicago - Object for Bridge (card game) Chicago scoring
VERSION
Version 0.01
SYNOPSIS
This module provides a class for creating Bridge objects for a Chicago game (aka 'Four-Deal Bridge'), including the results and scoring and current state of the game.
use Games::Cards::Bridge::Chicago;
sub show_score {
my $chi = shift;
printf "NS = %d \t EW = %d\n", $chi->NS_score, $chi->EW_score;
printf " Vul: NS = %d \t EW = %d\n", $chi->NS_vul, $chi->EW_vul;
printf "==COMPLETE==\n" if $chi->complete;
}
my $chi = Games::Cards::Bridge::Chicago->new;
show_score($chi);
foreach my $opts (
{ declarer => 'N', trump => 'H', bid => '4', made => '4' },
{ declarer => 'S', trump => 'C', bid => '3', down => '2', dbl => 1 },
{ declarer => 'E', trump => 'N', bid => '3', made => '3' },
{ declarer => 'W', trump => 'D', bid => '5', down => '3' },
){
$chi->contract( %$opts );
show_score($chi);
}
METHODS
new
No parameters needed.
contract
Add a contract to the game. This needs the same arguments as Games::Cards::Bridge::Contract's constructor. This method is also responsible for internally updating the attributes. See also http://www.acbl.org/learn/scoreChicago.html
both_vul
Alias to returns true iff ->we_vul() and ->they_vul().
ATTRIBUTES
These are all auto-calculated/maintained; their current values are available from the accessor method provided by Class::Accessor.
contracts
Array ref holding all the contracts added by the contract() method.
NS_score
Gives the current total North-South score.
they_score
Gives the current total East-West score.
we_vul
Returns true if the North-South side is vulnerable.
they_vul
Returns true if the East-West side is vulnerable.
complete
Returns true if the game has concluded (played 4 hands).
dealer
Returns N E S or W representing the current dealer.
PREREQUISITES
AUTHOR
David Westbrook, <dwestbrook at gmail.com>
BUGS & SUPPORT
See Games::Cards::Bridge::Contract
COPYRIGHT & LICENSE
Copyright 2006 David Westbrook, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.