MIL-008: smarter purchase rule #49

Merged
Tirsvad merged 5 commits from mil-008-smarter-rule into main 2026-10-28 16:43:41 +01:00
5 changed files with 240 additions and 95 deletions
Showing only changes of commit 9a6796f775 - Show all commits
+2 -2
View File
@@ -14,9 +14,9 @@ document of a type. `Primary File` may contain a glob (e.g.
| BC | Business Case | docs/business-case.md | 002 | | BC | Business Case | docs/business-case.md | 002 |
| 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 | 008 | | MIL | Milestone / Gateway | docs/milestones/*.md | 009 |
| ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0004 | | ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0004 |
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 019 | | RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 020 |
| TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 | | TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 |
| DICT | Domain Dictionary (PO and IT terms) | docs/dictionary.md | 002 | | DICT | Domain Dictionary (PO and IT terms) | docs/dictionary.md | 002 |
+75
View File
@@ -0,0 +1,75 @@
# MIL-008 Smarter purchase rule
## Metadata
| Key | Value |
| --- | --- |
| ID | MIL-008 |
| CrossReference | [BC-001] |
| Language | en |
| Domain | it |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S02 | Initial version | pending |
---
## Purpose
Decide whether a purchase rule that looks at what an upgrade earns, not only at its price, beats the assignment's rule ("most expensive affordable", 18.9 cookies/second alone on the computer) in a measured container run.
## Deliverable
A "best value" strategy next to buy-one and buy-all (the lowest price per cookie per second among the affordable upgrades), selectable from the command line, unit tested, with a recorded comparison and a wiki note for each language. The defaults stay the assignment's behaviour.
## Go / No-Go Criteria
| # | Criterion (objectively checkable) | Go | No-Go |
| --- | --- | --- | --- |
| 1 | The new strategy is selectable from the command line and the defaults are unchanged (5 seconds, buy one) | Defaults unchanged | Defaults changed |
| 2 | The rule is a pure function in `domain/` with no Selenium import, and unit tests cover it | 0 failures, coverage of the logic modules at 80% or more | A test fails or coverage drops |
| 3 | Baseline and new strategy are each run at least twice in the same container conditions and the table is recorded | Table with 4 or more rows | Fewer rows |
| 4 | The result is stated as measured, also when the new rule is not better | Result named | Claim without a measurement |
| 5 | The wiki records the result in English, Danish and Bahasa Malaysia | 3 languages | A language missing |
| 6 | The code review against `qc-programming-python.md` is `Go` | `RC-*` is `Go` | `No-Go` |
## Dependencies
| Depends on | Reason |
| --- | --- |
| MIL-006 | Extends the strategy options and the comparison method |
## Traceability
| Business Case objective / KPI / user story | Reference |
| --- | --- |
| O4 | [BC-001] |
| CN-003 | [SA-001] |
## Ownership
| Role | Stakeholder ID (SA) |
| --- | --- |
| Owner | S01 |
| Approving reviewer | S02 (AI as stand-in, autonomous mode, not independent) |
## Target Date
2026-11-06 — after the planned window of [PP-001]; the Business Case sets no deadline.
## Tasks
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
| --- | --- | --- | --- | --- |
| 1 | Read the production of each upgrade | Add to the game port a read of how many cookies per second one unit of each visible upgrade makes (from the game's own data), and add it to `Upgrade`. Unit tested with a fake game. | No | O4 |
| 2 | Add the best value rule | Add a pure function that picks the affordable upgrade with the lowest price per cookie per second, and a `BEST_VALUE` strategy. Unit tested, including ties and unknown production. | No | O4 |
| 3 | Select the strategy from the command line | Add the option, keep buy-one as the default, and update the README option table. | No | O4 |
| 4 | Compare with container runs | Run baseline and best value at least twice each in Docker under the same conditions, record cookies per second and name the better rule. | No | O4 |
| 5 | Record the result in the wiki | Add the result and what was gained to Step 5 in English, Danish and Bahasa Malaysia. | No | O4 |
---
[BC-001]: ../business-case.md
[PP-001]: ../project-plan.md
[SA-001]: ../stakeholder-analysis.md
+4 -1
View File
@@ -12,12 +12,13 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version: seven gateways; accepted by S01 in chat | [cadc5ef] | | 2026-10-28 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version: seven gateways; accepted by S01 in chat | [cadc5ef] |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | S01 | Add MIL-008 (smarter purchase rule); accepted by S01 in chat | pending |
--- ---
## Purpose ## Purpose
This plan schedules seven gateways (`MIL-001` to `MIL-007`) that take the Cookie Clicker bot from an accepted baseline to a documented, tested and published repository. The Business Case sets no deadline, so the window 2026-10-28 to 2026-11-04 is a planning assumption of this plan. Each gateway ends in a decision and a deliverable and is delivered by one pull request on its own branch. This plan schedules eight gateways (`MIL-001` to `MIL-008`) that take the Cookie Clicker bot from an accepted baseline to a documented, tested and published repository. The Business Case sets no deadline, so the window 2026-10-28 to 2026-11-04 is a planning assumption of this plan. Each gateway ends in a decision and a deliverable and is delivered by one pull request on its own branch.
## Planning Assumptions ## Planning Assumptions
@@ -38,6 +39,7 @@ This plan schedules seven gateways (`MIL-001` to `MIL-007`) that take the Cookie
| Lecture step 4 | [MIL-005] | 2026-10-31 to 2026-11-01 | 2026-11-01 | S01 | none (technical tasks) | 5 minute run, cookies per second, screenshot 4 | [Milestone 5] | | Lecture step 4 | [MIL-005] | 2026-10-31 to 2026-11-01 | 2026-11-01 | S01 | none (technical tasks) | 5 minute run, cookies per second, screenshot 4 | [Milestone 5] |
| Lecture step 5 | [MIL-006] | 2026-11-01 to 2026-11-02 | 2026-11-02 | S01 | none (technical tasks) | Strategy options, comparison, screenshot 5 | [Milestone 6] | | Lecture step 5 | [MIL-006] | 2026-11-01 to 2026-11-02 | 2026-11-02 | S01 | none (technical tasks) | Strategy options, comparison, screenshot 5 | [Milestone 6] |
| Documentation, wiki and release | [MIL-007] | 2026-11-02 to 2026-11-04 | 2026-11-04 | S01 | none (documentation) | README, Doxygen, wiki in en, da and ms, final checks | [Milestone 7] | | Documentation, wiki and release | [MIL-007] | 2026-11-02 to 2026-11-04 | 2026-11-04 | S01 | none (documentation) | README, Doxygen, wiki in en, da and ms, final checks | [Milestone 7] |
| Smarter purchase rule | [MIL-008] | 2026-11-05 to 2026-11-06 | 2026-11-06 | S01 | none (technical tasks) | Best value strategy, measured comparison, wiki note in en, da and ms | [Milestone 8] |
```plantuml ```plantuml
@startgantt @startgantt
@@ -103,6 +105,7 @@ A No-Go on a gateway stops all later gateways until it is fixed and re-reviewed.
[MIL-005]: ./milestones/mil-005-timed-run.md [MIL-005]: ./milestones/mil-005-timed-run.md
[MIL-006]: ./milestones/mil-006-strategy.md [MIL-006]: ./milestones/mil-006-strategy.md
[MIL-007]: ./milestones/mil-007-documentation.md [MIL-007]: ./milestones/mil-007-documentation.md
[MIL-008]: ./milestones/mil-008-smarter-rule.md
[cadc5ef]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/commit/cadc5eff21d9afc09799d4bc2e3f6ac17ab2612a [cadc5ef]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/commit/cadc5eff21d9afc09799d4bc2e3f6ac17ab2612a
[Milestone 1]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/milestone/290 [Milestone 1]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/milestone/290
[Milestone 2]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/milestone/291 [Milestone 2]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/milestone/291
+64
View File
@@ -0,0 +1,64 @@
# SQA Review Record
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-019 |
| CrossReference | [MIL-008], [QC-MIL-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S02 | Review record, full review | pending |
---
## Artifact Under Review
- Instance reviewed: [MIL-008]
- Checklist used: [QC-MIL-001] (`QC-MIL-001`)
- Scope: full review
- Language and domain: en / it
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S02`)
## Checklist Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate | Pass | Deliverable names the strategy, the comparison and the wiki note. |
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Go/No-Go table has objectively checkable criteria with Go and No-Go columns. |
| 3 | Dependencies on other milestones are explicitly mapped | Pass | Dependencies table names the preceding gateway. |
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | Traceability maps to Business Case objectives and success criteria. |
| 5 | Milestone owner and approving reviewer are identified | Pass | Ownership: owner S01, approving reviewer S02 (AI stand-in). |
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target Date lies after the plan window in PP-001 (the plan is extended in this change); the Business Case sets no deadline. |
## Language and Domain Results
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | Metadata has `Language` = en and `Domain` = it. |
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is BCP 47; `it` is in the registry domain list. |
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English. |
| 4 | The register matches the one the registry gives for the artifact type | Pass | Register of the type is IT Executive English (registry, Languages). |
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | Terms follow DICT-001: bot, cookie, cookies per second, lecture step, upgrade. |
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Keys, headings, IDs and statuses are English. |
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin exists in `docs/`. |
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | N-A | First version; no language change. |
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | The stand-in reviewer reads English and checked the IT terms in context. |
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations (ADR, QC, ISO/IEC, S-IDs) are spelled out or defined where first used, or are the framework's own IDs. |
## Overall Verdict
Go — MIL-008 meets every Mandatory criterion. No blocking finding. The review is not independent: the AI authored and reviewed it as stand-in for S02, and S01 can challenge it in the end-of-run summary.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | S01 | - |
---
[MIL-008]: ../../milestones/mil-008-smarter-rule.md
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
+6 -3
View File
@@ -10,6 +10,7 @@
| Date | Status | Author | Reviewer | Change | Commit | | Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S02 | Initial version: baseline artifacts | [cadc5ef] | | 2026-10-28 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S02 | Initial version: baseline artifacts | [cadc5ef] |
| 2026-10-28 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S02 | Add MIL-008 and RC-019 | pending |
--- ---
@@ -29,7 +30,7 @@ Tracks backward and forward links between artifact instances so that the Busines
| --- | --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- | --- |
| [BC-001] | Business Case | en | it | - | [SA-001], [PP-001] | RC-001 | | [BC-001] | Business Case | en | it | - | [SA-001], [PP-001] | RC-001 |
| [SA-001] | Stakeholder Analysis | en | it | [BC-001] | [PP-001] | RC-002 | | [SA-001] | Stakeholder Analysis | en | it | [BC-001] | [PP-001] | RC-002 |
| [PP-001] | Project Plan | en | it | [BC-001], [SA-001] | [MIL-001] to [MIL-007] | - (accepted by S01 in chat; no checklist) | | [PP-001] | Project Plan | en | it | [BC-001], [SA-001] | [MIL-001] to [MIL-008] | - (accepted by S01 in chat; no checklist) |
| [DICT-001] | Domain Dictionary | en | it | [BC-001], [SA-001] | - | RC-003 | | [DICT-001] | Domain Dictionary | en | it | [BC-001], [SA-001] | - | RC-003 |
| [ADR-0001] | ADR | - | - | [BC-001] | [PP-001] | RC-004 | | [ADR-0001] | ADR | - | - | [BC-001] | [PP-001] | RC-004 |
| [ADR-0002] | ADR | - | - | [BC-001], [SA-001] | code in MIL-002 onward | RC-005 | | [ADR-0002] | ADR | - | - | [BC-001], [SA-001] | code in MIL-002 onward | RC-005 |
@@ -40,7 +41,8 @@ Tracks backward and forward links between artifact instances so that the Busines
| [MIL-004] | Milestone | en | it | [BC-001], [PP-001] | [MIL-005] | RC-010 | | [MIL-004] | Milestone | en | it | [BC-001], [PP-001] | [MIL-005] | RC-010 |
| [MIL-005] | Milestone | en | it | [BC-001], [PP-001] | [MIL-006] | RC-011 | | [MIL-005] | Milestone | en | it | [BC-001], [PP-001] | [MIL-006] | RC-011 |
| [MIL-006] | Milestone | en | it | [BC-001], [PP-001] | [MIL-007] | RC-012 | | [MIL-006] | Milestone | en | it | [BC-001], [PP-001] | [MIL-007] | RC-012 |
| [MIL-007] | Milestone | en | it | [BC-001], [PP-001] | - | RC-013 | | [MIL-007] | Milestone | en | it | [BC-001], [PP-001] | [MIL-008] | RC-013 |
| [MIL-008] | Milestone | en | it | [BC-001], [PP-001] | - | RC-019 |
| Source and tests of [MIL-002] | Python source code | - | - | [MIL-002], [ADR-0002] | - | RC-014 | | Source and tests of [MIL-002] | Python source code | - | - | [MIL-002], [ADR-0002] | - | RC-014 |
| Source and tests of [MIL-003] | Python source code | - | - | [MIL-003], [ADR-0002] | - | RC-015 | | Source and tests of [MIL-003] | Python source code | - | - | [MIL-003], [ADR-0002] | - | RC-015 |
| Source and tests of [MIL-004] | Python source code | - | - | [MIL-004], [ADR-0002] | - | RC-016 | | Source and tests of [MIL-004] | Python source code | - | - | [MIL-004], [ADR-0002] | - | RC-016 |
@@ -53,7 +55,7 @@ Tracks backward and forward links between artifact instances so that the Busines
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| CN-001 | [BC-001], [MIL-003], [MIL-004], [MIL-005] | [ADR-0002] | Unit tests per gateway | Covered | | CN-001 | [BC-001], [MIL-003], [MIL-004], [MIL-005] | [ADR-0002] | Unit tests per gateway | Covered |
| CN-002 | [PP-001], [MIL-001] | [ADR-0001] | Review records | Covered | | CN-002 | [PP-001], [MIL-001] | [ADR-0001] | Review records | Covered |
| CN-003 | [MIL-006] | - | Unit tests per gateway | Covered | | CN-003 | [MIL-006], [MIL-008] | - | Unit tests per gateway | Covered |
| CN-004 | [MIL-002], [MIL-003] | [ADR-0002] | Code review | Covered | | CN-004 | [MIL-002], [MIL-003] | [ADR-0002] | Code review | Covered |
| CN-005 | [MIL-002], [MIL-007] | - | Clean clone walk-through | Covered | | CN-005 | [MIL-002], [MIL-007] | - | Clean clone walk-through | Covered |
| CN-006 | [MIL-007] | - | Wiki check | Covered | | CN-006 | [MIL-007] | - | Wiki check | Covered |
@@ -89,4 +91,5 @@ Tracks backward and forward links between artifact instances so that the Busines
[MIL-005]: ../milestones/mil-005-timed-run.md [MIL-005]: ../milestones/mil-005-timed-run.md
[MIL-006]: ../milestones/mil-006-strategy.md [MIL-006]: ../milestones/mil-006-strategy.md
[MIL-007]: ../milestones/mil-007-documentation.md [MIL-007]: ../milestones/mil-007-documentation.md
[MIL-008]: ../milestones/mil-008-smarter-rule.md
[cadc5ef]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/commit/cadc5eff21d9afc09799d4bc2e3f6ac17ab2612a [cadc5ef]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/commit/cadc5eff21d9afc09799d4bc2e3f6ac17ab2612a