Add matrix module: addition, multiplication, transpose, spiral and rotation programs, dry-run traces, operation counts, seeded law checks, six pitfalls (10 tests)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4pD5LRLNWAecBNsj9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
26ece9cc9b
commit
35ef0872de
@@ -0,0 +1,42 @@
|
||||
Rotation
|
||||
========
|
||||
|
||||
original 3x3
|
||||
[1 2 3]
|
||||
[4 5 6]
|
||||
[7 8 9]
|
||||
|
||||
rotateClockwise
|
||||
[7 4 1]
|
||||
[8 5 2]
|
||||
[9 6 3]
|
||||
|
||||
rotateCounterClockwise
|
||||
[3 6 9]
|
||||
[2 5 8]
|
||||
[1 4 7]
|
||||
|
||||
rotate180
|
||||
[9 8 7]
|
||||
[6 5 4]
|
||||
[3 2 1]
|
||||
|
||||
rotateClockwiseInPlace (transpose, then reverse each row)
|
||||
[7 4 1]
|
||||
[8 5 2]
|
||||
[9 6 3]
|
||||
|
||||
rotateClockwiseLayers (four-cell moves)
|
||||
[7 4 1]
|
||||
[8 5 2]
|
||||
[9 6 3]
|
||||
|
||||
both in-place versions equal rotateClockwise: true
|
||||
|
||||
rectangular 2x3 rotated clockwise becomes 3x2 (in-place is impossible: the shape changes)
|
||||
[1 2 3]
|
||||
[4 5 6]
|
||||
->
|
||||
[4 1]
|
||||
[5 2]
|
||||
[6 3]
|
||||
Reference in New Issue
Block a user