Repository navigation
R50-T005: Make verification repeatable for newGeneration (ConwaysGameOfLife.js) [Cellular-Automata/ConwaysGameOfLife.js] - #103
Open
stavansomaiya wants to merge 1 commit into
Conversation
… newGeneration (R50-T005) Fixes: S-AI-Projects#5
This was referenced Nov 23, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
e26b07f1064Cellular-Automata/ConwaysGameOfLife.js→newGeneration(line 14 at the pinned commit, line 24 after this PR)5c39e87·ConwaysGameOfLife.js#L14stavansomaiya:student/e26b07f1064/R50-T005→S-AI-Projects:master(one commit on5c39e87)Summary
newGenerationinCellular-Automata/ConwaysGameOfLife.jsis already pure: no time, randomness, I/O, network, UI or module state. So no dependency seam was introduced, and therefore no new parameter that would need a default. Instead this adds repeatability and input-isolation regression tests and documents the contract.Files changed
Cellular-Automata/ConwaysGameOfLife.jsCellular-Automata/test/ConwaysGameOfLife.test.jswork/R50-T005/(8 files)check.pyrunner,README.mdwrite-up,evidence.mjs,results.jsonand logs; coursework only, kept out of any upstream PRRelated Issue
Fixes: #5
This PR covers only R50-T005. Each of the 10 tasks has its own branch, commit and PR; see All 10 tasks under Additional Notes.
Type of Change
Changes Made
Cellular-Automata/test/ConwaysGameOfLife.test.js: covers:[]→[]and[[1]]→[[0]];Cellular-Automata/ConwaysGameOfLife.js: JSDoc stating determinism, no external dependencies, no mutation, non-wrapping edges, and the params and return value. No logic change.work/R50-T005/:check.pyandevidence.mjs, which also scans the real source (comments removed) for time, randomness, I/O, globals, imports and module-level variables and finds none. Plus results.Screenshots / Recordings
There is no UI, so the recording is the terminal output of a fresh run on 23 Nov 2026. The run used a clean checkout of this branch with a new
npm cifrom the lockfile. The output is copied verbatim; only the temporary checkout path is replaced by a label.Focused tests:
npx vitest run … --reporter=verbose, 9/9 passedAutomated check:
python3 work/R50-T005/check.py, exit 0Testing
Automated check:
python3 work/R50-T005/check.pyinstalls from the lockfile and runs the focused tests. It then prints input / expected / actual for every fixture row, runs each deliberate mutant in a temporary copy, and finally runs the repository test script in non-watch mode. It exits non-zero if any assertion or step fails, and records every command incommands.log.To reproduce:
Recorded results (committed in
results.json; tool versions inversions.txt):npm ci --ignore-scripts --no-audit --no-fundvitest run Cellular-Automata/test/ConwaysGameOfLife.test.jsnode work/R50-T005/evidence.mjscheck.pydoes not modify the input gridnpm test(vitest run)npm run check-style(Prettier)codespellAcceptance criteria → evidence:
newGenerationin Cellular-Automata/ConwaysGameOfLife.js; every assertion has an explicit expected value.[],[[0]], the hand-computed 5×5 glider step and[[1, 1], [1, 1]].newGenerationfrom Cellular-Automata/ConwaysGameOfLife.js. Write the literal inputs and independently calculated expected outputs in the tests before editing the implementation. The check must name the source line establishing each precondition.[]→[](and[[1]]→[[0]]). Ordinary: one glider step, worked out cell by cell from rules 1–3 (lines 4–6). Preconditions cite source lines: new arrays at lines 25 and 27, input only read at line 43, result returned at line 53.same input twice in fresh state gives the same resultandan earlier call with another input cannot change a later result.evidence.mjsscans the real source and finds no time, randomness, I/O, global or import dependency.Evidence files:
check.py·README.md(contract, fixture, baseline, findings) ·evidence.mjs·results.json·vitest-focused.jsonChecklist
Additional Notes
All checks run in plain Node/Vitest, with no network, user account or GUI. Sensitivity check: a temporary copy that writes the computed state back into
cellsfailsdoes not modify the input grid. Negative control for the dependency scan: addingMath.random()to a copy makes the scan report["Math"].Scope: the PR changes only
Cellular-Automata/ConwaysGameOfLife.js, its test file andwork/R50-T005/.work/R50-T005/is coursework evidence and would be removed from any later upstream PR.All 10 tasks (one PR each)
R50-T001R50-T002R50-T003R50-T004R50-T005R50-T006R50-T007R50-T008R50-T009R50-T010