This file defines the working rules for this repository.
- Main coding task for the course assignment is in src/core/agents/multiAgents.py.
- Keep provided class and function names unchanged to stay compatible with the autograder.
- Do not modify autograder internals unless you are intentionally changing test infrastructure.
- File naming convention: snake_case for all new Python files (e.g. my_module.py, not myModule.py).
- src/core/model: world/state model code.
- src/core/view: graphics/text rendering code.
- src/core/controller: game-loop/control entry code.
- src/core/agents: Pacman and Ghost agent logic.
- src/core/config: project parameters used by the autograder.
- src/app/: interactive CLI launcher, split into focused modules:
- colors.py: ANSI constants and paint helper.
- keys.py: raw keyboard reader and screen clear.
- fs.py: filesystem helpers (layouts, banner, log paths).
- menu.py: interactive TUI menus and setup wizard.
- process.py: subprocess utilities (build command, stop process, append log).
- metrics.py: score/result extraction from stdout and CSV row management.
- batch.py: batch orchestration, live dashboard, and game attempt runner.
- main.py: entry point, invoke with
PYTHONPATH=src python -m app.
- tests/: autograder engine + test data together.
- autograder.py, grading.py, testClasses.py, testParser.py, multiagentTestClasses.py: engine.
- make_pytest.py: pytest bridge.
- q1/ … q5/: .test and .solution files side by side.
- Do not add compatibility wrappers back into src/core/*.py root.
- Use Taskfile as the single source of truth for test execution.
- Run tests through Task targets, not ad hoc command variations.
- Preferred runtime path is uv run when available.
- If uv is not installed, commands must fallback to normal Python execution.
- Current pytest wrapper is score-aware:
- It checks per-question score lines from autograder output.
- A test passes only when earned score equals total score for that question.
Recommended setup:
- Install uv.
- Run uv sync --group dev.
- Run Task targets, for example:
- task graphics:full # run all questions with graphics
- task no-graphics:full # run all questions headless
- task graphics:q2 # run a single question with graphics
If a specific interpreter is needed:
- Set PYTHON_BIN to the interpreter path before running task.
- CI is split per question with separate workflows:
- .github/workflows/q1.yml
- .github/workflows/q2.yml
- .github/workflows/q3.yml
- .github/workflows/q4.yml
- .github/workflows/q5.yml
- All workflows run with Python 3.11 only.
- Dependencies are installed from pyproject.toml via uv sync --group dev.
- CI skip policy:
- Push: start commit message with [skip ci]
- Pull request: start PR title with [skip ci]
- VS Code tasks are bindings to Taskfile targets in .vscode/tasks.json.
- .vscode/tasks.json includes a "Run: Pacman Launcher" task that delegates to task launcher.
- Launch profiles in .vscode/launch.json are available for per-question pytest runs and the launcher.
- The "Launcher" debug profile uses module: app with PYTHONPATH set to the workspace src/ directory.
- Keep task and launch entries aligned with Taskfile target names.
When a new question is introduced (example: q6), apply this checklist:
-
Tests and assets
- Add relevant test case folder under tests/q6.
- Put .test files under tests/q6.
- Put .solution files under tests/q6 (alongside .test files).
- Ensure autograder can run q6 from src/core.
-
Pytest bridge
- Update tests/make_pytest.py:
- Add q6 into parametrized question list.
- Mark as slow only if needed.
- Update tests/make_pytest.py:
-
Taskfile
- Add a new target in Taskfile.yml:
- graphics:q6 (for local/interactive runs)
- Keep uv-first and Python fallback behavior.
- Add a new target in Taskfile.yml:
-
VS Code tasks
- Add Tests: Q6 in .vscode/tasks.json mapped to task graphics:q6.
-
VS Code launch
- Add Pytest: Q6 in .vscode/launch.json with PACMAN_QUESTIONS=q6.
-
CI workflow
- Create .github/workflows/q6.yml.
- Use Python 3.11.
- Install uv.
- Run uv sync --group dev.
- Execute task no-graphics:q6 (CI should run headless targets).
- Keep the same [skip ci] condition pattern as other workflows.
-
Documentation
- Update README.md CI section and task examples to include q6.
- Update this file if process rules change.
-
Validation
- Run local check first:
- task graphics:q6
- Run broader checks if needed:
- task no-graphics:full
- task graphics:full
- Run local check first:
Changes are complete when all of the following are true:
- Task target for the affected question runs correctly.
- CI workflow for that question is valid and consistent with repository rules.
- README and INSTRUCTIONS are updated if behavior changed.
- No JSON/YAML syntax errors in .vscode and .github/workflows files.
- User request on 2026-04-28: redesign Q6 from AI usage reflection into a coding task named Risk-aware Evaluation Function, and add related tests/docs/functions.
- Existing Q6 docs only described a Gradescope reflection; no
tests/q6folder existed. - Existing autograder support already includes
EvalAgentTestintests/multiagentTestClasses.py, which can run a named Pacman agent over multiple games and award partial credit for non-timeouts, average score, and wins. - Q6 mirrors the Q5 structure:
src/core/agents/multiAgents.pycontains the submission-facingriskAwareEvaluationFunction(state)TODO stub; do not provide a ready-made scoring formula there.- Q6 tests should run an existing search agent with
agentArgs: "evalFn=riskAware"rather than using a separate Q6 agent/helper module. - Keep the Q6 abbreviation
riskAware = riskAwareEvaluationFunctioninmultiAgents.py; do not add a separateq6alias.
- Q6 test infrastructure:
tests/q6/CONFIGtests/q6/grade-agent.testtests/q6/grade-agent.solutiontests/CONFIGincludes q6 in autograder order.tests/make_pytest.pyincludes q6 in pytest-driven question coverage.
- Q6 execution entry points:
task graphics:q6(local)- VS Code task
Tests: Q6 - VS Code launch profile
Pytest: Q6 - CI workflow
.github/workflows/q6.yml(executestask no-graphics:q6)