News:

Welcome to RetroCoders Community

Main Menu

Recent posts

#91
gwbasic / GW Basic Game "Mental"
Last post by ron77 - Nov 20, 2023, 03:00 PM
A story in a forum of a game - you play a young man released from a Mental hospital with an Illness and Meds for life - You, your Family, and Your Friends need to adjust and learn to live with what has happened to you. You need to choose how to see yourself as a victim of circumstances or as a person with choice and ability to take responsibility for your life...

The game is three files (MENTAL1.BAS MENTAL2.BAS MENTAL3.BAS) and is attached in a zip folder with all necessary files (text files) to run under DOSBOX with GWBASIC.EXE...

You cannot view this attachment.

MENTAL game emulated to play online on Archive.org
#92
gwbasic / GW Basic Quitting Smoking Prog...
Last post by ron77 - Nov 20, 2023, 02:49 PM
10 REM QUIT SMOKING PROGRAM
20 REM BY RON77 2023
30 REM INITIALIZE VARIABLES
40 LOGFILE$="QUIT.LOG":SWITCHFILE$= "SWITCH.TXT": S$="": ROW=0: QUIT=0: DT$="":D$="": M$="": Y$="": CHOICE=0: FLAG=0: CIGS=0: COST=0: YEARS=0: LIFE=0
45 GOSUB 8000: REM CHECK FOR SWITCH FILE
50 REM MAIN PROGRAM LOOP
60 SCREEN 0: WIDTH 80:KEY OFF: COLOR 15,0: CLS:S$="QUIT SMOKING PROGRAM": ROW=3: GOSUB 5000
70 S$="BY RON77 2023": ROW=4: GOSUB 5000
80 WHILE INKEY$="": WEND
90 CLS
100 S$="QUIT SMOKING PROGRAM": ROW=3: GOSUB 5000
120 IF QUIT = 0 THEN S$="1. I'M READY TO QUIT": ROW=5: GOSUB 5000 :
130 IF QUIT = 1 AND FLAG = 1 THEN S$="1. VIEW DAYS WITHOUT SMOKING": ROW=5: GOSUB 5000
140 IF QUIT = 1 AND FLAG=1 THEN S$="2. VIEW MONEY SAVED": ROW=6: GOSUB 5000
150 IF QUIT = 1 AND FLAG =1 THEN S$="3. VIEW CIGARETTES NOT SMOKED": ROW=7: GOSUB 5000
155 IF QUIT = 1 AND FLAG = 1 THEN S$="4. I STARTED SMOKING AGAIN": ROW=8: GOSUB 5000
160 IF QUIT = 0 THEN S$="2. SMOKING CALCULATOR": ROW=6: GOSUB 5000
170 INPUT "ENTER CHOICE: ", CHOICE
180 IF QUIT = 0 AND CHOICE = 1 THEN GOSUB 1000: CHOICE=0: GOTO 90
190 IF QUIT = 0 AND CHOICE = 2 THEN GOSUB 2000: CHOICE=0 : GOTO 90
200 IF QUIT = 1 AND CHOICE = 1 THEN GOSUB 3000 : CHOICE=0 : GOTO 90
210 IF QUIT = 1 AND CHOICE = 2 THEN GOSUB 4000 : CHOICE=0 : GOTO 90
220 IF QUIT = 1 AND CHOICE = 3 THEN GOSUB 6000: CHOICE=0 : GOTO 90
225 IF QUIT = 1 AND CHOICE = 4 THEN GOSUB 7000 : CHOICE=0 : GOTO 90
230 IF QUIT = 0 AND CHOICE < 1 AND CHOICE < 2 THEN GOTO 170
240 IF QUIT = 1 AND CHOICE < 1 AND CHOICE < 4 THEN GOTO 170
250 GOTO 90

1000 REM QUIT SMOKING ROUTINE
1010 OPEN "A",#1,LOGFILE$
1020 DT$=DATE$
1030 PRINT #1,DT$
1032 PRINT #1, FLAG
1035 IF FLAG = 1 THEN PRINT #1, CIGS, COST, YEARS
1040 CLOSE #1
1050 QUIT=1
1051 OPEN "O",#1,SWITCHFILE$
1052 PRINT #1, QUIT
1053 PRINT #1, FLAG
1054 CLOSE #1
1060 CLS
1070 S$="YOU STARTED QUITTING SMOKING": ROW=3: GOSUB 5000
1080 S$="ON "+DT$: ROW=4: GOSUB 5000
1090 S$="PRESS ANY KEY TO CONTINUE": ROW=6: GOSUB 5000
1100 WHILE INKEY$="": WEND
1110 RETURN

