Twelve statements: Difference between revisions

m
→‎{{header|Uiua}}: improved algorithm
m (→‎{{header|Uiua}}: minor fix)
m (→‎{{header|Uiua}}: improved algorithm)
Line 4,122:
<syntaxhighlight lang="Uiua">
Even ← =1◿2⇡⧻ # nb indexes are zero-based
SA ← =12⧻ # Total is twelve (always true)
SB ← =3⧻⊚↘6 # Three of last six are true
SC ← =2⧻⊚⊏⊚Even. # Exactly 2two even rules are true
SD ← ⟨1◌|/×⟩⊢.↙3↻4 # If 5 is true so are 6 and 7
SE ← /׬⊏[1 2 3] # 2, 3, 4 are all false
Line 4,135:
SL ← =4/+↘¯1 # Exactly four of above are true
 
)⋯+1×2⇡2048 # Brute force sensible combinations
≡(
[⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃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
)
)⋯+1×2⇡2048 # Brute force sensible combinations
 
# Partition by fit, keep only hits and near-misses
66

edits