# Talk:Bulls and cows

## Scoring

The scoring algorithm gets more interesting if duplicate digits are permitted... —Dkf 09:54, 20 May 2009 (UTC)

You might try first checking for Bulls, and 'crossing-out' any found, then checking for cows in the remainder? (But the increased complexity in interpreting the score might make the game worse to play). --Paddy3118 20:09, 20 May 2009 (UTC)
My understanding is that Bulls and Cows traditionally disallows repeated digits. However, the similar commercial board game Mastermind does allow duplicates. The way scoring works there, you get credit for at most one bull (black peg) or cow (white peg) per digit in the solution (not in the guess). So if the code is 1122 and you guess 1112, you get three bulls (for the first two 1's and the 2), but no cow for the third 1, because both 1's in the code are already accounted for. -- Markjreed 03:53, 29 January 2012 (UTC)
This is the methodology that the REXX program (version 1) uses. -- Gerard Schildberger 22:53, 4 July 2012 (UTC)

## Form of target number

The description says that the digits must be from the set 1 through 9, but Wikipedia - and some of the solutions on this page - allow zeroes. Also, the description should probably specify whether or not repeated digits are allowed. -- Markjreed 00:20, 31 January 2012 (UTC)

## malformed numbers

The task didn't elaborate on what a malformed guess was, but when I programmed a version (cough-cough, 31 years ago), the user was allowed to guess such things as:

• 12x5
• ..73
• 4 5 7 9
• 7 , , 4
• 42?9

Very inexperience beginners (and most children, see below) begin learning the logic of the game by guessing:

• 1111
• 2222
• 3333
• 5
• 79

until they've found four digits that are in the number, and then narrow it down with their own perculiar logic.

The (original) program was intentionlly written to allow these forms of guesses and reasoning (logic). It was a goal of the program to not to force any sort of logic or restrictive rules upon the guesser. If the guesser could think it, it was allowed.

I added program logic to the REXX (version 1) program, if only to comply to what malformed could mean.

(I've since rescinded those restrictions.) -- Gerard Schildberger 14:16, 5 July 2012 (UTC)

The original program also allowed any number of digits, and also allowed specification of what digits, so that it could mimic the game Master Mind, a popular game of that time. This was the default mode.

A comment on the program's pegigree: quite a few of the supervisors (where I worked at way back then) were allowed to have a (CRT) terminal at home (for working after hours of course, of course), and as a result, their kids could get on-line and play, which back then, it was quite a treat to play on a computer, and this was before home computers were common. Even at that, home computers were NOT cheap. Of course, it was against the company rules to use a company's mainframe computer for such non-business thingys, but almost all the mainframe computers much very much idle after-hours and on weekends, of course. When asked by my 2nd level supervisor, I glady wrote some games on my own time in EXEC2, a language on the VM/CMS system. And who wanted to throw rocks at one's own bosses? -- Gerard Schildberger 23:35, 4 July 2012 (UTC)

(added parenthesized comments and mainframe words to clarify what kind of computer(s) I was referring to.) -- Gerard Schildberger 14:21, 5 July 2012 (UTC)
Hmm. Thanks for the info on the variants where you introduce a placeholder not-a-number symbol. I guess it cannot match anything and would serve to reduce complexity when someone wants to test what they think they may know about a partial solution?
If I were playing with more digits then I guess it would allow me to reduce the problem to something I could work out in my head. --Paddy3118 03:00, 5 July 2012 (UTC)
Yes, anything not a digit (in this case) doesn't match anything. It's very helpful when your mind is a bit cloudy (like enjoying some down-time after an eighteen hour coding tear), or maybe you're dealing with a "bulls and cows" game variant with more than four digits. Also, kids like to use a NaN guess as they seem to prefer to deal with a smaller subset of logic. Well, ok, ok, so do I at times. I was playing a few games as I always check out the game after I make a change (or an improvement, ha!), and once, I just couldn't find a solution (I had zigged instead of zagged when coding a change), and the "cows" information was wrong. I had to ignore the cows and try only for the bulls. -- Gerard Schildberger 03:12, 5 July 2012 (UTC)
Does anybody besides me think that was a weird thing to say? -- Gerard Schildberger 14:16, 5 July 2012 (UTC)

Note: the above section was re-added and slightly re-formated as I had to retrieve it with cut and paste from my E-mail reader via Rosetta Code's notification of changes. I left the original timestamps intact. All the original line-ends (newLines) [if any] have been lost. -- Gerard Schildberger 14:16, 5 July 2012 (UTC)

## javascript

Used a javascript editor to copy/paste the code but got a missing semicolon error in function pickNum.

## REXX version 2

In the REXX version 2 program comments (quoting changes from version 1), it's mentioned that a ? (question mark) is not everywhere a valid symbol for REXX.

For what version(s) of (any/a) REXX interpreter (or compiler) isn't the questin mark a valid symbol?

The statement of rightHandSide is mandatory isn't strictly true for any classic REXX interpreter that I use, but it may be true for some of the object-orientated REXXes (ooRexx, NetRexx, and ROO [or ROO!]). If that statement was true, then a majority of REXXes would need changing, the least of which are the REXXes that executed version 1.

It's implied that the S subroutine doesn't work for all plurals. Is there any way it could fail (as coded) for the REXX program version 1? If not, I'd like the offending statement retracted. The S subroutine was only meant for the REXX program (version 1) as coded; it certainly wasn't meant for a general purpose, one-size-fits-all, non-standard/irregular (English) noun pluralizer (foot, datum, century, radius, ...), --- just for bulls and cows. There are also collective nouns which are a whole 'nother kettle of fish. I see no reason to throw the baby out with the bathwater.