September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,19 @@
enum Baker, Cooper, Fletcher, Miller, Smith
constant names={"Baker","Cooper","Fletcher","Miller","Smith"}
procedure test(sequence flats)
if flats[Baker]!=5
and flats[Cooper]!=1
and not find(flats[Fletcher],{1,5})
and flats[Miller]>flats[Cooper]
and abs(flats[Smith]-flats[Fletcher])!=1
and abs(flats[Fletcher]-flats[Cooper])!=1 then
for i=1 to 5 do
?{names[i],flats[i]}
end for
end if
end procedure
for i=1 to factorial(5) do
test(permute(i,tagset(5)))
end for

View file

@ -0,0 +1,44 @@
sequence names = {"Baker","Cooper","Fletcher","Miller","Smith"},
rules = {{"!=","Baker",length(names)},
{"!=","Cooper",1},
{"!=","Fletcher",1},
{"!=","Fletcher",length(names)},
{">","Miller","Cooper"},
-- {"!=",{"abs","Smith","Fletcher"},1},
{"nadj","Smith","Fletcher"},
-- {"!=",{"abs","Fletcher","Cooper"},1},
{"nadj","Fletcher","Cooper"}}
function eval(sequence rule, sequence flats)
{string operand, object op1, object op2} = rule
if string(op1) then
op1 = flats[find(op1,names)]
-- elsif sequence(op1) then
-- op1 = eval(op1,flats)
end if
if string(op2) then
op2 = flats[find(op2,names)]
-- elsif sequence(op2) then
-- op2 = eval(op2,flats)
end if
switch operand do
case "!=": return op1!=op2
case ">": return op1>op2
-- case "abs": return abs(op1-op2)
case "nadj": return abs(op1-op2)!=1
end switch
return 9/0
end function
procedure test(sequence flats)
for i=1 to length(rules) do
if not eval(rules[i],flats) then return end if
end for
for i=1 to length(names) do
?{names[i],flats[i]}
end for
end procedure
for i=1 to factorial(length(names)) do
test(permute(i,tagset(length(names))))
end for