Twelve statements: Difference between revisions

Content added Content deleted
m (→‎{{header|Uiua}}: improved algorithm)
m (→‎{{header|Uiua}}: final fix :-))
 
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 (always true)
SA ← =12⧻ # Total is always twelve (don't test)
SB ← =3⧻⊚↘6 # Three of last six are true
SB ← =3⧻⊚↘6 # Three of last six are true
SC ← =2⧻⊚⊏⊚Even. # Exactly two even rules are true
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
SF ← =4⧻⊚⊏⊚¬Even. # Four odd rules are true
SF ← =4⧻⊚⊏⊚¬Even. # Four odd rules are true
SG ← =1/+↙2↘1 # 2 xor 3
SG ← =1/+↙2↘1 # 2 xor 3
SH ← ⟨1◌|/×⟩⊢.⇌↙3↻4 # If 7 is true so are 6 and 5
SH ← ⟨1◌|/×⟩⊢.⇌↙3↘4 # If 7 is true so are 6 and 5
SI ← =3⧻⊚↙6 # Three of first six are true
SI ← =3⧻⊚↙6 # Three of first six are true
SJ ← /×⊏[10 11] # 11 and 12 are both true
SJ ← /×⊏[10 11] # 11 and 12 are both true
Line 4,137: Line 4,137:
⋯+1×2⇡2048 # Brute force sensible combinations
⋯+1×2⇡2048 # Brute force sensible combinations
≡(
≡(
# Test each rule against the data and concatenate
[⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃SA SB SC SD SE SF SG SH SI SJ SK SL].
:[⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃SA SB SC SD SE SF SG SH SI SJ SK SL].
⊟∩□:⊙(⊚⌵-). # Append hit-count
⊟∩□:⊙(⊚⌵-). # Append hit-count
)
)