Hello everybody,
I'm intruding on your recursion discussion with very different problem.
I haven't seen this kind of problems there, but may be somebody is
interested, or has had an experience in solving them.
The problem is from a "logical field".
For example let's formulate it as follows.
Three experts are having discussion about an ancient cup.
Expert A: This is a China cup from the 5th century,
Expert B: This is a Japan cup from the third century,
Expert C: This is not a China cup, it was made in the 4th century.
It turned out, only one of two statements of each expert was right, the
other was wrong.
What country and what century does the cup belong?
----------------
I think, the main idea of the solution is standart.
Le's denote with C the statement "the cup is from China",
J - "from Japan",
T - "it was made in the third century",
F - " in the 4th century",
V - " in the 5th century".
We should find such boolean values of C J T F V, which make the
following statements "true":
or (and C not V)(and not C V)
or (and J not T)(and not J T)
or (and not not C F)(and not C not F)
Also:
not and T F
not and T V
not and F V
not and C J.
The solutions that I've seen, all use looking over(?) all the possible
combinations of values of C, J, T, F, V. It doesn't look great. I tried
to present these combination as a binary code (binary representation of
the number from 0 through 31), but not sure it improves the solution
much.
Would be greatful for any ideas and suggestions. Also, does anybody work
on such problems this way or other with the school children?
The solution presented below, says, that the cup was from Japan and was
made in the 5th century.
Thanks,
Olga.
---------------------------------
to logic.main
for [i 0 31][if (and bool1 c :i v :i ~
bool1 j :i t :i ~
bool2 c :i f :i ~
bool3 c :i j :i ~
bool3 t :i f :i ~
bool3 t :i v :i ~
bool3 f :i v :i)~
[(pr c :i j :i t :i f :i v :i)]]
end
to c :i
op int :i/16
end
to j :i
op remainder int :i/8 2
end
to t :i
op remainder int :i/4 2
end
to f :i
op remainder int :i/2 2
end
to v :i
op remainder :i 2
end
to bool1 :c :v
output or (and l :c not l :v) (and l :v not l :c)
end
to bool2 :c :f
output or (and not not l :c l :f)(and not l :c not l :f)
end
to bool3 :c :j
output not and l :c l :j
end
to l :a
ifelse :a=1 [op "true][op "false]
end
-------------------------------
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home