Word Bulls & Cows
You can, of course, play the game with any number of letters.
With younger players it's a good idea to disallow repeated letters, as it makes calculating the number of bulls and cows trickier.
To play with numbers try Number Bulls & Cows.
A version of this traditional game was marketed in 1975 by Invicta as a plastic peg game called "Word Mastermind" or "Words Worth".
A variant of this game was marketed as "Jotto" in which only the total number of matches was given, irrespective of whether they are in the correct position or not. This is equivalent to giving the total of bulls + cows.
Programming Word Bulls & Cows