04-04-2023, 10:58 AM
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.