From c8777afe7e23f3b74fe2c5f83b02e269edfcdd83 Mon Sep 17 00:00:00 2001 From: Andrew Zwicky Date: Wed, 10 Jan 2024 23:21:13 -0600 Subject: [PATCH] Remove Pass that was causing infinite loops when auto actions were set outside of an auction --- lib/engine/step/programmer_auction_bid.rb | 2 +- .../programmed_actions_infinite_loop.json | 134 ++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 public/fixtures/18EU/programmed_actions_infinite_loop.json diff --git a/lib/engine/step/programmer_auction_bid.rb b/lib/engine/step/programmer_auction_bid.rb index bd249c9fe1..209223f19a 100644 --- a/lib/engine/step/programmer_auction_bid.rb +++ b/lib/engine/step/programmer_auction_bid.rb @@ -53,7 +53,7 @@ def activate_program_auction_bid(entity, program) reason: "Price for #{target.name} exceeded maximum bid")] end - [Action::Pass.new(entity)] + [] end def auto_buy?(_entity, program) diff --git a/public/fixtures/18EU/programmed_actions_infinite_loop.json b/public/fixtures/18EU/programmed_actions_infinite_loop.json new file mode 100644 index 0000000000..23740dda9a --- /dev/null +++ b/public/fixtures/18EU/programmed_actions_infinite_loop.json @@ -0,0 +1,134 @@ +{ + "id": 3, + "description": "", + "user": { + "id": 3, + "name": "carl" + }, + "players": [ + { + "id": 2, + "name": "bob" + }, + { + "id": 1, + "name": "alice" + }, + { + "id": 3, + "name": "carl" + } + ], + "min_players": 2, + "max_players": 6, + "title": "18EU", + "settings": { + "seed": 2118254336, + "is_async": true, + "unlisted": false, + "auto_routing": false, + "player_order": null, + "optional_rules": [] + }, + "user_settings": null, + "status": "finished", + "turn": 1, + "round": "Auction Round", + "acting": [ + 2 + ], + "result": { + "1": 350, + "2": 450, + "3": 40 + }, + "actions": [ + { + "type": "bid", + "entity": 2, + "entity_type": "player", + "id": 1, + "user": 3, + "created_at": 1704947354, + "minor": "1", + "price": 100 + }, + { + "type": "pass", + "entity": 1, + "entity_type": "player", + "id": 2, + "user": 3, + "created_at": 1704947356 + }, + { + "type": "bid", + "entity": 3, + "entity_type": "player", + "id": 3, + "created_at": 1704947363, + "minor": "1", + "price": 410 + }, + { + "type": "pass", + "entity": 2, + "entity_type": "player", + "id": 4, + "user": 3, + "created_at": 1704947367 + }, + { + "type": "program_auction_bid", + "entity": 3, + "entity_type": "player", + "id": 5, + "created_at": 1704947375, + "bid_target": "15", + "enable_maximum_bid": false, + "maximum_bid": "100", + "enable_buy_price": true, + "buy_price": "60", + "auto_pass_after": false + }, + { + "type": "bid", + "entity": 1, + "entity_type": "player", + "id": 6, + "user": 3, + "created_at": 1704947389, + "minor": "2", + "price": 100 + }, + { + "type": "pass", + "entity": 2, + "entity_type": "player", + "id": 7, + "user": 3, + "created_at": 1704947367 + }, + { + "type": "bid", + "entity": 3, + "entity_type": "player", + "id": 6, + "user": 3, + "created_at": 1704947389, + "minor": "4", + "price": 0 + }, + { + "type": "end_game", + "entity": 2, + "entity_type": "player", + "id": 8, + "created_at": 1704918333 + } + ], + "loaded": true, + "created_at": 1704901967, + "updated_at": 1704947389, + "finished_at": null +} \ No newline at end of file