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

LOGO-L> Mastermind clues



Even though this should have been directed to only the person
who recently mentioned Mastermind, I thought it might generate
some discussion on the interpretation of the rules for clues
as well as on the form of the procedure.

to assign_clues :secret :guess
local "clues
make "clues "
for [peg 1 4] ~
  [ifelse (item :peg :secret) = (item :peg :guess) ~
    [make "clues word :clues "B] ~
    [if memberp (item :peg :secret) :guess ~
      [make "clues word :clues "W] ~
    ] ~
  ] ~
output :clues
end

(In the examples below, 'R' is red and '-' means
anything else that does not match and is of no
concern for the clues assigned.)


EXAMPLE:  1  |   2  |   3  |   4  |   5  |   6
-------------|------|------|------|------|------
 GUESS: R--- | ---R | --RR | ---R | R--- | R---
SECRET: R--- | R--- | R--- | RR-- | RR-- | RRRR
 CLUES: B    | W    | W    | WW   | BW   | BWWW
---------------------------------------------------------------
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