Always forbid bids that add up to the cards in hand
The sum of all bids may never equal the number of cards each player holds in the round; the last bidder has to adjust their bid. This was an optional "not equal" lobby setting and is now a fixed rule of the game engine, so it applies to humans, AI players and training alike. - Remove GameOptions.not_equal, the set_options field, the lobby toggle and the --not-equal training flag - Explain the rule in the lobby and show the blocked bid while bidding - Drop the option from the AI observation encoding - Tests check that no round ends with bids summing to the cards in hand Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,15 +38,14 @@ def play_random_game(num_players: int, seed: int, options: GameOptions | None =
|
||||
@pytest.mark.parametrize("num_players", [3, 4, 5, 6])
|
||||
@pytest.mark.parametrize("seed", range(5))
|
||||
def test_random_games_complete(num_players, seed):
|
||||
options = GameOptions(not_equal=seed % 2 == 0, hidden_bids=seed % 3 == 0)
|
||||
options = GameOptions(hidden_bids=seed % 2 == 0)
|
||||
game = play_random_game(num_players, seed, options)
|
||||
assert game.phase is Phase.FINISHED
|
||||
assert len(game.round_history) == game.total_rounds
|
||||
assert game.scores == list(game.round_history[-1].scores)
|
||||
for result in game.round_history:
|
||||
assert sum(result.tricks) == result.round_number
|
||||
if options.not_equal:
|
||||
assert sum(result.bids) != result.round_number
|
||||
assert sum(result.bids) != result.round_number
|
||||
|
||||
|
||||
def test_invalid_player_count():
|
||||
@@ -94,8 +93,8 @@ def test_wizard_trump_card_lets_dealer_choose():
|
||||
assert game.current_player == 2
|
||||
|
||||
|
||||
def test_not_equal_restricts_last_bidder():
|
||||
game = WizardGame(3, GameOptions(not_equal=True), seed=11, first_dealer=0)
|
||||
def test_sum_of_bids_never_equals_cards_in_hand():
|
||||
game = WizardGame(3, seed=11, first_dealer=0)
|
||||
if game.phase is Phase.TRUMP_SELECTION:
|
||||
game.apply(game.current_player, ChooseTrump(Suit.RED))
|
||||
game.apply(1, Bid(0))
|
||||
@@ -112,8 +111,8 @@ def test_hidden_bids():
|
||||
assert game.observation(2).bids[1] is None
|
||||
assert game.observation(2).has_bid[1] is True
|
||||
game.apply(2, Bid(0))
|
||||
game.apply(0, Bid(0))
|
||||
assert game.observation(2).bids == (0, 1, 0)
|
||||
game.apply(0, Bid(1)) # 0 is not allowed: the bids would add up to the 1 card in hand
|
||||
assert game.observation(2).bids == (1, 1, 0)
|
||||
|
||||
|
||||
def test_last_round_has_no_trump():
|
||||
|
||||
Reference in New Issue
Block a user