Skip to content

Lab2 3/design first - #1

Open
TheSumitBasak wants to merge 5 commits into
mainfrom
lab2_3/design-first
Open

Lab2 3/design first#1
TheSumitBasak wants to merge 5 commits into
mainfrom
lab2_3/design-first

Conversation

@TheSumitBasak

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings August 24, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The newly added lab documentation contains multiple outdated/incorrect statements and citations that contradict the current refactored main.cpp state (plus an unfilled placeholder in the report title).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the terminal Snake game to model multiplayer via a Player aggregate (snake + score) and a players collection, and adds Lab 2_3 submission artifacts (glossary, report, smell audits, and a submission-check script).

Changes:

  • Refactor game state from a single Snake/Score into vector<Player> with shared Food spawn/consumption logic.
  • Update rendering and HUD to show per-player scores and distinct body glyphs, plus multiplayer control help and game-over messaging.
  • Add lab2_3/ documentation (ubiquitous language + report), smell audit markdowns, and a check-lab2_3.sh structure validator.
File summaries
File Description
main.cpp Introduces Player/players model, multiplayer movement/collision/food rules, updated HUD/rendering, and updated end/reset flow.
lab2_3/UBIQUITOUS_LANGUAGE.md Adds a domain glossary intended to trace terms to code and flag ambiguities/drift.
lab2_3/REPORT.md Adds the Lab 2_3 write-up describing glossary edits, smell deltas, and analysis.
lab2_3/check-lab2_3.sh Adds a script to verify required files/report structure and print commit/run metrics for the lab submission.
lab2_3/audits/main.md Adds a smell audit snapshot for the baseline (main) state.
lab2_3/audits/lab1-head.md Adds a smell audit snapshot for the Lab-1 multiplayer HEAD for comparison.
Review details

Suppressed comments (4)

lab2_3/UBIQUITOUS_LANGUAGE.md:36

  • These glossary rows reference the old single-/two-scalar implementation (sn/sc, sn2/sc2) and cite line numbers that no longer match main.cpp after the Player/players refactor. Update the “In code” column to point at the current players/snakeFor()/Player::score symbols so the glossary remains traceable.
| **Player 1** | The human steering the first **Snake**, using the arrow keys | player one, P1 | `sn` / `sc` — `main.cpp:208`, `main.cpp:316` |
| **Player 2** | The human steering the second **Snake**, using W/A/S/D | player two, P2 | `sn2` / `sc2` — `main.cpp:209`, `main.cpp:317` |
| **Score** | A **Player**'s points in the current **Game**, ten per **Food** eaten | points, count | `sc`, `sc2` — `main.cpp:207`; awarded `main.cpp:292` |
| **High Score** | The single best **Score** either **Player** has reached, persisted to file between runs | best, record, top score | `hi` — `main.cpp:207`; `snake_highscore.txt` `main.cpp:104` |

lab2_3/UBIQUITOUS_LANGUAGE.md:45

  • The Speed row cites sp and its initialization at line numbers that no longer match, and it doesn’t reflect that sp is set in both the constructor and reset(). Update the citations to the current main.cpp locations so the glossary remains auditable.
| **Speed** | The fixed millisecond delay between **Moves**; lower is faster | delay, pace, difficulty | `sp` / `speed()` — `main.cpp:207`, `main.cpp:383`; set `main.cpp:218-221` |

lab2_3/REPORT.md:38

  • This paragraph states Speed is “305ms on Windows”, but main.cpp currently sets sp = 15 on Windows and sp = 150 elsewhere. Please update the values and citations so the report matches the code being submitted.
Fixed two wrong definitions: **Speed** is a fixed per-platform constant, 305ms on Windows
against 150ms on Linux (`main.cpp:218-221`), not the tunable difficulty `README.md:191`
implies; and the citation for `isSnake` was `:333` when the declaration is at `:330`.

lab2_3/REPORT.md:43

  • This section claims reset() clears sc but not sc2, but the current implementation no longer uses sc/sc2 and Game::reset() respawns players (resetting all scores) via spawnPlayers(). Either update this text to reflect the current behavior or explicitly scope it to the historical commit you’re discussing so the report doesn’t contradict the branch contents.
Added three missed ambiguities: **Game** is overloaded three ways (program, class, one
play-through); **Restart** clears `sc` but never `sc2` (`main.cpp:442`), so it means different
things to the two players; and `isHead` is one flag for both heads (`main.cpp:335`), so the
display separates the bodies as 🟢/🟡 but not the heads.
  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread main.cpp
Comment on lines +196 to +197
static const char* BODY_GLYPH[] = { "🟢", "🟡", "🔵", "🟣" };
static const int BODY_GLYPH_COUNT = 4;
Comment on lines +58 to +60
The third death — a **Snake**'s **Head** entering the *other* **Snake**'s **Body** — is
implemented at `main.cpp:178` and carries a **Score** penalty, but it has no name anywhere in
the repository. See **Code drift**.
Comment thread lab2_3/REPORT.md
@@ -0,0 +1,206 @@
# Lab 2_3 — Group A__
Comment on lines +15 to +16
| **Wall** | The boundary of the play area; a **Snake** whose **Head** crosses it dies | barrier, border, edge | *(unmodelled)* — drawn `main.cpp:321-323`, enforced `main.cpp:283` ⚠ |
| **Food** | The single item on the play area that a **Snake** eats to **Grow** and score | apple, fruit, pellet | `Food` — `main.cpp:193`; `README.md:76` |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants