I found this program surfing old Basic code and wondered what it was about:
20 Print Tab(15);
"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" 100 Rem *** STARS
- PEOPLE
'S COMPUTER CENTER, MENLO PARK, CA 140 Rem *** A
IS LIMIT
ON NUMBER
, M
IS NUMBER OF GUESSES
150 A = 100: M = 7
170 Input "DO YOU WANT INSTRUCTIONS"; A$
210 Print "I AM THINKING OF A WHOLE NUMBER FROM 1 TO"; A
220 Print "TRY TO GUESS MY NUMBER. AFTER YOU GUESS, I" 230 Print "WILL TYPE ONE OR MORE STARS (*). THE MORE" 240 Print "STARS I TYPE, THE CLOSER YOU ARE TO MY NUMBER." 250 Print "ONE STAR (*) MEANS FAR AWAY, SEVEN STARS (*******)" 260 Print "MEANS REALLY CLOSE! YOU GET"; M;
"GUESSES." 270 Rem *** COMPUTER THINKS OF A NUMBER
310 Print "OK, I AM THINKING OF A NUMBER, START GUESSING." 320 Rem *** GUESSING BEGINS
, HUMAN GETS M GUESSES
540 Rem *** DID
NOT GUESS IN M GUESSES
560 Print "SORRY, THAT'S"; M;
"GUESSES. THE NUMBER WAS"; X
590 Rem *** WE HAVE A WINNER
640 Print "YOU GOT IT IN"; K;
"GUESSES!!! LET'S PLAY AGAIN..."
I translated to more modern Basic and learned a little about LOGs.
_Title "Stars: Guess number 1 to 100, get star rating 1 to 7, get 7 guesses, ...zzz = press any." 'b+ 2021-11-06 N
= Int(100 * Rnd) + 1: nG
= 1:
Print ' N 'secret number : nG = number of guesses up to 7 allowednG
= nG
+ 1:
GoTo 2 ' another guessStarChart: ' number of stars for number you are off
For i
= 1 To 100 ' this also tests my formula to compare to original game
'Test code for Star Chart LOG and convert to LOG(2) to convert to Star Rating
'For p = 0 To 6
' Print p, Log(2 ^ p) / Log(2) ' yes! When you are of 2 ^ x from number you get 7 - x stars
'Next
With the help of the Star Chart (and rewriting the program) it's not hard to pick up the strategy to play the game and usually get the number in 7 guesses.
I should probably reduce the density of the code. It's starting to look like MasterGy's ;-))