Games::Cards::Bridge::Rubber - Object for Bridge (card game) Rubber scoring
Version 0.01
This module provides a class for creating Bridge rubber objects, including the results and scoring and current state of the rubber.
use Games::Cards::Bridge::Rubber; sub show_score { my $rubber = shift; printf "Totals (above/below): We = %d/%d \t They = %d/%d\n", $rubber->we_above, $rubber->we_below, $rubber->they_above, $rubber->they_below; printf " Legs: We = %d \t They = %d\n", $rubber->we_leg, $rubber->they_leg; printf " Vul: We = %d \t They = %d\n", $rubber->we_vul, $rubber->they_vul; printf "==COMPLETE==\n\tWe: %d\tThey: %d\n", $rubber->we_score, $rubber->they_score if $rubber->complete; } my $rubber = Games::Cards::Bridge::Rubber->new; show_score($rubber); foreach my $opts ( { direction => 'we', trump => 'H', bid => '2', made => '4' }, { direction => 'they', trump => 'S', bid => '4', down => '2', dbl => 1 }, { direction => 'they', trump => 'N', bid => '3', made => '4' }, { direction => 'they', trump => 'S', bid => '3', made => '3' }, { direction => 'they', trump => 'D', bid => '2', down => '2' }, { direction => 'we', trump => 'H', bid => '6', made => '7', dbl => 1 }, { direction => 'they', trump => 'N', bid => '1', made => '2' }, { direction => 'we', trump => 'C', bid => '3', made => '3' }, { direction => 'they', trump => 'H', bid => '3', made => '3' }, ){ $rubber->contract( %$opts ); show_score($rubber); }
No parameters needed.
Add a contract to the rubber. This needs the same arguments as Games::Cards::Bridge::Contract's constructor, as well as a direction parameter of 'we' or 'they' (and the declarer parameter is not used). This method is also responsible for internally updating the attributes. See also http://www.acbl.org/learn/scoreRubber.html
Gives the current total 'We' score.
Gives the current total 'They' score.
Alias to returns true iff ->we_vul() and ->they_vul().
These are all auto-calculated/maintained; their current values are available from the accessor method provided by Class::Accessor.
Array ref holding all the contracts added by the contract() method.
Current above-the-line score for 'We'.
Current below-the-line score for 'We'.
The current "leg" for 'We'.
The current "leg" for 'They'.
Current above-the-line score for 'They'.
Current below-the-line score for 'They'.
Returns true if the 'We' side is vulnerable (has one "game").
Returns true if the 'They' side is vulnerable (has one "game").
Returns true if the rubber has concluded (one side got two "games").
Class::Accessor
Carp
Games::Cards::Bridge::Contract
Handle honors bonuses
David Westbrook, <dwestbrook at gmail.com>
<dwestbrook at gmail.com>
See Games::Cards::Bridge::Contract
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.
To install Games::Cards::Bridge::Contract, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Cards::Bridge::Contract
CPAN shell
perl -MCPAN -e shell install Games::Cards::Bridge::Contract
For more information on module installation, please visit the detailed CPAN module installation guide.