Shelem Scorekeeping
v0.1.0Scores Shelem (شلم) card game hands: bids, Mak, Shelem, the 1000-point rule and the 1165 win.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
calculate_shelem_score Calculate Shelem score
Score one completed Shelem hand and return both teams' new totals. Pass the cumulative scores from before the hand, the declaring team, the bid, and how many points were captured (defending_points, declarer_points, or outcome "mak"/"sweep"). The engine applies the doubled sweep award, failed and heavily failed bids, Shelem/sar-shelem (+330/-330/-660), the 1000-point rule for a defending team, and the 1165 winning threshold. All arithmetic is integer and deterministic. Invalid or contradictory input returns an error and no score.
| Parameter | Type | Description |
|---|---|---|
bid * | integer | The winning bid: 100, 105, ..., 165. Expand spoken abbreviations first ("20" is 120). |
team1_score * | integer | Team 1 cumulative score before this hand. May be negative. |
team2_score * | integer | Team 2 cumulative score before this hand. May be negative. |
bid_successful | Optional cross-check. The captured points decide success; if this flag disagrees the hand is rejected. Mak is successful. | |
bidding_team | Team that won the bidding: 1 or 2. Must equal hakem_team when both are given. At least one of the two is required. | |
contract | Omit below 165. Required when bid is 165: "shelem", "sare-shelem" or "normal" (scored differently on failure). | |
declarer_points | Points captured by the declaring team: 0-165, multiple of 5. Must sum to 165 with defending_points when both are given. | |
defending_points | Points captured by the defending team: 0-165, multiple of 5. | |
hakem_team | Team of the Hakem (the declarer): 1 or 2. | |
outcome | "mak": the declarer captured exactly the bid. "sweep": the defenders captured nothing. Use instead of, or consistently with, the point fields. |