Game of the Month
Hot and Cold
"Master Mind" challenge in 8-bit BASIC
Hot and Cold is an Atari 8-bit variation on the classic peg game recently revived as Master Mind. This compact BASIC program works on Atari 8-bit computers of any memory size, with disk or cassette.
by Heidi Brumbaugh, Antic Junior Editor
Just about everybody has played Master Mind, or at least knows about this popular pegboard game of logical deduction. The games concept is centuries old. It was played in old England as Cows and Bulls and more recently as Code-Breaker.
Antic published an ST version of Master Mind as Deduction in our December, 1986 issue. The October, 1983 Antic Game of the Month was Master Mind, which was written in assembly language. However, Hot and Cold is the first 8-bit Atari BASIC version of Master Mind ever published in Antic.
Type in Listing 1, HOTCOLD.BAS check it with TYPO II and SAVE a copy before you RUN it.
Hot and Cold is programmed in Graphics 1, a five-color mode. Thats not really enough different colors handle the complete color-guessing puzzles of the traditional pegboard Master Mind game. So instead of colors, this time your Atari will challenge you with random arrangements of symbols.
Which four of these six symbols- * , + , !, $, # and > -has the computer chosen? And in what order are these symbols placed? You must figure out the correct pattern of symbols in 10 turns or less. And a symbol can be used more than once in each pattern, which makes matters even more difficult.
Make your deduction by moving the joystick to highlight a symbol and then pressing the joystick button to select it. After your choice is displayed, the computer asks you to confirm it, which gives you an opportunity to change your mind.
After you select YES from the confirm menu at the right side of the screen, the computer will tell you how many symbols are "hot" - the correct symbol in the correct place - and how many are warm - the correct symbol in the wrong place.
This information appears in W and H columns at the right of your selected symbol patterns. Your remaining symbols are "cold" - so far off that they're not even displayed in a column. The trick is that the computer won't say which guesses are hot or warm. Thats the part you must figure out logically.
For example, if the computers pattern is + * !> and you guess + + * #, you'll have a 1 in the H (hot) column for the + and a 1 in the W (warm) column for the * . Notice that the correct + at the left is counted only in the H category and is not repeated under W.
Several different strategies can be used to win Hot and Cold. One is to eliminate symbols in order to make the clues clearer. In the example above, your next guess might be ####. You would have a zero in both columns, telling you there are no pound signs in the answer. Guessing + + + + would tell you that one (and only one) of the plus signs in your first guess was correct - but you still couldn't be sure whether or not it was in the right place.
Another less scientific approach is to make a few random guesses so you will have lots of information to rely on. Your guesses remain on the screen throughout the game, so the real challenge of the game is to make new selections based on the hints given in previous turns.
If you don't guess the pattern in 10 turns, the computer will display the correct sequence and ask if you want to play again.
ABOUT THE PROGRAM
The code for Hot and Cold is short and straightforward. After initializing the program variables, the computer randomly selects its four symbols. It prints the game board, sets up the selection menu and then monitors the joystick to get the four symbols that make up the players guess. If the player confirms the choices, the computer evaluates the sequence by checking each symbol in the correct sequence against each symbol in the players guess.
Play continues until you figure out the sequence, or until all 10 turns are used up.
Heidi Brumbaugh wrote Red, White and Blue, Antic's July, 1987 game of the month.Listing 1 HOTCOLD.BAS Download