Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Zebra-puzzle/J/zebra-puzzle-1.j
Normal file
13
Task/Zebra-puzzle/J/zebra-puzzle-1.j
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
ehs=: 5$a:
|
||||
|
||||
cr=: (('English';'red') 0 3} ehs);<('Dane';'tea') 0 2}ehs
|
||||
cr=: cr, (('German';'Prince') 0 4}ehs);<('Swede';'dog') 0 1 }ehs
|
||||
|
||||
cs=: <('PallMall';'birds') 4 1}ehs
|
||||
cs=: cs, (('yellow';'Dunhill') 3 4}ehs);<('BlueMaster';'beer') 4 2}ehs
|
||||
|
||||
lof=: (('coffee';'green')2 3}ehs);<(<'white')3}ehs
|
||||
|
||||
next=: <((<'Blend') 4 }ehs);<(<'water')2}ehs
|
||||
next=: next,<((<'Blend') 4 }ehs);<(<'cats')1}ehs
|
||||
next=: next,<((<'Dunhill') 4}ehs);<(<'horse')1}ehs
|
||||
12
Task/Zebra-puzzle/J/zebra-puzzle-10.j
Normal file
12
Task/Zebra-puzzle/J/zebra-puzzle-10.j
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
houses solve3 constraints,<zebra
|
||||
┌─────────┬─────┬──────┬──────┬──────────┐
|
||||
│Norwegian│cats │water │yellow│Dunhill │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│Dane │horse│tea │blue │Blend │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│English │birds│milk │red │PallMall │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│German │zebra│coffee│green │Prince │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│Swede │dog │beer │white │BlueMaster│
|
||||
└─────────┴─────┴──────┴──────┴──────────┘
|
||||
6
Task/Zebra-puzzle/J/zebra-puzzle-2.j
Normal file
6
Task/Zebra-puzzle/J/zebra-puzzle-2.j
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
lof
|
||||
┌─────────────────┬───────────┐
|
||||
│┌┬┬──────┬─────┬┐│┌┬┬┬─────┬┐│
|
||||
││││coffee│green│││││││white│││
|
||||
│└┴┴──────┴─────┴┘│└┴┴┴─────┴┘│
|
||||
└─────────────────┴───────────┘
|
||||
4
Task/Zebra-puzzle/J/zebra-puzzle-3.j
Normal file
4
Task/Zebra-puzzle/J/zebra-puzzle-3.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
hcr=: (<ehs),. (A.~i.@!@#)cr
|
||||
hcs=:~. (A.~i.@!@#)cs,2$<ehs
|
||||
hlof=:(-i.4) |."0 1 lof,3$<ehs
|
||||
hnext=: ,/((i.4) |."0 1 (3$<ehs)&,)"1 ;(,,:|.)&.> next
|
||||
1
Task/Zebra-puzzle/J/zebra-puzzle-4.j
Normal file
1
Task/Zebra-puzzle/J/zebra-puzzle-4.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
houses=: ((<'Norwegian') 0}ehs);((<'blue') 3 }ehs);((<'milk') 2}ehs);ehs;<ehs
|
||||
6
Task/Zebra-puzzle/J/zebra-puzzle-5.j
Normal file
6
Task/Zebra-puzzle/J/zebra-puzzle-5.j
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
houses
|
||||
┌───────────────┬──────────┬──────────┬──────┬──────┐
|
||||
│┌─────────┬┬┬┬┐│┌┬┬┬────┬┐│┌┬┬────┬┬┐│┌┬┬┬┬┐│┌┬┬┬┬┐│
|
||||
││Norwegian││││││││││blue││││││milk││││││││││││││││││
|
||||
│└─────────┴┴┴┴┘│└┴┴┴────┴┘│└┴┴────┴┴┘│└┴┴┴┴┘│└┴┴┴┴┘│
|
||||
└───────────────┴──────────┴──────────┴──────┴──────┘
|
||||
1
Task/Zebra-puzzle/J/zebra-puzzle-6.j
Normal file
1
Task/Zebra-puzzle/J/zebra-puzzle-6.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
constraints=: hcr;hcs;hlof;<hnext
|
||||
11
Task/Zebra-puzzle/J/zebra-puzzle-7.j
Normal file
11
Task/Zebra-puzzle/J/zebra-puzzle-7.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
select=: ~.@(,: #~ ,&(0~:#))
|
||||
filter=: #~*./@:(2>#S:0)"1
|
||||
compose=: [: filter f. [: ,/ select f. L:0"1"1 _
|
||||
|
||||
solve=: 4 :0
|
||||
h=. ,:x
|
||||
whilst. 0=# z do.
|
||||
for_e. y do. h=. h compose > e end.
|
||||
z=.(#~1=[:+/"1 (0=#)S:0"1) h=.~. h
|
||||
end.
|
||||
)
|
||||
12
Task/Zebra-puzzle/J/zebra-puzzle-8.j
Normal file
12
Task/Zebra-puzzle/J/zebra-puzzle-8.j
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
>"0 houses solve constraints
|
||||
┌─────────┬─────┬──────┬──────┬──────────┐
|
||||
│Norwegian│cats │water │yellow│Dunhill │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│Dane │horse│tea │blue │Blend │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│English │birds│milk │red │PallMall │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│German │ │coffee│green │Prince │
|
||||
├─────────┼─────┼──────┼──────┼──────────┤
|
||||
│Swede │dog │beer │white │BlueMaster│
|
||||
└─────────┴─────┴──────┴──────┴──────────┘
|
||||
8
Task/Zebra-puzzle/J/zebra-puzzle-9.j
Normal file
8
Task/Zebra-puzzle/J/zebra-puzzle-9.j
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
zebra=: (-i.5)|."0 1 (<(<'zebra') 1}ehs),4$<ehs
|
||||
|
||||
solve3=: 4 :0
|
||||
p=. *./@:((0~:#)S:0)
|
||||
f=. [:~.&.> [: compose&.>~/y&, f.
|
||||
z=. f^:(3>[:#(#~p"1)&>)^:_ <,:x
|
||||
>"0 (#~([:*./[:;[:<@({.~:}.)\.;)"1)(#~p"1); z
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue