Sha256: 3e4d3529f93c4cc661b070330d445be627d4af42da4f1535a34b220492cd33e0
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
= bridge Contract bridge utils. == Bid == Card == Deal == Trick == Score You can create Score object passing 3 arguments: Bridge::Score.new(:contract => "6NTX", :vulnerable => true, :tricks => "=") Arguments: * :contract -- String, where first sign is level, second suit (C D H S NT) and optional double or redouble (X or XX) * :vulnerable -- Boolean, declarer is vulnerable? (default is false) * :tricks -- Integer or String, when Integer is passed it's number of tricks taken by declarer side, String can be relative to contract level i.e. "+1", "-2", "=" Methods: * Score#made? -- Boolean * Score#result -- Integer, relative to contract level i.e. -1 (one down), 1 (overtrick), 0 (contract made) * Score#points -- Integer, calculated full value You can also ask for all possible contracts finished with given points: Bridge::Score.with_points(980) #=> ["1NTX-11-vulnerable", "2C/DX-12-vulnerable", "6H/S-12"] You can use regexp to check if contract with result is valid: Bridge::Score::REGEXP will match i.e. "1NT=", "2SX+1", "6NTXX-2" == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Jakub Kuźma. See LICENSE for details.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bridge-0.0.22 | README.rdoc |
bridge-0.0.21 | README.rdoc |