Implement the playable console game for gateway MIL-002 (Gateway 2 - Game Implementation): python -m blackjack.
rules.py holds deal_card, calculate_score (blackjack = 0, aces drop 11 to 1) and compare with an Outcome enum, with no console I/O.
display.py renders hands as plain-text rank plus suit emoji (keycap emoji showed as boxes in common terminals), plus scores and outcome messages. art.py holds the course logo.
game.py has the game flow: hit/stand, the dealer draws below 17, restart loop with console clear and logo, and a yes/no prompt that asks again on invalid input. read, write and draw are injected so games can be scripted.
Constants (ranks, suits, prompts, messages) live in constants.py; the README has run instructions.
python -m unittest discover -s tests: 35 tests pass. They cover every house rule, the order of the compare checks, each way a game can end, and scripted full sessions with restart.
An AST test checks that rules.py never calls input() or print().
ruff check, ruff format --check and mypy --strict are clean on src and tests.
doxygen Doxyfile ran and I saw no warnings in its output.
One real game played through python -m blackjack showed the logo, cards and a result.
Review notes
Suits follow a card's position in the hand (♠ ♥ ♦ ♣, repeating) because the game tracks only card values. They have no gameplay effect.
A Jack, Queen or King is shown as 10, since the house rules store one value for all four.
The dealer does not draw once the player has bust; the result is the same as in the assignment's hint.
After merge: check that issues #7 to #14 are closed and close milestone 35.
## Summary
- Implement the playable console game for gateway MIL-002 (Gateway 2 - Game Implementation): `python -m blackjack`.
- `rules.py` holds `deal_card`, `calculate_score` (blackjack = 0, aces drop 11 to 1) and `compare` with an `Outcome` enum, with no console I/O.
- `display.py` renders hands as plain-text rank plus suit emoji (keycap emoji showed as boxes in common terminals), plus scores and outcome messages. `art.py` holds the course logo.
- `game.py` has the game flow: hit/stand, the dealer draws below 17, restart loop with console clear and logo, and a yes/no prompt that asks again on invalid input. `read`, `write` and `draw` are injected so games can be scripted.
- Constants (ranks, suits, prompts, messages) live in `constants.py`; the README has run instructions.
## Issues
Closes #7
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14
## Verification
- `python -m unittest discover -s tests`: 35 tests pass. They cover every house rule, the order of the `compare` checks, each way a game can end, and scripted full sessions with restart.
- An AST test checks that `rules.py` never calls `input()` or `print()`.
- `ruff check`, `ruff format --check` and `mypy --strict` are clean on `src` and `tests`.
- `doxygen Doxyfile` ran and I saw no warnings in its output.
- One real game played through `python -m blackjack` showed the logo, cards and a result.
## Review notes
- Suits follow a card's position in the hand (♠ ♥ ♦ ♣, repeating) because the game tracks only card values. They have no gameplay effect.
- A Jack, Queen or King is shown as `10`, since the house rules store one value for all four.
- The dealer does not draw once the player has bust; the result is the same as in the assignment's hint.
- After merge: check that issues #7 to #14 are closed and close milestone 35.
Implement the playable console game for gateway MIL-002.
- rules.py: deal_card, calculate_score (blackjack = 0, aces drop 11 ->
1)
and compare with an Outcome enum; no console I/O
- display.py: hand rendering as plain-text rank plus suit emoji (keycap
emoji rendered as boxes in common terminals), score formatting and
outcome messages
- art.py: course logo shown at the start of every game
- game.py: play_game (hit/stand, dealer draws below 17), play (restart
loop, console clear, logo) and ask_yes_no with re-prompt; read, write
and draw are injected so games can be scripted
- __main__.py: python -m blackjack entry point, exits cleanly on
Ctrl+C/Ctrl+D
- constants.py: card ranks and suits, prompts and messages
- tests: 32 new unit and scripted end-to-end tests (35 in total)
- README: run instructions for python -m blackjack
Closes#7Closes#8Closes#9Closes#10Closes#11Closes#12Closes#13Closes#14
Task: MIL-002#1
Task: MIL-002#2
Task: MIL-002#3
Task: MIL-002#4
Task: MIL-002#5
Task: MIL-002#6
Task: MIL-002#7
Task: MIL-002#8
Tirsvad
merged commit 06d0386010 into main2026-10-04 16:06:12 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
python -m blackjack.rules.pyholdsdeal_card,calculate_score(blackjack = 0, aces drop 11 to 1) andcomparewith anOutcomeenum, with no console I/O.display.pyrenders hands as plain-text rank plus suit emoji (keycap emoji showed as boxes in common terminals), plus scores and outcome messages.art.pyholds the course logo.game.pyhas the game flow: hit/stand, the dealer draws below 17, restart loop with console clear and logo, and a yes/no prompt that asks again on invalid input.read,writeanddraware injected so games can be scripted.constants.py; the README has run instructions.Issues
Closes #7
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14
Verification
python -m unittest discover -s tests: 35 tests pass. They cover every house rule, the order of thecomparechecks, each way a game can end, and scripted full sessions with restart.rules.pynever callsinput()orprint().ruff check,ruff format --checkandmypy --strictare clean onsrcandtests.doxygen Doxyfileran and I saw no warnings in its output.python -m blackjackshowed the logo, cards and a result.Review notes
10, since the house rules store one value for all four.