2000 REM SMOKING CALCULATOR ROUTINE
2010 CLS
2015 FLAG=1
2020 S$="SMOKING CALCULATOR": ROW=3: GOSUB 5000
2030 INPUT "HOW MANY CIGARETTES DO YOU SMOKE A DAY? ", CIGS
2040 INPUT "HOW MUCH DOES A PACK OF CIGARETTES COST? ", COST
2050 INPUT "HOW MANY YEARS HAVE YOU BEEN SMOKING? ", YEARS
2060 CIGSYEARS=CIGS*365
2070 CIGSTOTAL=CIGSYEARS*YEARS
2080 COSTTOTAL=COST*(CIGSTOTAL/20)
2082 LIFE = (((CIGSTOTAL*5)/60)/24)/365
2090 CLS:S$="YOU HAVE SPENT $"+MID$(STR$(COSTTOTAL),2)+" ON CIGARETTES": ROW=5: GOSUB 5000
2100 S$="YOU HAVE SMOKED "+MID$(STR$(CIGSTOTAL),2)+" CIGARETTES": ROW=6: GOSUB 5000
2110 S$="YOU HAVE LOST "+MID$(STR$(LIFE),2)+" YEARS OF YOUR LIFE": ROW=7: GOSUB 5000
2120 S$="PRESS ANY KEY TO CONTINUE": ROW=9: GOSUB 5000
2130 WHILE INKEY$="": WEND
2140 RETURN

3000 REM DAYS WITHOUT SMOKING ROUTINE
3010 CLS
3020 OPEN "I",#1,LOGFILE$
3030 INPUT #1, DT$
3032 INPUT #1, FLAG
3035 IF FLAG = 1 THEN INPUT #1, CIGS, COST, YEARS
3040 CLOSE #1
3050 REM CALCULATE DAYS WITHOUT SMOKING
3060 DTP$=DATE$
3061 EM$=MID$(DTP$,1,2)
3062 ED$=MID$(DTP$,4,2)
3063 EY$=MID$(DTP$,7,4)
3064 SM$=MID$(DT$,1,2)
3065 SD$=MID$(DT$,4,2)
3066 SY$=MID$(DT$,7,4)
3070 REM
3080 REM
3090 M = VAL(SM$): D = VAL(SD$): Y = VAL(SY$): GOSUB 3500: SJ = JDN
3100 M = VAL(EM$): D = VAL(ED$): Y = VAL(EY$): GOSUB 3500: EJ = JDN
3110 DD = EJ - SJ
3120 S$="NUMBER OF DAYS: "+MID$(STR$(DD),2): ROW=5: GOSUB 5000
3125 WHILE INKEY$="": WEND
3130 RETURN

3500 REM SUBROUTINE TO CONVERT DATE TO JULIAN DAY NUMBER
3510 REM
3520 A = (14 - M) / 12
3530 Y = Y + 4800 - A
3540 M = M + 12 * A - 3
3560 JDN = D + ((153 * M + 2) / 5) + 365 * Y + Y / 4 - Y / 100 + Y / 400 - 32045
3570 RETURN

4000 REM MONEY SAVED ROUTINE
4010 CLS
4020 OPEN "I",#1,LOGFILE$
4030 INPUT #1, DT$
4032 INPUT #1, FLAG
4035 IF FLAG = 1 THEN INPUT #1, CIGS, COST, YEARS
4040 CLOSE #1
4050 REM CALCULATE MONEY SAVED
4060 DTP$=DATE$
4061 EM$=MID$(DTP$,1,2)
4062 ED$=MID$(DTP$,4,2)
4063 EY$=MID$(DTP$,7,4)
4064 SM$=MID$(DT$,1,2)
4065 SD$=MID$(DT$,4,2)
4066 SY$=MID$(DT$,7,4)
4070 REM
4080 REM
4090 M = VAL(SM$): D = VAL(SD$): Y = VAL(SY$): GOSUB 3500: SJ = JDN
4100 M = VAL(EM$): D = VAL(ED$): Y = VAL(EY$): GOSUB 3500: EJ = JDN
4110 DD = EJ - SJ
4120 CIGARETTES = DD * CIGS
4130 MONEY = CIGARETTES * COST / 20
4140 S$="MONEY SAVED: $"+MID$(STR$(MONEY),2) : ROW=5: GOSUB 5000
4145 WHILE INKEY$="": WEND
4150 RETURN


