[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: : Re: LOGO-L> Logical Puzzle



> To:            logo-l@gsn.org
> Date:          Sun, 18 Jan 1998 23:38:34 -0700
> From:          "Dreyfuss Pierre-Andre" <p.a.dreyfuss@mailexcite.com>
> Cc:            olgatu@hotmail.com
> Subject:       : Re: LOGO-L> Logical Puzzle 
> Organization:  MailExcite  (http://www.mailexcite.com)
> Reply-to:      "Dreyfuss Pierre-Andre" <p.a.dreyfuss@mailexcite.com>

Thank  Erich Neuwirth and Pierre-Andre  for introducing me to such an 
interesting approach to logic puzzle solving. Especially I like the 
one-line solution:
 print filter[memberp ? :experta]filter[memberp ? :expertb] :expertc

(BTW, Pierre-Andre, there was a minor typo in this line. It was 
obvious, I just want to show, I investigated the message carefully. 
:-))

And, I find it suitable for educational aims, that for this solution 
half of the work should be done in the student's head. But, for this 
approach I should introduce students to maps and filters. I'm not 
sure, it's trivial. At least, I have had no experience of that kind 
by far. I think, the most difficult part of it might be templates. By 
now I have no ideas how it could be done on the "school level". Any 
suggestions?

Regards,
Olga.

>               Hello Olga,
> 
> Here is a solution that is not too difficult for your pupils.
> 
> The basic I Idea is that we can build a set of affirmations that could be true for
> each expert.
> 
> Each affirmation is a list of country century
> Expert A :[ China 4] [China 3] [Japan 5]
> 
> Expert B :  [ Japan 4] [Japan 5] [China 3]
> 
> Expert C :(changing not China into  Japan)
> 
>             [Japan 3] [Japan 5] [China 4]
> 
> make "experta [[China 4] [China 3] [Japan 5]]
> make "expertb [[Japan 4] [Japan 5] [China 3]]
> make "expertc [[Japan 3] [Japan 5] [China 4]]
> 
> Now the problem is to find which affirmation is the same for all experts.
> 
> It is the intersection of the three lists.
> 
> The library primitive FILTER does the job.
> 
> print filter[memberp ? :experta]filter[memberp ? :expertb] :experta Will give the
> solution. [Japan 5] 
> 
> If you want the computer to build the affirmations then use the procedure assert
> below.
> 
> to  assert :name :cupexp :centuryexp
>  make :name  ~
>  se map  [list :cupexp  ? ] ~
>  filter [not ? = :centuryexp] :century ~
>  map  [list ? :centuryexp] ~
>  filter [not ? = :cupexp] :cup 
> end
> 
> to solution
>   local "expa
>   local "expb
>   local "expc
> 
>   assert "expa "china 5
>   assert "expb "japan 3
>   assert "expc "japan 4
>   print  filter [memberp ? :expa] ~
>   filter [memberp ? :expb] :expc
> end
> 
> You can disgard the local declarations.
> 
> Sincerly,
> Pierre-AndrÊ Dreyfuss
> Olga wrote .
> >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
> >-------------------------------
---------------------------------------------------------------
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