REM Guessing Game Decider REM Written by Vince Long REM January 2000 SCREEN 12 DIM Data$(500) OPEN "jep.cfg" FOR INPUT AS #1 INPUT #1, Inp0 INPUT #1, Inp1 INPUT #1, Inp2 INPUT #1, Inp3 INPUT #1, Inp4 CLOSE #1 Menu: SCREEN 12 CLS LOCATE 5, 20 PRINT "The Guessing Game Decider" LOCATE 8, 10 PRINT "1. Enter Data in a Database" LOCATE , 10 PRINT "2. View Data in the Database" LOCATE , 10 PRINT "3. Change Data in the Database" LOCATE , 10 PRINT "4. Play the Game with a Database" LOCATE , 10 PRINT "5. Play the Game without a Database" LOCATE , 10 PRINT "6. Calibrate the Controller" LOCATE , 10 PRINT "7. Quit this Program" DO I$ = INKEY$ LOOP UNTIL I$ <> "" IF VAL(I$) < 1 OR VAL(I$) > 7 THEN GOTO Menu ON VAL(I$) GOTO EnterData, ViewData, ChangeData, PlayWith, PlayWithout, Calibrate, Shutdown Shutdown: CLS END EnterData: SCREEN 12 CLS INPUT "Is this a new file? (Y or N)"; N$ IF UCASE$(N$) = "Y" THEN Exist = 1: GOTO GetFileName IF UCASE$(N$) = "N" THEN Exist = 2: GOTO GetFileName GOTO EnterData GetFileName: CLS PRINT "Enter the Name of the Database File" PRINT "8 Characters Maximum - No Spaces or Punctuation or File Extension" INPUT FileName$ IF LEN(FileName$) > 8 THEN PRINT "Too Many Characters" T = TIMER DO LOOP WHILE TIMER < T + 2 GOTO GetFileName END IF FileName$ = FileName$ + ".jep" GetClue: CLS PRINT "Enter the new data - 255 Characters Maximum" LINE INPUT NewData$ IF Exist = 2 THEN OPEN FileName$ FOR APPEND AS #1 ELSE OPEN FileName$ FOR OUTPUT AS #1 END IF PRINT #1, NewData$ CLOSE #1 CLS PRINT "Done!" INPUT "Do you want to enter another piece of data in that file? (Y or N)"; N$ IF UCASE$(N$) = "Y" THEN Exist = 2 GOTO GetClue ELSE GOTO Menu END IF ViewData: GetFileName2: CLS PRINT "Enter the Name of the Database File" PRINT "8 Characters Maximum - No Spaces or Punctuation or File Extension" INPUT FileName$ IF LEN(FileName$) > 8 THEN PRINT "Too Many Characters" T = TIMER DO LOOP WHILE TIMER < T + 2 GOTO GetFileName2 END IF FileName$ = FileName$ + ".jep" OPEN FileName$ FOR INPUT AS #1 cc = 1 DO WHILE NOT EOF(1) LINE INPUT #1, Data$(cc) cc = cc + 1 LOOP CLOSE #1 OutPutData: CLS FOR I = 1 TO cc - 1 IF I < 10 THEN PRINT " "; PRINT STR$(I) + ". " + Data$(I) IF I MOD 20 = 0 THEN PRINT PRINT "Press a Key to Continue" DO I$ = INKEY$ LOOP UNTIL I$ <> "" CLS END IF NEXT I PRINT PRINT "Press a Key to Return to the Menu" DO I$ = INKEY$ LOOP UNTIL I$ <> "" GOTO Menu ChangeData: GetFileName3: CLS PRINT "Enter the Name of the Database File" PRINT "8 Characters Maximum - No Spaces or Punctuation or File Extension" INPUT FileName$ IF LEN(FileName$) > 8 THEN PRINT "Too Many Characters" T = TIMER DO LOOP WHILE TIMER < T + 2 GOTO GetFileName3 END IF FileName$ = FileName$ + ".jep" CLS PRINT "You will be shown all the files in the database. Remember the number" PRINT "of the item you wish to change" PRINT PRINT "Press any key to continue" DO I$ = INKEY$ LOOP UNTIL I$ <> "" OPEN FileName$ FOR INPUT AS #1 cc = 1 DO WHILE NOT EOF(1) LINE INPUT #1, Data$(cc) cc = cc + 1 LOOP CLOSE #1 OutPutData2: CLS FOR I = 1 TO cc - 1 IF I < 10 THEN PRINT " "; PRINT STR$(I) + ". " + Data$(I) IF I MOD 20 = 0 THEN PRINT PRINT "Press a Key to Continue" DO I$ = INKEY$ LOOP UNTIL I$ <> "" CLS END IF NEXT I PRINT GetItem: PRINT INPUT "Enter the number of the item that you wish to change"; Item Item = ABS(INT(Item)) IF Item < 1 OR Item > cc - 1 THEN CLS PRINT "The number you entered is out of range" PRINT PRINT "Press a key to try again" DO I$ = INKEY$ LOOP UNTIL I$ <> "" GOTO GetItem END IF MakeChange: CLS PRINT Data$(Item) PRINT PRINT "Enter the new data - 255 Characters Maximum" LINE INPUT NewData$ Data$(Item) = NewData$ OPEN FileName$ FOR OUTPUT AS #1 FOR I = 1 TO cc - 1 PRINT #1, Data$(I) NEXT I CLOSE #1 CLS PRINT "Done!" INPUT "Do you want to change another piece of data in that file? (Y or N)"; N$ IF UCASE$(N$) = "Y" THEN GOTO OutPutData2 ELSE GOTO Menu END IF PRINT "Press a Key to Return to the Menu" DO I$ = INKEY$ LOOP UNTIL I$ <> "" GOTO Menu PlayWithout: SCREEN 7 Begin: CLS LOCATE 5, 5 PRINT " Read the Question" LOCATE 10, 10 PRINT "Press a Key to Activate" LOCATE 11, 10 PRINT " The Buttons" DO I$ = INKEY$ Y = INP(889) IF Y <> Inp0 THEN LOCATE 15, 1 PRINT " Someone is jumping the gun" PRINT " on the buttons" END IF LOCATE 15, 1 PRINT " " PRINT " " LOOP UNTIL I$ <> "" ReStartWithout: CLS LOCATE 20, 1 PRINT "Active" Start: Y = INP(889) IF Y <> Inp0 THEN CLS LOCATE 10, 10 IF Y = Inp1 THEN PRINT "Player 1" IF Y = Inp2 THEN PRINT "Player 2" IF Y = Inp3 THEN PRINT "Player 3" IF Y = Inp4 THEN PRINT "Player 4" Wait3: LOCATE 21, 1 PRINT " Space to Reactive Buttons" PRINT " Enter for Next Question" PRINT " Press M for Menu" DO 5 I$ = INKEY$ LOOP UNTIL I$ <> "" Y = 0 IF I$ = CHR$(32) THEN GOTO ReStartWithout IF I$ = CHR$(13) THEN GOTO Begin IF UCASE$(I$) = "M" THEN GOTO Menu GOTO Wait3 END IF GOTO Start PlayWith: CLS PRINT "Enter the Name of the Database File" PRINT "8 Characters Maximum - No Spaces or Punctuation or File Extension" INPUT FileName$ IF LEN(FileName$) > 8 THEN PRINT "Too Many Characters" T = TIMER DO LOOP WHILE TIMER < T + 2 GOTO PlayWith END IF FileName$ = FileName$ + ".jep" OPEN FileName$ FOR INPUT AS #1 cc = 1 DO WHILE NOT EOF(1) LINE INPUT #1, Data$(cc) cc = cc + 1 LOOP CLOSE #1 SCREEN 7 FOR I = 1 TO cc - 1 CLS LOCATE 10, 10 PRINT "Press a Key to Start" DO I$ = INKEY$ LOOP UNTIL I$ <> "" CLS PRINT Data$(I) PRINT : PRINT DO I$ = INKEY$ LOOP UNTIL I$ <> "" WaitHere1: Y = INP(889) IF Y <> Inp0 THEN LOCATE 10, 10 IF Y = Inp1 THEN PRINT "Player 1" IF Y = Inp2 THEN PRINT "Player 2" IF Y = Inp3 THEN PRINT "Player 3" IF Y = Inp4 THEN PRINT "Player 4" DO I$ = INKEY$ LOOP UNTIL I$ = CHR$(32) GOTO CycleIt END IF GOTO WaitHere1 CycleIt: IF I = cc - 1 THEN CLS PRINT "That's All Folks!!" PRINT : PRINT PRINT "Press a key to return to the Menu" DO I$ = INKEY$ LOOP UNTIL I$ <> "" GOTO Menu END IF CLS Wait2: INPUT "Do the next one? (Y or N)"; N$ IF UCASE$(N$) = "Y" THEN GOTO Continue1 IF UCASE$(N$) = "N" THEN GOTO Menu GOTO Wait2 Continue1: NEXT I END Calibrate: SCREEN 12 CLS LOCATE 10, 1 PRINT "Do not press any buttons until instructed" PRINT PRINT "Press a key to start" DO I$ = INKEY$ LOOP UNTIL I$ <> "" CLS LOCATE 8, 1 PRINT "Press a key to record this value for null input" DO I$ = INKEY$ Inp0 = INP(889) LOCATE 10, 1 PRINT Inp0; " " LOOP UNTIL I$ <> "" GetBut1: CLS LOCATE 10, 1 PRINT "Press Button #1" DO Y = INP(889) LOOP UNTIL Y <> Inp0 Inp1 = Y CLS LOCATE 10, 1 PRINT "Got it! Button 1 is "; Inp1 PRINT "Press a key to do the next one or X to retry" DO I$ = INKEY$ LOOP UNTIL I$ <> "" IF UCASE$(I$) = "X" THEN GOTO GetBut1 GetBut2: CLS LOCATE 10, 1 PRINT "Press Button #2" DO Y = INP(889) LOOP UNTIL Y <> Inp0 Inp2 = Y CLS LOCATE 10, 1 PRINT "Got it! Button 2 is "; Inp2 PRINT "Press a key to do the next one or X to retry" DO I$ = INKEY$ LOOP UNTIL I$ <> "" IF UCASE$(I$) = "X" THEN GOTO GetBut2 GetBut3: CLS LOCATE 10, 1 PRINT "Press Button #3" DO Y = INP(889) LOOP UNTIL Y <> Inp0 Inp3 = Y CLS LOCATE 10, 1 PRINT "Got it! Button 3 is "; Inp3 PRINT "Press a key to do the next one or X to retry" DO I$ = INKEY$ LOOP UNTIL I$ <> "" IF UCASE$(I$) = "X" THEN GOTO GetBut3 GetBut4: CLS LOCATE 10, 1 PRINT "Press Button #4" DO Y = INP(889) LOOP UNTIL Y <> Inp0 Inp4 = Y CLS LOCATE 10, 1 PRINT "Got it! Button 4 is "; Inp4 PRINT "Press a key to finish or X to retry" DO I$ = INKEY$ LOOP UNTIL I$ <> "" IF UCASE$(I$) = "X" THEN GOTO GetBut4 OPEN "jep.cfg" FOR OUTPUT AS #1 PRINT #1, Inp0 PRINT #1, Inp1 PRINT #1, Inp2 PRINT #1, Inp3 PRINT #1, Inp4 CLOSE #1 GOTO Menu