Skip to content

Commit

Permalink
Fix Pavlicek playing tricks table.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Apr 8, 2024
1 parent fbcb36d commit ab4eb3f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions redeal/redeal.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def freakness(self):
"""
The hand's `Pavlicek freakness`__.
__ http://www.rpbridge.net/8j17.htm#8
__ http://www.rpbridge.net/8j17.htm#7
"""
return (sum(max(l - 4, 3 - l) for l in map(len, self))
+ {0: 2, 1: 1}.get(min(map(len, self)), 0))
Expand Down Expand Up @@ -511,7 +511,10 @@ def pt(self):
"""
The holding's `Pavlicek playing tricks`__.
__ http://www.rpbridge.net/8j17.htm#3
The following corrections to the table have been made: K and Qx are 0
tricks (not 0.5); Kxx is 0.5 tricks (not 1).
__ http://www.rpbridge.net/8j17.htm#4
"""
len_pt = max(len(self) - 3, 0)
if {A, K, Q} <= self:
Expand All @@ -526,7 +529,7 @@ def pt(self):
return 1.5 + len_pt
if {A} <= self or {K, Q} <= self or {K, J} <= self:
return 1 + len_pt
if {K, T} <= self or {Q, J} <= self and len(self) >= 3:
if {Q, J} <= self and len(self) >= 3:
return 1 + len_pt
if ({K} <= self and len(self) >= 2 or
({Q} <= self or {J, T} in self) and len(self) >= 3):
Expand Down

0 comments on commit ab4eb3f

Please sign in to comment.