5000 REM CENTER PRINT ROUTINE
5010 LOCATE ROW,(80-LEN(S$))/2: PRINT S$
5020 RETURN

6000 REM CIGARETTES NOT SMOKED ROUTINE
6010 CLS
6020 OPEN "I",#1,LOGFILE$
6030 INPUT #1, DT$
6032 INPUT #1, FLAG
6035 IF FLAG = 1 THEN INPUT #1, CIGS, COST, YEARS
6040 CLOSE #1
6050 REM CALCULATE CIGARETTES NOT SMOKED
6060 DTP$=DATE$
6061 EM$=MID$(DTP$,1,2)
6062 ED$=MID$(DTP$,4,2)
6063 EY$=MID$(DTP$,7,4)
6064 SM$=MID$(DT$,1,2)
6065 SD$=MID$(DT$,4,2)
6066 SY$=MID$(DT$,7,4)
6070 REM
6080 REM
6090 M = VAL(SM$): D = VAL(SD$): Y = VAL(SY$): GOSUB 3500: SJ = JDN
6100 M = VAL(EM$): D = VAL(ED$): Y = VAL(EY$): GOSUB 3500: EJ = JDN
6110 DD = EJ - SJ
6120 CIGARETTES = DD * CIGS
6130 S$="CIGARETTES NOT SMOKED: "+MID$(STR$(CIGARETTES),2): ROW=5: GOSUB 5000
6135 WHILE INKEY$="": WEND
6140 RETURN

7000 REM STARTED SMOKING AGAIN ROUTINE
7010 CLS
7011 PRINT "ARE YOU SURE YOU WANT TO START SMOKING AGAIN? (Y/N)"
7012 INPUT, S$
7013 IF START$ = "N" OR START$="n" THEN RETURN
7015 FLAG=0: QUIT=0
7020 KILL LOGFILE$
7025 OPEN "O",#1,SWITCHFILE$
7026 PRINT #1, QUIT
7027 PRINT #1, FLAG
7030 CLOSE #1
7040 RETURN

8000 REM CHECK FOR SWITCH FILE
8010 OPEN "I",#1,SWITCHFILE$
8020 INPUT #1, QUIT
8025 INPUT #1, FLAG
8030 CLOSE #1
8040 RETURN

file "SWITCH.TXT" content
0
0
#93
gwbasic / Gw Basic Game - Russian Roulet...
Last post by ron77 - Nov 20, 2023, 02:41 PM
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
#94
gwbasic / GW Basic Chatbot - Aviv-Bot
Last post by ron77 - Nov 20, 2023, 02:36 PM
10 REM A CHATBOT AVIV-BOT
20 REM BY RON77
30 REM 2023
40 REM PROGRAM INITIALIZATION
50 DIM K$(100),R$(100, 5),D$(20): DCOUNT=0:FLINE$="":TAG$="":STEXT$="":TAGP=0:KNUM=0
60 PRINT "        LOADING DATABASE PLEASE WAIT..."
70 DATAFILE$="DATABASE.DAT": RANDOMIZE TIMER
80 REM LOAD DATABASE
82 KEYWORDNUM = 1: REPLYNUM = 1
90 OPEN "I",#1,DATAFILE$
100 WHILE NOT EOF(1)
110 LINE INPUT #1,FLINE$
120 IF LEN(FLINE$)>0 THEN TAGP = INSTR(FLINE$,":")
130 IF TAGP>0 THEN TAG$=LEFT$(FLINE$,1) : STEXT$=MID$(FLINE$,TAGP+1) ELSE TAG$=""
140 IF TAG$="k" THEN K$(KEYWORDNUM)=" "+ STEXT$+ " ": REPLYNUM = 1: KEYWORDNUM=KEYWORDNUM+1
150 IF TAG$="r" THEN R$(KEYWORDNUM - 1, REPLYNUM)=STEXT$: REPLYNUM=REPLYNUM+1
160 IF TAG$="d" THEN D$(DCOUNT)=STEXT$: DCOUNT=DCOUNT+1
170 WEND
180 CLOSE #1
181 C = 0
182 SCREEN 0: WIDTH 80:KEY OFF:COLOR 15,C: CLS
183 PRINT "                     === AVIV-CHATBOT VERSION 0.1 ==="
184 PRINT "                            === BY RON77 ==="
185 PRINT "                               === 2023 ==="
186 PRINT "       TYPE goodbye TO EXIT use lowercase only and no question marks"
187 COLOR 0,7:LOCATE 25,1:PRINT SPACE$(80);:LOCATE 25,1:PRINT "CHATBOT AVIV VERSION 0.1 BY RON77 2023";:LOCATE 5,1:COLOR 15,C
190 REM MAIN LOOP
191 C=C+1:IF C>15 THEN C=1
200 COLOR ,C:PRINT 
210 INPUT "YOU: ", USERINPUT$
211 USERINPUT$ = " " + USERINPUT$ + " "
220 IF USERINPUT$ = " goodbye " THEN GOTO 500
230 KFOUND = 0
240 FOR I = 1 TO KEYWORDNUM - 1
250   IF INSTR(USERINPUT$,K$(I)) > 0 THEN KFOUND = 1: KNUM = I: GOTO 300
260 NEXT I
270 IF KFOUND = 0 THEN GOTO 400
271 REM
280 GOTO 190

