News:

Welcome to RetroCoders Community

Main Menu

Gw Basic Game - Russian Roulette

Started by ron77, Nov 20, 2023, 02:41 PM

Previous topic - Next topic

ron77

10 REM RUSSIAN ROULETTE GAME IN GW BASIC
20 REM BY RON77 (SOLO88) 2023
30 REM INITIALIZE VARIABLES
40 DIM GUN(6): USER1$="": USER2$="": S$="": ROW=0: RANDOMIZE TIMER: B=0
50 FOR I = 1 TO 6: GUN(I) = 0: NEXT I
60 REM INTRO
65 GOSUB 1200 REM SCREEN 0: REM COLOR 15,0:REM CLS
70 S$ = "RUSSIAN ROULETTE": ROW = 3: GOSUB 1000
80 S$ = "BY RON77 (SOLO88)": ROW = 5: GOSUB 1000
90 WHILE INKEY$ = "": WEND: BEEP
100 GOSUB 1300
110 S$="RUSSIAN ROULETTE": ROW=3: GOSUB 1000
120 S$="BY RON77 (SOLO88)": ROW=5: GOSUB 1000
130 WHILE INKEY$="": WEND: GOSUB 1200
140 REM START OG GAME LOOP
150 INPUT "PLAYER 1 NAME: ", USER1$
160 INPUT "PLAYER 2 NAME: ", USER2$
170 CLS
180 PRINT USER$;"ONE OR TWO BULLETS IN THE REVOLVER?"
190 INPUT "ENTER 1 OR 2: ", BULLETS
200 IF BULLETS = 1 THEN GOTO 220 ELSE IF BULLETS = 2 THEN GOTO 230

220 REM ONE BULLET IN THE REVOLVER
221 GUN(3) = 1
222 GOTO 240

230 REM TWO BULLETS IN THE REVOLVER
231 GUN(3) = 1: GUN(6) = 1
232 GOTO 240

240 REM START OF GAME LOOP
250 REM PLAYER 1 TURN
255 GOSUB 1200: PRINT USER1$;" TURN"
260 PRINT "1, ROLL THE CYLINDER"
270 PRINT "2, PULL THE TRIGGER"
280 PRINT "3, QUIT"
290 INPUT "ENTER 1, 2, OR 3: ", CHOICE
295 IF CHOICE < 1 OR CHOICE > 3 THEN GOTO 290
300 ON CHOICE GOTO 400, 500, 600

320 REM PLAYER 2 TURN
325 GOSUB 1200: PRINT USER2$;" TURN"
330 PRINT "1, ROLL THE CYLINDER"
340 PRINT "2, PULL THE TRIGGER"
350 PRINT "3, QUIT"
360 INPUT "ENTER 1, 2, OR 3: ", CHOICE
365 IF CHOICE < 1 OR CHOICE > 3 THEN GOTO 360
370 ON CHOICE GOTO 450, 550, 650

400 REM ROLL THE CYLINDER PLATER 1
415 FOR I = 1 TO 6
420 B = INT(RND*7)
422 NEXT I
425 GOSUB 50600
430 GOTO 240

450 REM ROLL THE CYLINDER PLAYER 2
455 FOR I = 1 TO 6
460 B = INT(RND*7)
462 NEXT I
465 GOSUB 50600
470 GOTO 320


500 REM PULL THE TRIGGER PLATER 1
505 IF GUN(B) = 1 THEN GOSUB 1300: BEEP: ROW=4:S$=USER1$+" YOU DIED!":GOSUB 1000: END
510 IF GUN(B) = 0 THEN GOSUB 1200: BEEP: ROW=4:S$=USER1$+" YOU LIVE!":GOSUB 1000: T!=TIMER +3:WHILE TIMER <T!:WEND:GOTO 320

550 REM PULL THE TRIGGER PLAYER 2
555 IF GUN(B) = 1 THEN GOSUB 1300: BEEP: ROW=4:S$=USER2$+" YOU DIED!":GOSUB 1000: END
560 IF GUN(B) = 0 THEN GOSUB 1200: BEEP: ROW=4:S$=USER2$+" YOU LIVE!":GOSUB 1000: T!=TIMER +3:WHILE TIMER <T!:WEND: GOTO 240

600 REM QUIT PLAYER 1
605 GOSUB 1200: ROW=4:S$=USER1$+" QUIT!":GOSUB 1000: END

650 REM QUIT PLAYER 2
655 GOSUB 1200: ROW=4:S$=USER2$+" QUIT!":GOSUB 1000: END

1000 REM PRINT STRING
1010 LOCATE ROW, (80 - LEN(S$))/2: PRINT S$
1020 RETURN

1200 REM SCREEN INIT
1210 SCREEN 0: COLOR 15,0: CLS
1220 RETURN

1300 REM SCREEN RED COLOR
1310 SCREEN 0: COLOR 4,0: CLS
1320 RETURN

50600 FOR I = 1 TO 50
50700    J=RND(I)*10000
50800    IF J<37 THEN 51100
50900    PLAY "mb"
51000    SOUND J,.5
51100 NEXT I
51200 RETURN