Twelve statements: Difference between revisions
Content added Content deleted
m (→{{header|Uiua}}: minor fix) |
m (→{{header|Uiua}}: improved algorithm) |
||
Line 4,122: | Line 4,122: | ||
<syntaxhighlight lang="Uiua"> |
<syntaxhighlight lang="Uiua"> |
||
Even ← =1◿2⇡⧻ # nb indexes are zero-based |
Even ← =1◿2⇡⧻ # nb indexes are zero-based |
||
SA ← =12⧻ # Total is twelve |
SA ← =12⧻ # Total is twelve (always true) |
||
SB ← =3⧻⊚↘6 # Three of last six are true |
SB ← =3⧻⊚↘6 # Three of last six are true |
||
SC ← =2⧻⊚⊏⊚Even. # Exactly |
SC ← =2⧻⊚⊏⊚Even. # Exactly two even rules are true |
||
SD ← ⟨1◌|/×⟩⊢.↙3↻4 # If 5 is true so are 6 and 7 |
SD ← ⟨1◌|/×⟩⊢.↙3↻4 # If 5 is true so are 6 and 7 |
||
SE ← /׬⊏[1 2 3] # 2, 3, 4 are all false |
SE ← /׬⊏[1 2 3] # 2, 3, 4 are all false |
||
Line 4,135: | Line 4,135: | ||
SL ← =4/+↘¯1 # Exactly four of above are true |
SL ← =4/+↘¯1 # Exactly four of above are true |
||
⚫ | |||
≡( |
≡( |
||
[⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃SA SB SC SD SE SF SG SH SI SJ SK SL]. |
|||
# Test each rule against the data and concatenate |
|||
⊙⊂⟜SG⊙⊂⟜SH⊙⊂⟜SI⊙⊂⟜SJ⊙⊂⟜SK⟜SL |
|||
⊙⊂⟜SA⊙⊂⟜SB⊙⊂⟜SC⊙⊂⟜SD⊙⊂⟜SE⊙⊂⟜SF |
|||
⊟∩□:⊙(⊚⌵-). # Append hit-count |
⊟∩□:⊙(⊚⌵-). # Append hit-count |
||
) |
|||
⚫ | |||
# Partition by fit, keep only hits and near-misses |
# Partition by fit, keep only hits and near-misses |