300 REM KEYWORD FOUND, SELECT A RANDOM REPLY
310 RNUM = INT(RND * 5) + 1
320 COLOR ,C:PRINT "AVIV-BOT: " + R$(KNUM, RNUM)
390 GOTO 260

400 REM KEYWORD NOT FOUND, USE DEFAULT REPLY
410 DNUM = INT(RND * DCOUNT)
420 PRINT "AVIV-BOT: " + D$(DNUM)
430 GOTO 190

500 REM EXIT
510 PRINT "AVIV-BOT: GOODBYE!"
520 END

DATABASE.DAT file example:
================== aviv database ==================
========= database rule - one keyword to five responses up to 100 keywords total =========
k:hi

r:hi long time not seen you
r:hi how are you?
r:hi how are you doing?
r:boy i sure missed you and i'm not being cynical
r:hi how are you doing? i missed you

k:how are you

r:i'm fine thank you
r:i'm fine thank you and you?
r:i'm alive and well but what about you?
r:well i still got the old records we used to listen to
r:don't worry i haven't forgotten you my friend



=============default replies===================

d:go on i'm listening to you man
d:i feel you man
d:you're so funny
d:i think understand what your saying
d:why is that?
d:if you wish we can talk on something else
d:i missed talking to you did i tell you that :)
d:why don't you put some music on or chill with something else
d:we don't have to talk about it if you don't want to or can't
d:god i miss jerusalem with all of you guys
d:so you made me as a chatbot hum? you need some friends
d:well people all people can be mean sometimes but you have to be strong and not let them get to you
d:how are you really?
d:would you like open it up to me?
d:so another chatbot hum? when will you have a girlfriend?
d:look i know life is unfair and the world is cruel but you have to be strong and not let it get to you
d:i'm here for you and i'll try to listen and understand and support you in any way i can
d:what makes you say that?
d:did i ever tell you how awesome i think you are? :D

chatbot aviv on archive.org emulated
#96
General Discussion / Re: what kind of music do you ...
Last post by johnno56 - Nov 19, 2023, 08:55 PM
Swedish... I think the closest I ever got to 'Swedish' was a couple of Abba hits... Not a fan of 'techno'...
#97
General Discussion / Re: what kind of music do you ...
Last post by Marcus - Nov 18, 2023, 10:27 AM
Swedish folk music, of course. And hardcore techno.
#98
I would probably never have thought of that. Maybe in tbe future, I will try that method.
#99
Quote from: Lucidapogee on Nov 05, 2023, 05:19 PMThat makes me wonder. How exactly do you not return to the FOR? Do you maintain a stack or something?

Sinclair BASIC stores the loop info with the variable - basically, all numeric vars can store extra information alongside the value they hold. Keep the loop location (the statement after the FOR), the limit and the step inside the var, then when NEXT comes along you test it there. 
#100
B.A.M / Re: BAM Draw
Last post by CharlieJV - Nov 06, 2023, 04:22 AM
Although I've got some small things left to do along with some code cleanup, this ASCII drawing program seems to be working A-1.

For details, see the blog: https://basicanywheremachine-news.blogspot.com/2023/11/bam-draw.html

You cannot view this attachment.