Project

bridge

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Useful contract bridge utilities - deal generator, id to deal and deal to id conversion
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 1.3
>= 0
 Project Readme

bridge

Contract bridge utils.

Bid

Card

Deal

Trick

Score

You can create Score object passing 3 arguments:

Bridge::Score.new("6NTXN", "BOTH", "=")

Arguments:

  • contract -- String, where first sign is level, second suit (C D H S NT), optional double or redouble (X or XX) and declarer at the end
  • vulnerable -- String, ["NONE", "EW", "NS", "BOTH"]
  • 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#result_string -- String, relative to contract level i.e "+1", "=", "-3"
  • 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="]

Points

Chicago

You can calculate how many IMP points you won by:

Bridge::Points::Chicago.new(:hcp => 25, :points => 420, :vulnerable => false).imps

Arguments:

  • :hcp -- Integer (range between 20 and 40), which means how many honour card points has side
  • :vulnerable -- Boolean, side with given hcp is vulnerable?
  • :points -- Integer, the result at the end of board (can be calculated by Bridge::Score)

Copyright

Copyright (c) 2010 Jakub Kuźma. See LICENSE for details.