I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

Talk:Bulls and cows/Player

From Rosetta Code

Python ramblings[edit]

When I wrote the original scorer task Bulls and cows I vaguely remembered that I had written a player before, in a dialect of basic, probably in the late, late eighties. Well, I was ignoring what I was supposed to be doing this weekend and just started doodling a solution and it seemed to gel.

With possible answers being restricted to a selection of four digits from the nine,

  1. I generate the 3024 possible initial choices (and randomly shuffle them).
  2. Select the first choice as my next answer,
  3. Then get its score.
  4. Next, whittle down the possible choices by removing from the choices any choice where if it where the true answer, it would not give the score I had just received.
  5. Repeat from 2.

If I get all bulls then I win. If there are no more choices then the scores must be inconsistent.
--Paddy3118 02:46, 14 June 2010 (UTC)

My conversion of that code (for the Tcl version) does one key thing differently; instead of shuffling the values it picks a random one. Simpler to implement. –Donal Fellows 08:43, 14 June 2010 (UTC)