Talk:Bulls and cows/Player: Difference between revisions
Content added Content deleted
m (→Python ramblings: 3024) |
Underscore (talk | contribs) m (moved Talk:Bulls and cows game/Player to Talk:Bulls and cows/Player: To make it a subpage of "Bulls and cows".) |
||
(One intermediate revision by one other user not shown) | |||
Line 9:
# Repeat from 2.
If I get all bulls then I win. If there are no more choices then the scores must be inconsistent.<br> --[[User:Paddy3118|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. –[[User:Dkf|Donal Fellows]] 08:43, 14 June 2010 (UTC)
|
Latest revision as of 14:04, 17 June 2010
Python ramblings
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,
- I generate the 3024 possible initial choices (and randomly shuffle them).
- Select the first choice as my next answer,
- Then get its score.
- 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.
- 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)