Guess My Number
#18
Code: (Select All)
1 SCREEN _NEWIMAGE(1280, 720, 32)
2
3 FOR j = 0 TO 1
   4 CLS
   5 PRINT "Bite MY Lucky Seven"
   6 PRINT "Most games want you to guess from 1 to 100, but I'm smarter than them."
   7 PRINT "Choose any whole number from 0 to 127, and give me 7 guesses."
   8 PRINT "I bet after that time, I can tell you what the number is."
   9 PRINT CHR$(13); "Choose your number and press any key to begin"
   10 junk$ = INPUT$(1)
   11 guess = 64
   12 CLS
   13 FOR i = 5 TO 0 STEP -1
       14 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i + 1)
       15 PRINT "For Guess #"; (6 - i); ", my guess is"; guess
       16 PRINT CHR$(13); "Am I:  (0) Correct   (1) High   (2) Low"; CHR$(13)
       17 PRINT "PRESS 0, 1, or 2 please for your answer =>";
       18 a = VAL(INPUT$(1))
       19 PRINT a; CHR$(13); CHR$(13)
       20 i = i - ((a - 1) AND 2) / 2 * i 'answer 0, and we win
   21 NEXT
   22 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i +1)
   23 PRINT "Your number is "; guess
   24 PRINT
   25 PRINT "Would you like to:     (1) Try again"
   26 PRINT "                       (2) Run away crying, unable to stop my awesome power"
   27 a = VAL(INPUT$(1))
   28 j = 1 - (1 AND a)
29 NEXT
30 END


Here's a version of this type thing which I did ages ago for one of those QB64 contests.  The rules basically said it had to be a 30 line program, with no use of IF statements or regular decision evaluation routines such as WHILE and such.
Reply


Messages In This Thread
Guess My Number - by SierraKen - 09-18-2022, 11:04 PM
RE: Guess My Number - by PhilOfPerth - 09-18-2022, 11:11 PM
RE: Guess My Number - by bplus - 09-19-2022, 12:25 AM
RE: Guess My Number - by SierraKen - 09-20-2022, 09:23 PM
RE: Guess My Number - by DANILIN - 09-25-2022, 12:47 PM
RE: Guess My Number - by mnrvovrfc - 09-25-2022, 05:21 PM
RE: Guess My Number - by SierraKen - 09-25-2022, 08:21 PM
RE: Guess My Number - by mnrvovrfc - 09-26-2022, 05:16 AM
RE: Guess My Number - by SierraKen - 09-25-2022, 08:24 PM
RE: Guess My Number - by DANILIN - 11-07-2022, 10:45 AM
RE: Guess My Number - by DANILIN - 02-23-2023, 02:45 AM
RE: Guess My Number - by Sprezzo - 02-24-2023, 02:33 PM
RE: Guess My Number - by DANILIN - 02-24-2023, 04:22 PM
RE: Guess My Number - by bplus - 02-24-2023, 04:36 PM
RE: Guess My Number - by DANILIN - 02-24-2023, 04:52 PM
RE: Guess My Number - by bplus - 02-24-2023, 05:09 PM
RE: Guess My Number - by DANILIN - 04-04-2023, 08:35 AM
RE: Guess My Number - by SMcNeill - 04-04-2023, 10:58 AM
RE: Guess My Number - by DANILIN - 05-20-2023, 03:36 AM



Users browsing this thread: 9 Guest(s)