Author SHA1 Message Date
Tirsvad 8a5aa3a9b6 Merge pull request 'MIL-004 Documentation and release: README, checks and reviews' (#27) from mil-004-docs-release into main
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 5s
Reviewed-on: #27
2026-10-04 18:04:42 +02:00
TirsvadandClaude Sonnet 5.5 5ebf05c735 Resolve pending commit links for MIL-004 acceptance
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 00:00:07 +08:00
Tirsvad 267e34fc9f Accept MIL-004 and review the source code
Review MIL-004 (RC-011, Go) and the Python source against QC-PY-001
(RC-012, Go) and accept MIL-004. Update the Traceability Matrix.

Task: MIL-004#3
Closes #19
2026-10-04 23:59:32 +08:00
Tirsvad 4abf984382 Fix lint, format and typing findings and pin dev tools
Order imports, format with ruff, make the account key constants Final
so mypy --strict accepts them, and type the test helpers. Configure
ruff and mypy in pyproject.toml and pin the dev tool versions. All
modules, classes and functions already carry Doxygen comments;
doxygen Doxyfile builds without warnings.

Task: MIL-004#2
Closes #18
2026-10-04 23:59:15 +08:00
Tirsvad 6e52a242fa Add README with set-up, run, test and Doxygen instructions
Describe the game, the .venv set-up with pip upgrade, running the game
and tests, the code checks, the Doxygen build and the layout. Verified
by following it in a clean copy of the tree.

Task: MIL-004#1
Task: MIL-004#4
Closes #17
Closes #20
2026-10-04 23:58:22 +08:00
Tirsvad cbdcba0a9f Merge pull request 'MIL-003 Console game: game loop, entry point and accepted use case' (#26) from mil-003-game-loop into main
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 3s
Reviewed-on: #26
2026-10-04 17:50:34 +02:00
12 changed files with 284 additions and 37 deletions
+99 -1
View File
@@ -1,2 +1,100 @@
# 014-higher_lower # Higher Lower
A console game from Udemy's *100 Days of Code: The Complete Python Pro Bootcamp*
(day 14). Two Instagram accounts are shown. Guess which one has more followers.
Every right guess adds a point and the winner stays for the next round. A wrong
guess ends the game.
```
Compare A: Cristiano Ronaldo, a Footballer, from Portugal.
_ __
| | / /____
| | / / ___/
| |/ (__ )
|___/____(_)
Against B: Ariana Grande, a Musician and actress, from United States.
Who has more followers? Type 'A' or 'B':
```
- Python 3.13 or newer, no runtime dependencies.
- The function names follow the assignment: `format_data`, `check_answer`.
- Each account is shown once per game; if you get through all 50, you win.
- Follower counts are in millions and come from the assignment's data set.
## Requirements
- [Python](https://www.python.org/downloads/) 3.13 or newer
- Optional: [Doxygen](https://www.doxygen.nl/) to build the source documentation
## Set up
Create a local virtual environment in `.venv`, activate it, and upgrade `pip`.
Windows (PowerShell):
```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
```
Windows (Git Bash), Linux and macOS:
```bash
python -m venv .venv
source .venv/Scripts/activate # Linux/macOS: source .venv/bin/activate
python -m pip install --upgrade pip
```
The game itself needs nothing more. To run the tests and the code checks, install the
development tools:
```bash
python -m pip install -e ".[dev]"
```
## Run the game
```bash
python -m higher_lower
```
Type `A` or `B` and press Enter. Press Ctrl+C to quit.
## Run the tests
```bash
python -m pytest
```
Check the code style and types:
```bash
python -m ruff check src tests
python -m ruff format --check src tests
python -m mypy src tests
```
## Build the source documentation
The source uses Doxygen comments. The HTML output goes to `docs/doxygen/html`.
```bash
doxygen Doxyfile
```
## Project layout
| Path | Content |
| --- | --- |
| `src/higher_lower/` | The game: `game_logic.py` (pure functions), `game.py` (the loop), `game_data.py`, `art.py`, `constants.py` |
| `tests/` | pytest tests |
| `docs/` | Planning and review documents (business case, plan, milestones, use case) |
| `pyproject.toml` | Project configuration |
| `Doxyfile` | Doxygen configuration |
## License
GNU Affero General Public License v3.0. See [LICENSE](LICENSE).
+1 -1
View File
@@ -15,7 +15,7 @@ document of a type. `Primary File` may contain a glob (e.g.
| SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 | | SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 |
| PP | Project Plan | docs/project-plan.md | 002 | | PP | Project Plan | docs/project-plan.md | 002 |
| MIL | Milestone / Gateway | docs/milestones/*.md | 005 | | MIL | Milestone / Gateway | docs/milestones/*.md | 005 |
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 011 | | RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 013 |
| TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 | | TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 |
| UCD | Use Case Diagram | docs/use-case-diagram.md | 002 | | UCD | Use Case Diagram | docs/use-case-diagram.md | 002 |
| US | User Story | docs/user-stories.md | 002 | | US | User Story | docs/user-stories.md | 002 |
+5 -2
View File
@@ -4,12 +4,13 @@
| Key | Value | | Key | Value |
| --- | --- | | --- | --- |
| ID | MIL-004 | | ID | MIL-004 |
| CrossReference | [BC-001], [PP-001] | | CrossReference | [BC-001], [PP-001], [RC-011] |
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-04 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [ddfe96f] | | 2026-10-04 | Deprecated | Jens Tirsvad Nielsen | S01 | Initial version | [ddfe96f] |
| 2026-10-04 | Accepted | Jens Tirsvad Nielsen | S01 | Accepted after review RC-011 | [267e34f] |
--- ---
@@ -70,3 +71,5 @@ Decide whether the repository is ready to be shared with S02 and S03: documented
[PP-001]: ../project-plan.md [PP-001]: ../project-plan.md
[MIL-003]: ./mil-003-console-game.md [MIL-003]: ./mil-003-console-game.md
[ddfe96f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/ddfe96ffa459d5e4b2e30d71bd53878aba2cfc5d [ddfe96f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/ddfe96ffa459d5e4b2e30d71bd53878aba2cfc5d
[RC-011]: ../sqa/reviews/rc-011-mil-004.md
[267e34f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/267e34fc9f1fb9d76cc20032f3b09dc8e9dd82c7
+46
View File
@@ -0,0 +1,46 @@
# SQA Review Record: MIL-004 Documentation and release
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-011 |
| CrossReference | [MIL-004], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-04 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version | [267e34f] |
---
## Artifact Under Review
- Instance reviewed: [MIL-004]
- Checklist used: [QC-MIL-001]
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | README, Doxygen build, review records and a verified clean copy. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Six objectively checkable criteria. |
| 3 | Dependencies on other milestones are explicitly mapped (Optional) | Pass | Depends on MIL-003, with the reason. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | O2, O4, O5. |
| 5 | Milestone owner and approving reviewer are identified | Pass | S01 and S01. |
| 6 | Milestone has a target date consistent with project constraints | Pass | 2026-10-14, the date in the BC-001 constraint. |
## Overall Verdict
Go — all criteria pass. Reviewer and author are both S01: the project has a single participant, so the framework's author/reviewer separation cannot be met. S01 accepted this deviation when requesting acceptance (2026-10-04).
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | — | — |
---
[MIL-004]: ../../milestones/mil-004-docs-release.md
[QC-MIL-001]: ../../../framework/qc/qc-milestones-gateways.md
[267e34f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/267e34fc9f1fb9d76cc20032f3b09dc8e9dd82c7
+52
View File
@@ -0,0 +1,52 @@
# SQA Review Record: Source code of higher_lower
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-012 |
| CrossReference | [QC-PY-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-04 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version | [267e34f] |
---
## Artifact Under Review
- Instance reviewed: the Python source in `src/higher_lower/` and `tests/` at the commit of this review (source code has no artifact ID)
- Checklist used: [QC-PY-001]
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Packages, modules, functions, variables, classes and constants follow PEP 8 casing (`snake_case`, `PascalCase`, `UPPER_SNAKE`) | Pass | Modules and functions snake_case, constants UPPER_SNAKE, TypedDict PascalCase; ruff (E, F, I, UP, FLY, B) passes. |
| 2 | Names state purpose in the domain's language; no unexplained abbreviations, no single-letter names outside tiny scopes | Pass | Names say purpose (check_answer, pick_pair); i/n-style names are not used. |
| 3 | Code is produced by the project's formatter and passes its linter with no unexplained suppressions | Pass | `ruff check` and `ruff format --check` pass; the only suppression is E501 for the verbatim data file, with a comment in pyproject.toml. |
| 4 | Every function and method signature is type-annotated, including `-> None` | Pass | All signatures annotated; `mypy --strict src tests` reports no issues. |
| 5 | No bare `except:`, no swallowed exceptions; specific exceptions are raised and the cause is kept (`raise ... from`) | Pass | No bare except; `main` catches EOFError and KeyboardInterrupt on purpose and leaves with a goodbye. |
| 6 | No mutable default arguments and no shadowed builtins | Pass | No mutable defaults; the data list default is a read-only module constant. |
| 7 | Files, locks and connections are managed with context managers | N-A | The code opens no files, locks or connections. |
| 8 | Public modules, classes and functions have docstrings that say what, not how (Optional) | Pass | Every module, class and function has a Doxygen docstring; checked with an AST script. |
| 9 | Logging uses `logging`, not `print`; no secrets or personal data in log output | N-A | The game prints its interface to the console; there is no logging, and no secrets or personal data are printed. |
| 10 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded | N-A | No Design Class Diagram exists or is planned; the only class is the Account TypedDict, and the functions implement the operations of SSD-001. |
| 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network | Pass | 36 pytest tests named for behaviour, with scripted input and seeded randomness; no network, no order dependence. |
| 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment (Optional) | Pass | mypy strict runs without errors; no Any is used. |
| 13 | Dependencies are declared and pinned in the project's dependency file, none unused (Optional) | Pass | No runtime dependencies; dev tools declared in pyproject.toml with version ranges. |
## Overall Verdict
Go — all applicable criteria pass. The review found a lint ordering error, format differences and strict-typing errors; they were fixed before this verdict (ruff import order and format, `Final` on the account key constants). Reviewer and author are both S01: the project has a single participant, so the framework's author/reviewer separation cannot be met. S01 accepted this deviation when requesting acceptance (2026-10-04).
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | — | — |
---
[QC-PY-001]: ../../../framework/qc/qc-programming-python.md
[267e34f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/267e34fc9f1fb9d76cc20032f3b09dc8e9dd82c7
+7 -4
View File
@@ -9,8 +9,8 @@
## Version History ## Version History
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-04 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-006 and the UC-001 artifacts | [923dde7] |
| 2026-10-04 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-007 to RC-010 for UCD-001, US-001, UC-001 and SSD-001 | [c7164fe] | | 2026-10-04 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-007 to RC-010 for UCD-001, US-001, UC-001 and SSD-001 | [c7164fe] |
| 2026-10-04 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-011 and RC-012 | [267e34f] |
--- ---
@@ -28,8 +28,8 @@ target is measurable. A row is added or updated whenever an artifact instance is
| [PP-001] | PP | [BC-001], [SA-001] | [MIL-001], [MIL-002], [MIL-003], [MIL-004] | [RC-003] | | [PP-001] | PP | [BC-001], [SA-001] | [MIL-001], [MIL-002], [MIL-003], [MIL-004] | [RC-003] |
| [MIL-001] | MIL | [BC-001], [PP-001] | - | [RC-004] | | [MIL-001] | MIL | [BC-001], [PP-001] | - | [RC-004] |
| [MIL-002] | MIL | [BC-001], [PP-001], [MIL-001] | - | [RC-005] | | [MIL-002] | MIL | [BC-001], [PP-001], [MIL-001] | - | [RC-005] |
| [MIL-003] | MIL | [BC-001], [PP-001], [MIL-002], [US-001] | [UC-001] | [RC-006] | | [MIL-003] | MIL | [BC-001], [PP-001], [MIL-002], [US-001] | [MIL-004], [UC-001] | [RC-006] |
| [MIL-004] | MIL | [BC-001], [PP-001] | - | - | | [MIL-004] | MIL | [BC-001], [PP-001], [MIL-003] | - | [RC-011] |
| [UCD-001] | UCD | [SA-001], [BC-001] | [US-001], [UC-001] | [RC-007] | | [UCD-001] | UCD | [SA-001], [BC-001] | [US-001], [UC-001] | [RC-007] |
| [US-001] | US | [UCD-001], [BC-001], [MIL-003] | [UC-001] | [RC-008] | | [US-001] | US | [UCD-001], [BC-001], [MIL-003] | [UC-001] | [RC-008] |
| [UC-001] | UC | [UCD-001], [US-001], [SA-001] | [SSD-001] | [RC-009] | | [UC-001] | UC | [UCD-001], [US-001], [SA-001] | [SSD-001] | [RC-009] |
@@ -38,6 +38,7 @@ target is measurable. A row is added or updated whenever an artifact instance is
## Coverage Notes ## Coverage Notes
- No domain model or design artifacts exist yet. - No domain model or design artifacts exist yet.
- RC-012 reviews the Python source against QC-PY-001; source code has no artifact ID, so it has no row above.
- `-` in Upstream means foundational; in Downstream, nothing is built on it yet; in Last Reviewed, no `RC-*` exists yet. - `-` in Upstream means foundational; in Downstream, nothing is built on it yet; in Last Reviewed, no `RC-*` exists yet.
--- ---
@@ -59,9 +60,11 @@ target is measurable. A row is added or updated whenever an artifact instance is
[UC-001]: ../uc-001/uc.md [UC-001]: ../uc-001/uc.md
[SSD-001]: ../uc-001/ssd.md [SSD-001]: ../uc-001/ssd.md
[RC-006]: ./reviews/rc-006-mil-003.md [RC-006]: ./reviews/rc-006-mil-003.md
[923dde7]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/923dde7dc9b59d2c77eddc88336451193147c557
[RC-007]: ./reviews/rc-007-ucd-001.md [RC-007]: ./reviews/rc-007-ucd-001.md
[RC-008]: ./reviews/rc-008-us-001.md [RC-008]: ./reviews/rc-008-us-001.md
[RC-009]: ./reviews/rc-009-uc-001.md [RC-009]: ./reviews/rc-009-uc-001.md
[RC-010]: ./reviews/rc-010-ssd-001.md [RC-010]: ./reviews/rc-010-ssd-001.md
[c7164fe]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/c7164feab1333951bf6f557baf95a26764656be0 [c7164fe]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/c7164feab1333951bf6f557baf95a26764656be0
[RC-011]: ./reviews/rc-011-mil-004.md
[RC-012]: ./reviews/rc-012-source-code.md
[267e34f]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/014-higher_lower/commit/267e34fc9f1fb9d76cc20032f3b09dc8e9dd82c7
+14 -1
View File
@@ -12,7 +12,7 @@ license = { file = "LICENSE" }
dependencies = [] dependencies = []
[project.optional-dependencies] [project.optional-dependencies]
dev = ["pytest>=8"] dev = ["pytest>=9,<10", "ruff>=0.16,<0.17", "mypy>=2.4,<3"]
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["src"] where = ["src"]
@@ -20,3 +20,16 @@ where = ["src"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
testpaths = ["tests"] testpaths = ["tests"]
pythonpath = ["src"] pythonpath = ["src"]
[tool.ruff]
line-length = 88
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "FLY", "B"]
[tool.ruff.lint.per-file-ignores]
"src/higher_lower/game_data.py" = ["E501"] # assignment data kept verbatim
[tool.mypy]
strict = true
mypy_path = "src"
+28 -14
View File
@@ -9,23 +9,37 @@ string, so Doxygen does not read the backticks in the art as markup.
## The game logo. ## The game logo.
logo = ( logo = (
"\n" "\n"
r" __ ___ __ " "\n" r" __ ___ __ "
r" / / / (_)___ _/ /_ ___ _____" "\n" "\n"
r" / /_/ / / __ `/ __ \/ _ \/ ___/" "\n" r" / / / (_)___ _/ /_ ___ _____"
r" / __ / / /_/ / / / / __/ / " "\n" "\n"
r"/_/ ///_/\__, /_/ /_/\___/_/ " "\n" r" / /_/ / / __ `/ __ \/ _ \/ ___/"
r" / / /____/_ _____ _____" "\n" "\n"
r" / / / __ \ | /| / / _ \/ ___/" "\n" r" / __ / / /_/ / / / / __/ / "
r" / /___/ /_/ / |/ |/ / __/ / " "\n" "\n"
r"/_____/\____/|__/|__/\___/_/ " "\n" r"/_/ ///_/\__, /_/ /_/\___/_/ "
"\n"
r" / / /____/_ _____ _____"
"\n"
r" / / / __ \ | /| / / _ \/ ___/"
"\n"
r" / /___/ /_/ / |/ |/ / __/ / "
"\n"
r"/_____/\____/|__/|__/\___/_/ "
"\n"
) )
## The "vs" shown between the two accounts. ## The "vs" shown between the two accounts.
vs = ( vs = (
"\n" "\n"
r" _ __ " "\n" r" _ __ "
r"| | / /____" "\n" "\n"
r"| | / / ___/" "\n" r"| | / /____"
r"| |/ (__ ) " "\n" "\n"
r"|___/____(_)" "\n" r"| | / / ___/"
"\n"
r"| |/ (__ ) "
"\n"
r"|___/____(_)"
"\n"
) )
+6 -4
View File
@@ -2,11 +2,13 @@
@brief Constants shared by the game modules. @brief Constants shared by the game modules.
""" """
from typing import Final
## Keys of an account dictionary. ## Keys of an account dictionary.
KEY_NAME = "name" KEY_NAME: Final = "name"
KEY_FOLLOWER_COUNT = "follower_count" KEY_FOLLOWER_COUNT: Final = "follower_count"
KEY_DESCRIPTION = "description" KEY_DESCRIPTION: Final = "description"
KEY_COUNTRY = "country" KEY_COUNTRY: Final = "country"
## The two choices the player can type, in lower case. ## The two choices the player can type, in lower case.
CHOICE_A = "a" CHOICE_A = "a"
+2 -2
View File
@@ -1,5 +1,5 @@
"""@file game_logic.py """@file game_logic.py
@brief Pure functions of the game: drawing accounts, describing them and checking guesses. @brief Pure game functions: draw accounts, describe them, check guesses.
""" """
import random import random
@@ -9,9 +9,9 @@ from higher_lower.constants import (
ACCOUNT_TEMPLATE, ACCOUNT_TEMPLATE,
CHOICE_A, CHOICE_A,
CHOICE_B, CHOICE_B,
KEY_COUNTRY,
KEY_DESCRIPTION, KEY_DESCRIPTION,
KEY_NAME, KEY_NAME,
KEY_COUNTRY,
) )
from higher_lower.game_data import Account, data from higher_lower.game_data import Account, data
+23 -6
View File
@@ -14,20 +14,37 @@ from higher_lower.game import ask_choice, play_game, show_round
from higher_lower.game_data import Account from higher_lower.game_data import Account
ACCOUNTS: list[Account] = [ ACCOUNTS: list[Account] = [
{"name": "First", "follower_count": 30, "description": "Test one", "country": "Denmark"}, {
{"name": "Second", "follower_count": 20, "description": "Test two", "country": "Norway"}, "name": "First",
{"name": "Third", "follower_count": 10, "description": "Test three", "country": "Sweden"}, "follower_count": 30,
"description": "Test one",
"country": "Denmark",
},
{
"name": "Second",
"follower_count": 20,
"description": "Test two",
"country": "Norway",
},
{
"name": "Third",
"follower_count": 10,
"description": "Test three",
"country": "Sweden",
},
] ]
class FirstRng(random.Random): class FirstRng(random.Random):
"""@brief Random generator that always takes the first entries, so a game is fixed.""" """@brief Random generator that takes the first entries, so a game is fixed."""
def sample(self, population: Sequence, k: int, **kwargs: object) -> list: # type: ignore[override] def sample( # type: ignore[override]
self, population: Sequence[Account], k: int, **kwargs: object
) -> list[Account]:
"""@brief Return the first k entries.""" """@brief Return the first k entries."""
return list(population)[:k] return list(population)[:k]
def choice(self, seq: Sequence) -> Account: # type: ignore[override] def choice(self, seq: Sequence[Account]) -> Account: # type: ignore[override]
"""@brief Return the first entry.""" """@brief Return the first entry."""
return seq[0] return seq[0]
+1 -2
View File
@@ -58,8 +58,7 @@ def test_format_data_describes_the_account() -> None:
"country": "United States", "country": "United States",
} }
assert ( assert (
format_data(account) format_data(account) == "Nike, a Sportswear multinational, from United States"
== "Nike, a Sportswear multinational, from United States"
) )