Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,69 +1,61 @@
len t[] 12
func f n .
if n = 1
return if 12 = 12
elif n = 2
for i = 7 to 12
s += t[i]
.
return if s = 3
elif n = 3
for i = 2 step 2 to 12
s += t[i]
.
return if s = 2
elif n = 4
if t[5] = 1
return if t[6] + t[7] = 2
.
return 1
elif n = 5
for i = 2 to 4
s += t[i]
.
return if s = 0
elif n = 6
for i = 1 step 2 to 11
s += t[i]
.
return if s = 4
elif n = 7
return if t[2] + t[3] = 1
elif n = 8
if t[7] = 1
return if t[5] + t[6] = 2
.
return 1
elif n = 9
for i = 1 to 6
s += t[i]
.
return if s = 3
elif n = 10
return if t[11] + t[12] = 2
elif n = 11
for i = 7 to 9
s += t[i]
.
return if s = 1
elif n = 12
for i = 1 to 11
s += t[i]
.
return if s = 4
func check t[] .
len r[] 12
r[1] = if 12 = 12
s = 0
for i = 7 to 12
s += t[i]
.
r[2] = if s = 3
s = 0
for i = 2 step 2 to 12
s += t[i]
.
r[3] = if s = 2
r[4] = 1
if t[5] = 1
r[4] = if t[6] + t[7] = 2
.
s = 0
for i = 2 to 4
s += t[i]
.
r[5] = if s = 0
s = 0
for i = 1 step 2 to 11
s += t[i]
.
r[6] = if s = 4
r[7] = if t[2] + t[3] = 1
r[8] = 1
if t[7] = 1
r[8] = if t[5] + t[6] = 2
.
s = 0
for i = 1 to 6
s += t[i]
.
r[9] = if s = 3
r[10] = if t[11] + t[12] = 2
s = 0
for i = 7 to 9
s += t[i]
.
r[11] = if s = 1
s = 0
for i = 1 to 11
s += t[i]
.
r[12] = if s = 4
return if r[] = t[]
.
len t[] 12
for tst = 0 to 4095
h = tst
for i to 12
t[i] = h mod 2
h = h div 2
.
s = 0
for i to 12
s += if f i = t[i]
.
if s = 12
if check t[] = 1
print t[]
.
.

View file

@ -1,28 +1,26 @@
Even ← =1◿2⇡⧻ # nb indexes are zero-based
SA ← =12⧻ # Total is always twelve (don't test)
SB ← =3⧻⊚↘6 # Three of last six are true
SC ← =2⧻⊚⊏⊚Even. # Exactly two 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
SF ← =4⧻⊚⊏⊚¬Even. # Four odd rules are true
SG ← =1/+↙2↘1 # 2 xor 3
SH ← ⟨1◌|/×⟩⊢.⇌↙3↘4 # If 7 is true so are 6 and 5
SI ← =3⧻⊚↙6 # Three of first six are true
SJ ← /×⊏[10 11] # 11 and 12 are both true
SK ← =1/+⊏[6 7 8] # Exactly one of 7, 8, 9 is true
SL ← =4/+↘¯1 # Exactly four of above are true
Even ← =1◿2⇡⧻ # nb indexes are zero-based
S₁ ← =12⧻ # Total is always twelve (don't test)
S₂ ← =3⧻⊚↘6 # Three of last six are true
S₃ ← =2⧻⊚⊏⊚Even. # Exactly two even rules are true
S₄ ← ⨬(⋅1|/↧)⊢.⊏4_5_6 # If 5 is true so must 6 and 7 be.
S₅ ← /↧¬⊏[1 2 3] # 2, 3, 4 are all false
S₆ ← =4⧻⊚⊏⊚¬Even. # Four odd rules are true
S₇ ← =1/+⊏1_2 # 2 xor 3
S₈ ← ⨬(⋅1|/↧)⊢.⇌⊏4_5_6 # If 7 is true so are 6 and 5
S₉ ← =3⧻⊚↙6 # Three of first six are true
S₁₀ ← /↧⊏10_11 # 11 and 12 are both true
S₁₁ ← =1/+⊏6_7_8 # Exactly one of 7, 8, 9 is true
S₁₂ ← =4/+↘¯1 # Exactly four of above are true
⋯+1×2⇡2048 # Brute force sensible combinations
⋯+1×2⇡2048 # Generate bits to represent all states of rules 2-12
≡(
# Test each rule against the data and concatenate
:[⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃⊃SA SB SC SD SE SF SG SH SI SJ SK SL].
⟜[⊃(S₁|S₂|S₃|S₄|S₅|S₆|S₇|S₈|S₉|S₁₀|S₁₁|S₁₂)]
⊟∩□:⊙(⊚⌵-). # Append hit-count
)
# Partition by fit, keep only hits and near-misses
°⊟↙2⊕□≡(◇⧻⊢).
# Print results
&p"\nNear Misses"&s+1◇⊚⊢↘1◇⊢&p"Hits"
°⊟↙2⊕□≡(◇⧻⊢). # Partition by fit, keep only hits and near-misses
&p$"Succeeds when the following rules are true:\n_\n"+1◇⊚⊢↘1◇⊢
⊏⍏≡⊢.°□ # Sort misses
≡(⊃(&p+1⊚°□⊢↘1)(&pf"\t"&pf+1◇⊢⊢&pf"Fails at "))
&p"Near Misses:"
≡(&p$"Fails at _\t _"⊃(+1◇⊢⊢|+1⊚°□⊢↘1))