three-in-a-row.bytetable
· 796 B · Text
Brut
Playground
% search for 3 matching columns
------------
% if we've reach the end of our spread sheet
% end our search in failure
[* 1 2]
[1 x 1]
[* 1 2 3]
[x -1 -1 -1]
------------
[* 1 2 3]
[1 x 0 0]
[* 1 2 3]
[x -1 -1 -1]
------------
% if we've found a matching triple
% end our search in success
[* 1 2]
[1 x 1]
[* 1 2 3]
[x a a a]
------------
[* 1 2 3]
[1 x 0 1]
[* 1 2 3]
[x a a a]
------------
% keep skimming down the table until
% we run out of data to test
[* 1 2]
[1 x 1]
[* 1 2 3]
[x a b c]
------------
[* 1 2]
[1 (x + 1) 1]
[* 1 2 3]
[x a b c]
============
% Seed our state
[* 1 2 3]
[1 0 1 0]
[. 1 2 3]
[. 1 3 1]
[. 1 3 2]
[. 1 3 3]
[. 2 1 1]
[. 2 1 2]
[. 2 1 3]
[. 2 2 1]
[. 2 2 2]
[. 2 2 3]
[. 2 3 1]
[. 2 3 2]
[. -1 -1 -1]
| 1 | % search for 3 matching columns |
| 2 | |
| 3 | ------------ |
| 4 | % if we've reach the end of our spread sheet |
| 5 | % end our search in failure |
| 6 | [* 1 2] |
| 7 | [1 x 1] |
| 8 | [* 1 2 3] |
| 9 | [x -1 -1 -1] |
| 10 | ------------ |
| 11 | [* 1 2 3] |
| 12 | [1 x 0 0] |
| 13 | [* 1 2 3] |
| 14 | [x -1 -1 -1] |
| 15 | |
| 16 | ------------ |
| 17 | % if we've found a matching triple |
| 18 | % end our search in success |
| 19 | [* 1 2] |
| 20 | [1 x 1] |
| 21 | [* 1 2 3] |
| 22 | [x a a a] |
| 23 | ------------ |
| 24 | [* 1 2 3] |
| 25 | [1 x 0 1] |
| 26 | [* 1 2 3] |
| 27 | [x a a a] |
| 28 | |
| 29 | ------------ |
| 30 | % keep skimming down the table until |
| 31 | % we run out of data to test |
| 32 | [* 1 2] |
| 33 | [1 x 1] |
| 34 | [* 1 2 3] |
| 35 | [x a b c] |
| 36 | ------------ |
| 37 | [* 1 2] |
| 38 | [1 (x + 1) 1] |
| 39 | [* 1 2 3] |
| 40 | [x a b c] |
| 41 | |
| 42 | ============ |
| 43 | % Seed our state |
| 44 | [* 1 2 3] |
| 45 | [1 0 1 0] |
| 46 | [. 1 2 3] |
| 47 | [. 1 3 1] |
| 48 | [. 1 3 2] |
| 49 | [. 1 3 3] |
| 50 | [. 2 1 1] |
| 51 | [. 2 1 2] |
| 52 | [. 2 1 3] |
| 53 | [. 2 2 1] |
| 54 | [. 2 2 2] |
| 55 | [. 2 2 3] |
| 56 | [. 2 3 1] |
| 57 | [. 2 3 2] |
| 58 | [. -1 -1 -1] |