diff --git a/__pycache__/monop_parser.cpython-310.pyc b/__pycache__/monop_parser.cpython-310.pyc index 22960d4..9e0778a 100644 Binary files a/__pycache__/monop_parser.cpython-310.pyc and b/__pycache__/monop_parser.cpython-310.pyc differ diff --git a/monop_parser.py b/monop_parser.py index cabbfde..5bb6701 100644 --- a/monop_parser.py +++ b/monop_parser.py @@ -426,10 +426,11 @@ class MonopParser: if not g.get_player(name=name): p = Player(name, num) g.players.append(p) - # Set current player + # Set current player and record turn order start for i, p in enumerate(g.players): if p.name == name: g.current_player_idx = i + g._first_player_idx = i break g.phase = "playing" g.game_active = True @@ -1223,8 +1224,17 @@ class MonopParser: if "rent" in sq: sq_out["rent"] = sq["rent"] squares.append(sq_out) + # Emit players in turn order (rotated so first player is first) + # The C code doesn't reorder the array, it just sets the starting + # index. Turn order is: first_player, first_player+1, ..., wrapping. + if g.players and hasattr(g, '_first_player_idx'): + fp = g._first_player_idx + ordered = g.players[fp:] + g.players[:fp] + else: + ordered = g.players + return { - "players": [p.to_dict() for p in g.players], + "players": [p.to_dict() for p in ordered], "currentPlayer": g.current_player.number if g.current_player else None, "squares": squares, "log": g.log[-30:], diff --git a/plugins/monop/monop_parser.py b/plugins/monop/monop_parser.py index cabbfde..5bb6701 100644 --- a/plugins/monop/monop_parser.py +++ b/plugins/monop/monop_parser.py @@ -426,10 +426,11 @@ class MonopParser: if not g.get_player(name=name): p = Player(name, num) g.players.append(p) - # Set current player + # Set current player and record turn order start for i, p in enumerate(g.players): if p.name == name: g.current_player_idx = i + g._first_player_idx = i break g.phase = "playing" g.game_active = True @@ -1223,8 +1224,17 @@ class MonopParser: if "rent" in sq: sq_out["rent"] = sq["rent"] squares.append(sq_out) + # Emit players in turn order (rotated so first player is first) + # The C code doesn't reorder the array, it just sets the starting + # index. Turn order is: first_player, first_player+1, ..., wrapping. + if g.players and hasattr(g, '_first_player_idx'): + fp = g._first_player_idx + ordered = g.players[fp:] + g.players[:fp] + else: + ordered = g.players + return { - "players": [p.to_dict() for p in g.players], + "players": [p.to_dict() for p in ordered], "currentPlayer": g.current_player.number if g.current_player else None, "squares": squares, "log": g.log[-30:], diff --git a/site/game-state.json b/site/game-state.json index 1d38170..f7647f1 100644 --- a/site/game-state.json +++ b/site/game-state.json @@ -3,7 +3,7 @@ { "name": "alice", "number": 1, - "money": 1280, + "money": 624, "location": 21, "inJail": false, "jailTurns": 0, @@ -13,8 +13,8 @@ { "name": "bob", "number": 2, - "money": 1305, - "location": 16, + "money": 1229, + "location": 23, "inJail": false, "jailTurns": 0, "doublesCount": 0, @@ -23,12 +23,12 @@ { "name": "charlie", "number": 3, - "money": 1260, - "location": 13, + "money": -12, + "location": 24, "inJail": false, "jailTurns": 0, "doublesCount": 0, - "getOutOfJailFreeCards": 0 + "getOutOfJailFreeCards": 1 } ], "currentPlayer": 3, @@ -42,7 +42,7 @@ "id": 1, "name": "Mediterranean ave. (P)", "type": "property", - "owner": null, + "owner": 2, "mortgaged": false, "group": "purple", "cost": 60, @@ -57,7 +57,7 @@ "id": 3, "name": "Baltic ave. (P)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "purple", "cost": 60, @@ -72,7 +72,7 @@ "id": 5, "name": "Reading RR", "type": "railroad", - "owner": null, + "owner": 2, "mortgaged": false, "group": "railroad", "cost": 200 @@ -106,7 +106,7 @@ "id": 9, "name": "Connecticut ave. (L)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "lightblue", "cost": 120, @@ -121,7 +121,7 @@ "id": 11, "name": "St. Charles pl. (V)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "violet", "cost": 140, @@ -131,7 +131,7 @@ "id": 12, "name": "Electric Co.", "type": "utility", - "owner": null, + "owner": 2, "mortgaged": false, "group": "utility", "cost": 150 @@ -150,7 +150,7 @@ "id": 14, "name": "Virginia ave. (V)", "type": "property", - "owner": null, + "owner": 2, "mortgaged": false, "group": "violet", "cost": 160, @@ -160,7 +160,7 @@ "id": 15, "name": "Pennsylvania RR", "type": "railroad", - "owner": null, + "owner": 1, "mortgaged": false, "group": "railroad", "cost": 200 @@ -184,7 +184,7 @@ "id": 18, "name": "Tennessee ave. (O)", "type": "property", - "owner": null, + "owner": 1, "mortgaged": false, "group": "orange", "cost": 180, @@ -194,7 +194,7 @@ "id": 19, "name": "New York ave. (O)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "orange", "cost": 200, @@ -224,7 +224,7 @@ "id": 23, "name": "Indiana ave. (R)", "type": "property", - "owner": null, + "owner": 1, "mortgaged": false, "group": "red", "cost": 220, @@ -234,7 +234,7 @@ "id": 24, "name": "Illinois ave. (R)", "type": "property", - "owner": null, + "owner": 1, "mortgaged": false, "group": "red", "cost": 240, @@ -244,7 +244,7 @@ "id": 25, "name": "B&O RR", "type": "railroad", - "owner": null, + "owner": 2, "mortgaged": false, "group": "railroad", "cost": 200 @@ -263,7 +263,7 @@ "id": 27, "name": "Ventnor ave. (Y)", "type": "property", - "owner": null, + "owner": 1, "mortgaged": false, "group": "yellow", "cost": 260, @@ -273,7 +273,7 @@ "id": 28, "name": "Water Works", "type": "utility", - "owner": null, + "owner": 2, "mortgaged": false, "group": "utility", "cost": 150 @@ -282,7 +282,7 @@ "id": 29, "name": "Marvin Gardens (Y)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "yellow", "cost": 280, @@ -297,7 +297,7 @@ "id": 31, "name": "Pacific ave. (G)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "green", "cost": 300, @@ -307,7 +307,7 @@ "id": 32, "name": "N. Carolina ave. (G)", "type": "property", - "owner": null, + "owner": 2, "mortgaged": false, "group": "green", "cost": 300, @@ -322,7 +322,7 @@ "id": 34, "name": "Pennsylvania ave. (G)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "green", "cost": 320, @@ -332,7 +332,7 @@ "id": 35, "name": "Short Line RR", "type": "railroad", - "owner": null, + "owner": 1, "mortgaged": false, "group": "railroad", "cost": 200 @@ -346,7 +346,7 @@ "id": 37, "name": "Park place (D)", "type": "property", - "owner": null, + "owner": 1, "mortgaged": false, "group": "darkblue", "cost": 350, @@ -361,7 +361,7 @@ "id": 39, "name": "Boardwalk (D)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "darkblue", "cost": 400, @@ -370,99 +370,150 @@ ], "log": [ { - "text": "roll is 4, 6", + "text": "roll is 6, 5", + "player": "charlie", + "timestamp": "2026-02-21 11:01:40" + }, + { + "text": "Passed GO \u2014 collected $200", + "player": "charlie", + "timestamp": "2026-02-21 11:01:40" + }, + { + "text": "Landed on Income Tax", + "player": "charlie", + "timestamp": "2026-02-21 11:01:41" + }, + { + "text": "alice's turn \u2014 $289 on Just Visiting", "player": "alice", - "timestamp": "2026-02-21 10:55:12" + "timestamp": "2026-02-21 11:01:47" }, { - "text": "Landed on Just Visiting", + "text": "Trade completed between alice and bob", + "player": null + }, + { + "text": "alice's turn \u2014 $484 on Just Visiting", "player": "alice", - "timestamp": "2026-02-21 10:55:13" + "timestamp": "2026-02-21 11:01:58" }, { - "text": "bob's turn \u2014 $1500 on === GO ===", + "text": "roll is 3, 2", + "player": "alice", + "timestamp": "2026-02-21 11:01:59" + }, + { + "text": "Landed on Pennsylvania RR", + "player": "alice", + "timestamp": "2026-02-21 11:01:59" + }, + { + "text": "bob's turn \u2014 $1279 on Electric Co.", "player": "bob", - "timestamp": "2026-02-21 10:55:14" + "timestamp": "2026-02-21 11:02:00" }, { - "text": "roll is 5, 2", + "text": "roll is 1, 5", "player": "bob", - "timestamp": "2026-02-21 10:55:15" + "timestamp": "2026-02-21 11:02:02" }, { - "text": "Landed on Chance i", + "text": "Landed on Tennessee ave. (O)", "player": "bob", - "timestamp": "2026-02-21 10:55:15" + "timestamp": "2026-02-21 11:02:02" }, { - "text": "Pay Poor Tax of $15", + "text": "Paid $14 rent to alice", "player": "bob" }, { - "text": "charlie's turn \u2014 $1500 on === GO ===", + "text": "charlie's turn \u2014 $78 on Income Tax", "player": "charlie", - "timestamp": "2026-02-21 10:55:17" + "timestamp": "2026-02-21 11:02:04" }, { - "text": "roll is 3, 3", + "text": "roll is 6, 5", "player": "charlie", - "timestamp": "2026-02-21 10:55:19" + "timestamp": "2026-02-21 11:02:05" }, { - "text": "Landed on Oriental ave. (L)", + "text": "Landed on Pennsylvania RR", "player": "charlie", - "timestamp": "2026-02-21 10:55:19" + "timestamp": "2026-02-21 11:02:05" }, { - "text": "charlie's turn \u2014 $1400 on Oriental ave. (L)", - "player": "charlie", - "timestamp": "2026-02-21 10:55:22" + "text": "Paid $50 rent to alice", + "player": "charlie" }, { - "text": "roll is 1, 6", - "player": "charlie", - "timestamp": "2026-02-21 10:55:23" - }, - { - "text": "Landed on States ave. (V)", - "player": "charlie", - "timestamp": "2026-02-21 10:55:23" - }, - { - "text": "alice's turn \u2014 $1500 on Just Visiting", + "text": "alice's turn \u2014 $548 on Pennsylvania RR", "player": "alice", - "timestamp": "2026-02-21 10:55:25" + "timestamp": "2026-02-21 11:02:07" }, { - "text": "roll is 5, 6", + "text": "roll is 5, 1", "player": "alice", - "timestamp": "2026-02-21 10:55:26" + "timestamp": "2026-02-21 11:02:08" }, { "text": "Landed on Kentucky ave. (R)", "player": "alice", - "timestamp": "2026-02-21 10:55:27" + "timestamp": "2026-02-21 11:02:09" }, { - "text": "bob's turn \u2014 $1485 on Chance i", + "text": "bob's turn \u2014 $1265 on Tennessee ave. (O)", "player": "bob", - "timestamp": "2026-02-21 10:55:29" + "timestamp": "2026-02-21 11:02:10" }, { - "text": "roll is 3, 6", + "text": "roll is 1, 1", "player": "bob", - "timestamp": "2026-02-21 10:55:30" + "timestamp": "2026-02-21 11:02:11" }, { - "text": "Landed on St. James pl. (O)", + "text": "Landed on Free Parking", "player": "bob", - "timestamp": "2026-02-21 10:55:30" + "timestamp": "2026-02-21 11:02:11" }, { - "text": "charlie's turn \u2014 $1260 on States ave. (V)", + "text": "bob's turn \u2014 $1265 on Free Parking", + "player": "bob", + "timestamp": "2026-02-21 11:02:13" + }, + { + "text": "roll is 1, 2", + "player": "bob", + "timestamp": "2026-02-21 11:02:14" + }, + { + "text": "Landed on Indiana ave. (R)", + "player": "bob", + "timestamp": "2026-02-21 11:02:14" + }, + { + "text": "Paid $36 rent to alice", + "player": "bob" + }, + { + "text": "charlie's turn \u2014 $28 on Pennsylvania RR", "player": "charlie", - "timestamp": "2026-02-21 10:55:32" + "timestamp": "2026-02-21 11:02:16" + }, + { + "text": "roll is 5, 4", + "player": "charlie", + "timestamp": "2026-02-21 11:02:17" + }, + { + "text": "Landed on Illinois ave. (R)", + "player": "charlie", + "timestamp": "2026-02-21 11:02:18" + }, + { + "text": "Paid $40 rent to alice", + "player": "charlie" } ], - "lastUpdated": "2026-02-21T10:55:32.750315+00:00" + "lastUpdated": "2026-02-21T11:02:22.605328+00:00" } \ No newline at end of file