Draw the Hirst painting (MIL-002) #16

Merged
Tirsvad merged 3 commits from mil-002-spot-painting into main 2026-10-07 18:22:36 +02:00
Owner

Summary

Delivers MIL-002 Spot Painting: the program now draws the finished painting. Run it from the project root with python src/hirst_painting.py.

  • create_pen hides the turtle, lifts the pen and switches the screen to 0 to 255 colours.
  • dot_positions returns the 100 dot centres in 10 rows of 10, 50 apart, centred on the origin so the painting fits the default window.
  • draw_dots draws a size-20 dot at every position in a colour chosen from the palette, and raises ValueError for an empty palette.
  • main draws with the palette of the reference image, then waits for a click with exitonclick. Animation is off while drawing and the screen updates once.
  • 22 new tests (40 in all): pen setup, positions and spacing, dots on a recording fake pen and on a real turtle, no trail, and the order of main's steps. All tests share one hidden Tk window, because starting Tk once per test failed now and then on Windows.
  • RC-006 records the review of this code against QC-PY-001 (verdict Go).

Evidence

  • Drawing time (SC6, 30 seconds or less): 21.1 seconds with turtle's default animation, 0.35 seconds after turning it off (three timed runs on a real window). The window stayed open until a click, and the click closed it.
  • A captured picture of the finished window shows 100 dots in a centred 10 by 10 grid, no trail and no turtle cursor.
  • 19 deliberately broken copies of the code each failed the intended tests.
  • ruff format, ruff check and mypy --strict are clean; the 40 tests pass in any order.

MIL-002 Go criteria

  1. 100 dots in 10 rows of 10: met.
  2. Dot size 20 and 50 units apart: met.
  3. Every dot colour from the palette: met.
  4. Turtle hidden, no trail, window open until a click: met.
  5. Drawn in 30 seconds or less: met (0.35 seconds).
  6. Code review record Go: met (RC-006).

The formal gateway decision (planned for 2026-10-14) is S01's.

Open decisions (they do not block RC-006)

  • The tests need a display for Tk, so they cannot run on a machine without one.
  • A few pale palette colours are faint on the white background; raising the white threshold or reducing the colour count is S01's choice.

Issues

Closes #7
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13

## Summary Delivers MIL-002 Spot Painting: the program now draws the finished painting. Run it from the project root with `python src/hirst_painting.py`. - `create_pen` hides the turtle, lifts the pen and switches the screen to 0 to 255 colours. - `dot_positions` returns the 100 dot centres in 10 rows of 10, 50 apart, centred on the origin so the painting fits the default window. - `draw_dots` draws a size-20 dot at every position in a colour chosen from the palette, and raises `ValueError` for an empty palette. - `main` draws with the palette of the reference image, then waits for a click with `exitonclick`. Animation is off while drawing and the screen updates once. - 22 new tests (40 in all): pen setup, positions and spacing, dots on a recording fake pen and on a real turtle, no trail, and the order of `main`'s steps. All tests share one hidden Tk window, because starting Tk once per test failed now and then on Windows. - RC-006 records the review of this code against `QC-PY-001` (verdict `Go`). ## Evidence - Drawing time (SC6, 30 seconds or less): 21.1 seconds with turtle's default animation, 0.35 seconds after turning it off (three timed runs on a real window). The window stayed open until a click, and the click closed it. - A captured picture of the finished window shows 100 dots in a centred 10 by 10 grid, no trail and no turtle cursor. - 19 deliberately broken copies of the code each failed the intended tests. - `ruff format`, `ruff check` and `mypy --strict` are clean; the 40 tests pass in any order. ## MIL-002 Go criteria 1. 100 dots in 10 rows of 10: met. 2. Dot size 20 and 50 units apart: met. 3. Every dot colour from the palette: met. 4. Turtle hidden, no trail, window open until a click: met. 5. Drawn in 30 seconds or less: met (0.35 seconds). 6. Code review record `Go`: met (RC-006). The formal gateway decision (planned for 2026-10-14) is S01's. ## Open decisions (they do not block RC-006) - The tests need a display for Tk, so they cannot run on a machine without one. - A few pale palette colours are faint on the white background; raising the white threshold or reducing the colour count is S01's choice. ## Issues Closes #7 Closes #8 Closes #9 Closes #10 Closes #11 Closes #12 Closes #13
Tirsvad added this to the MIL-002: Spot Painting milestone 2026-10-07 18:21:56 +02:00
Tirsvad added 3 commits 2026-10-07 18:21:57 +02:00
MIL-002 tasks 1 to 6.

- Add create_pen, which hides the turtle, lifts the pen and switches the screen
  to 0 to 255 colours.
- Add dot_positions: 100 dot centres in 10 rows of 10, 50 apart, centred on the
  origin so the painting fits the default window.
- Add draw_dots, which draws a size-20 dot at every position in a colour chosen
  from the palette, and raises ValueError for an empty palette.
- Add main: draw with the palette of the reference image, then wait for a click
  with exitonclick. Animation is off while drawing and the screen updates once,
  which takes the drawing from 21.1 to 0.35 seconds (SC6 allows 30).
- Add 22 tests: pen setup, positions and spacing, dots on a recording fake pen
  and on a real turtle, no trail, and the order of main's steps. All tests share
  one hidden Tk window, because starting Tk per test fails now and then on
  Windows.

Closes #7
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12

Task: MIL-002#1
Task: MIL-002#2
Task: MIL-002#3
Task: MIL-002#4
Task: MIL-002#5
Task: MIL-002#6
Review the code of MIL-002 against QC-PY-001: 12 of 13 criteria apply and all
pass, criterion 10 is N-A (no Design Class Diagram). Verdict Go, confirmed by
S01. That is the last Go criterion of MIL-002.

Two decisions stay open and do not block the verdict: the tests need a display
for Tk, and a few pale palette colours are faint on the white background.

Closes #13

Task: MIL-002#7
Replace `pending` in the Version History of RC-006 with a link to the commit
that introduced the row.
Tirsvad merged commit bd4a4dab6a into main 2026-10-07 18:22:36 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Tirsvad-Udemy-100-days-of-code/018-hirst-painting#16