Sha256: d194028b4a176a422d360117436286ac410b3c3593b12510fb334c16858c8a4f

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 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+4v", "2C/DX+4v", "6H/S="]

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

3 entries across 3 versions & 1 rubygems

Version Path
bridge-0.0.25 README.rdoc
bridge-0.0.24 README.rdoc
bridge-0.0.23 README.rdoc