_TITLE "Who cut 1?" 'inspired by Prithak's game posted 2018-12-31 'the disadvantage of going first is you are first in line to risk the bomb
'the advantage is if both players pick the same number for the bomb the first will never get it.
CLS 'show instructions to game cp 2, "Who Cut 1 ?"
cp 4, "This game has 0 to 9 numbers to pick from."
cp 5, "You will plant a bomb under one."
cp 6, "The computer will do the same."
cp 7, "You will take turns cutting numbers"
cp 8, "until one cuts a number with a bomb."
cp
10, "Player =" + STR$(player
) + " Computer =" + STR$(computer
) 'computer chooses it's bomb site
choices$ = "0123456789"
MID$(choices$
, computerBomb
+ 1, 1) = "b"
'player choice's bomb site
PRINT: cp
13, "Player, enter the number place (0 to 9) for your bomb > " MID$(choices$
, bomb
+ 1, 1) = "b"
'start game
gameover = 0
'display cuts up to this point
'PRINT computerBomb; " Numbers left: " + choices$ '<<<<<< debug track hidden game status
nonCutChoices$ = ""
'computer moves first each turn
'don't be a stupid computer and pick the bomb you planted!!!
computerPick = computerBomb
WHILE computerPick
= computerBomb
PRINT "BOOM!, Player wins!" winner$ = "player"
gameover = -1
'computer picks successfully
MID$(choices$
, computerPick
+ 1, 1) = "c"
'player's turn, don't allow player cheat by cutting a number already cut
LOCATE 15, 1:
INPUT "Player, enter a number to cut (not yet cut) > ", playerPick
LOOP WHILE MID$(choices$
, playerPick
+ 1, 1) = "c" OR playerPick
= computerPick
'handle player's legal choice
PRINT "BOOM!, Computer wins!" winner$ = "computer"
gameover = -1
MID$(choices$
, playerPick
+ 1, 1) = "c" ' if gameover still = 0 then loop around
'finish game, total scores
IF winner$
= "player" THEN player
= player
+ 1 ELSE computer
= computer
+ 1 cp 18, "Play again? enter y for yes > "
IF again$
<> "y" THEN done
= -1