Bulls and cows
Arturo
<lang rebol>rand: first.n: 4 unique map 1..10 => [sample 0..9] bulls: 0
while [bulls <> 4][
bulls: new 0
cows: new 0
got: strip input "make a guess: " if? or? not? numeric? got 4 <> size got -> print "Malformed answer. Try again!" else [ loop.with:'i split got 'digit [ if? (to :integer digit) = rand \ i -> inc 'bulls else [ if contains? rand to :integer digit -> inc 'cows ] ] print ["Bulls:" bulls "Cows:" cows "\n"] ]
] print color.green "** Well done! You made the right guess!!"</lang>