Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6cfade4867
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| self.day = int(data["day"]) | ||
| self.player = list(data["player"]) | ||
| self.resources = ResourceState(**data["resources"]) | ||
| self.machines = [Machine(**m) for m in data["machines"]] | ||
| self.genome.features = [FeatureGene(**f) for f in data["features"]] |
There was a problem hiding this comment.
Validate loaded save payload before assigning state
load_game() only handles JSON syntax errors, but it immediately dereferences required keys and constructors (data["day"], ResourceState(**...), etc.) without schema checks. A syntactically valid but malformed save file (missing keys, wrong types, wrong shapes) will raise KeyError/TypeError and crash instead of returning False, which makes the in-game load hotkey fragile for real-world corrupted or migrated saves.
Useful? React with 👍 / 👎.
| elif action == "build_solar" and r.materials >= 8: | ||
| r.materials -= 8 | ||
| self.world[y][x] = "solar" | ||
| self.machines.append(Machine("solar", x, y, "energy", 3, 0)) |
There was a problem hiding this comment.
Prevent stacking multiple machines on one tile
The build branches allow placing a machine regardless of the current tile contents, and each call appends another Machine entry even if one already exists at the same coordinates. This permits repeated builds on the same cell, creating invisible duplicate producers/consumers (world shows one tile, machines contains many), which skews resource generation and breaks simulation consistency.
Useful? React with 👍 / 👎.
No description provided.