- Single Python package:
src/fish_sim/(installed layout viasetup.py+pyproject.toml). - Real entrypoint:
src/fish_sim/main.py. Rootmain.pyis a thin launcher that mutatessys.pathsopython main.pyworks from repo root. - All tunable constants live in
src/fish_sim/config.py. Prefer updating constants there over adding magic numbers.
- Run the simulation:
python main.py(from repo root) - Run tests:
pytest tests/— tests exist intests/test_core.py(neural net, time system, plant lifecycle, fish traits) - Lint:
ruff check src/(config inpyproject.toml: line-length 100, target py38) - Typecheck:
mypy src/(config inpyproject.toml) - Prefer incremental edits under
src/fish_sim/; do not add executables alongside the package.
- CRITICAL:
_DEV_/is protected — never modify, delete, or commit its contents. .codeviz/,.sourcetrail/,.mypy_cache/,.pytest_cache/are local dev-state — do not commit.*.pdfandproject_review_report.mdin root are review artifacts, not source code.- Run
git add -A && git statusbefore committing to ensure no dev artifacts sneak in.
- NeuralFish (
src/fish_sim/fish/fish_base.py, ~1360 lines). Prefer tracing the update loop infish_system.pyover reading it linearly. - Neural network: 30 inputs → 14 hidden → 8 hidden (recurrent) → 12 outputs. All defined in
config.py(NN_INPUT_COUNT, etc.) and implemented inneural_net.py. - Output layout (from
neural_net.py):[0]steer,[1]thrust,[2]hide_drive,[3]sprint_drive,[4]clean_drive,[5]ambush_drive,[6]dash_drive,[7:12]state softmax. - Stale config.py constants:
OUTPUT_STEERthroughOUTPUT_STATE_START(lines 421-428) define a legacy 9-output layout. The actual code uses hardcoded indices[0:12]. These constants are unused — ignore them. - Stale README:
README.mdclaims 27 inputs / 9 outputs. The real architecture is 30 inputs / 12 outputs (perconfig.pyandneural_net.py). Trustconfig.pyover README. - Time system (
time_system.py): drives seasonal modifiers — metabolism, mating drive, seed dispersal, photosynthesis rate, predator activity. - Cleaner (
cleaner_fish.py) and Predator (predator_fish.py) are subclasses ofNeuralFishthat overrideupdate()for species-specific behaviors. - Simulation flow (
src/fish_sim/main.py):TimeSystem→SoilGrid→ParticleSystem→PlantManager→FishSystem→Camera. Each system receivesdtand (where relevant)time_systemfor seasonal modulation.
.github/instructions/codacy.instructions.mdapplies. After any file edit, if Codacy MCP tooling is available, runcodacy_cli_analyzeagainst the changed file. Do not skip this step.