-
Notifications
You must be signed in to change notification settings - Fork 0
/
codey_with_nibbles.bas
1590 lines (1343 loc) · 44.3 KB
/
codey_with_nibbles.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
DIM Username AS STRING
DIM Imput AS STRING
INPUT "Hello, my name is Codey. What is yours? ", Username
CLS
PRINT "Well, hello then, "; Username
ORIGINAL:
CLS
COLOR 3:
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / Press \ / \ "
PRINT "| Spacebar | | | "
PRINT "| to see | | 0 0 | "
PRINT " \ my options/ | __ | "
PRINT " \_________/ \______/ "
COLOR 31: PRINT "Press the Spacebar to see my options..."
COLOR 18: PRINT "Press Esc to end the program..."
DO
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = CHR$(63) OR K$ = CHR$(32)
IF K$ = CHR$(27) THEN END
IF K$ = CHR$(32) THEN GOTO OPTIONS:
LOOP
OPTIONS:
CLS
COLOR 15:
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / These \ / \ "
PRINT "| are | | | "
PRINT "| my options | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
PRINT "Pick an option, "; Username
PRINT "It is currenty"
PRINT Clock$
PRINT DATE$
PRINT
PRINT
COLOR 9: PRINT "Key 'P' to play on my digital arcade..."
PRINT
COLOR 10: PRINT "Key 'C' to use the calculator..."
PRINT
COLOR 14: PRINT "Key 'S' to use soundboard..."
PRINT
COLOR 13: PRINT "Key 'G' to use graph..."
PRINT
COLOR 11: PRINT "Press the spacebar to talk with me..."
PRINT
COLOR 4: PRINT "Key Esc to end program..."
DO
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "O" OR K$ = "E" OR K$ = "P" OR K$ = "C" OR K$ = "S" OR K$ = "G" OR K$ = CHR$(27) OR K$ = CHR$(32)
IF K$ = CHR$(27) THEN END
IF K$ = "O" THEN GOTO OPTIONS:
IF K$ = "P" THEN GOTO Gamesmenu:
IF K$ = "C" THEN GOTO Calculator:
IF K$ = "S" THEN GOTO Soundboard:
IF K$ = CHR$(27) THEN END
IF K$ = "G" THEN GOTO Graph:
IF K$ = CHR$(32) THEN GOTO Conversation:
LOOP
Calculator:
5 CLS
PRINT "1) ADD"
PRINT "2) MULTIPLY"
PRINT "3) DIVIDE"
PRINT "4) SQUARE ROOT"
PRINT "5) EXIT"
INPUT I
IF I = 1 GOTO 10
IF I = 2 GOTO 20
IF I = 3 GOTO 30
IF I = 4 GOTO 40
IF I = 5 GOTO 50
END
10 CLS: PRINT "INPUT NUMBER"
INPUT A
CLS
PRINT "INPUT NEXT NUMBER"
INPUT B
CLS
PRINT A + B
PRINT "PRESS SPACE TO RUN"
SLEEP 0
PRINT "Continue calculating, "; Username
PRINT "Y/N"
IF K$ = "Y" THEN GOTO 5
IF K$ = "N" THEN GOTO OPTIONS:
20 CLS: PRINT "INPUT NUMBER"
INPUT C
CLS
PRINT "INPUT NEXT NUMBER"
INPUT D
CLS
PRINT C * D
PRINT "PRESS SPACE TO RUN"
SLEEP 0
PRINT "Continue calculating, "; Username
PRINT "Y/N"
IF K$ = "Y" THEN GOTO 5
IF K$ = "N" THEN GOTO OPTIONS:
30 CLS: PRINT "INPUT NUMBER"
INPUT E
CLS
PRINT "INPUT NEXT NUMBER"
INPUT F
CLS
PRINT E / F
PRINT "PRESS SPACE TO RUN"
SLEEP 0
PRINT "Continue calculating, "; Username
PRINT "Y/N"
IF K$ = "Y" THEN GOTO 5
IF K$ = "N" THEN GOTO OPTIONS:
40 CLS: PRINT "INPUT NUMBER"
INPUT G
CLS
PRINT SQR(G)
PRINT "PRESS SPACE TO RUN"
SLEEP 0
PRINT "Continue calculating, "; Username
PRINT "Y/N"
IF K$ = "Y" THEN GOTO 5
IF K$ = "N" THEN GOTO OPTIONS:
50 END
Soundboard:
CLS
COLOR 15:
PRINT "Press A to play A note..."
PRINT
PRINT "Press B to play B note..."
PRINT
PRINT "Press C to play C note..."
PRINT
PRINT "Press D to play D note..."
PRINT
PRINT "Press E to play E note..."
PRINT
PRINT "Press F to play F note..."
PRINT
PRINT "Press G to play G note..."
PRINT
PRINT "Press Esc to exit Soundboard..."
DO
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "A" OR K$ = "B" OR K$ = "C" OR K$ = "D" OR K$ = "E" OR K$ = "F" OR K$ = "G" OR K$ = CHR$(27)
PRINT K$
IF K$ = "E" THEN GOTO E:
IF K$ = "A" THEN GOTO A:
IF K$ = "B" THEN GOTO B:
IF K$ = "C" THEN GOTO C:
IF K$ = "D" THEN GOTO D:
IF K$ = "G" THEN GOTO G:
IF K$ = "F" THEN GOTO F:
IF K$ = CHR$(27) THEN GOTO OPTIONS:
LOOP
E:
CLS
PLAY "E"
GOTO Soundboard:
A:
CLS
PLAY "A"
GOTO Soundboard:
B:
CLS
PLAY "B"
GOTO Soundboard:
C:
CLS
PLAY "C"
GOTO Soundboard:
D:
CLS
PLAY "D"
GOTO Soundboard:
G:
CLS
PLAY "G"
GOTO Soundboard:
F:
CLS
PLAY "F"
GOTO Soundboard:
Graph:
SCREEN 0, 0, 0
CLS
WIDTH 40, 25
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
PRINT "Add(Positive) or Subtract(negative) m of first slope? A or S?"
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "A" OR K$ = "S"
IF K$ = "A" THEN GOTO Add1:
IF K$ = "S" THEN GOTO Subtract1:
Add1:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for m. ", m
INPUT "Over? ", C
m2 = m / C
GOTO start2:
Subtract1:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for m. ", m
INPUT "Over? ", D
rand3 = m / D
m3 = rand3 * -1
GOTO start3:
start2:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
PRINT "Add(Positive) or Subtract(negative) b of first slope? A or S?"
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "A" OR K$ = "S"
IF K$ = "A" THEN GOTO Add2:
IF K$ = "S" THEN GOTO Subtract2:
start3:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
PRINT "Add(Positive) or Subtract(negative) b of first slope? A or S?"
DO: K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "A" OR K$ = "S"
IF K$ = "A" THEN GOTO Add3:
IF K$ = "S" THEN GOTO Subtract3:
Add2:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for b. ", B
b2 = B
GOTO Stats1:
Subtract2:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for b. ", B
b3 = B * -1
GOTO Stats2:
Add3:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for b. ", B
b4 = B
GOTO Stats3:
Subtract3:
CLS
COLOR 10: PRINT "The slope formula is y = m(x) +/- b."
INPUT "Enter first term for b. ", B
b5 = B * -1
GOTO Stats4:
Stats1:
CLS
SCREEN 13
size = 5
WINDOW (-size, -size)-(size, size)
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size
LINE (-size, x)-(size, x), 8
LINE (x, -size)-(x, size), 8
NEXT x
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size STEP .01
y = x * m2 + b2
PSET (x, y), 13
LOCATE 20, 1: PRINT "Y Intercept is "; B
NEXT x
GOTO again
Stats2:
CLS
SCREEN 13
size = 5
WINDOW (-size, -size)-(size, size)
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size
LINE (-size, x)-(size, x), 8
LINE (x, -size)-(x, size), 8
NEXT x
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size STEP .01
y = x * m2 + b3
PSET (x, y), 13
LOCATE 20, 1: PRINT "Y Intercept is "; B
NEXT x
GOTO again
Stats3:
CLS
SCREEN 13
size = 5
WINDOW (-size, -size)-(size, size)
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size
LINE (-size, x)-(size, x), 8
LINE (x, -size)-(x, size), 8
NEXT x
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size STEP .01
y = x * m3 + b4
PSET (x, y), 13
LOCATE 20, 1: PRINT "Y Intercept is "; B
NEXT x
GOTO again
Stats4:
CLS
SCREEN 13
size = 5
WINDOW (-size, -size)-(size, size)
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size
LINE (-size, x)-(size, x), 8
LINE (x, -size)-(x, size), 8
NEXT x
LINE (-size, 0)-(size, 0), 15
LINE (0, -size)-(0, size), 15
FOR x = -size TO size STEP .01
y = x * m3 + b5
PSET (x, y), 13
LOCATE 20, 1: PRINT "Y Intercept is "; B
NEXT x
GOTO again:
again:
LOCATE 23, 1: PRINT "New graph? (Y/N)"
DO
a$ = UCASE$(INKEY$)
LOOP UNTIL a$ = "Y" OR a$ = "N"
IF a$ = "Y" THEN GOTO Graph:
IF a$ = "N" THEN
SCREEN 0, 0, 0:
WIDTH 80, 25
CLS
END IF
IF a$ = "N" GOTO OPTIONS:
END
Conversation:
DIM UserInput AS STRING
DO
COLOR 7:
PRINT "Press Esc to go to Codey's main menu at any time"
a$ = UCASE$(INKEY$)
INPUT "Type something for me to respond to. ", UserInput
IF K$ = CHR$(27) THEN GOTO OPTIONS:
IF UserInput = "I WANNA BE THE VERY BEST" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / Like \ / \ "
PRINT "| no one | | | "
PRINT "| ever was | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "TO CATCH THEM IS MY TEST" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / To train \ / \ "
PRINT "| them is | | | "
PRINT "| my cause | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "POKEMON" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / Gotta \ / \ "
PRINT "| catchem | | | "
PRINT "| all | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "SLEEP" THEN
PRINT "It is already "
PRINT Clock$
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / ZZZZZ \ / \ "
PRINT "| ZZZZZZZ | | | "
PRINT "| ZZZ | | - - | "
PRINT " \(goodnight)/ | __ | "
PRINT " \_________/ \______/ "
SOUND 200, 20
END
END IF
IF UserInput = "I WANT TO GO HOME" THEN GOTO OPTIONS:
IF UserInput = "HOME" THEN GOTO OPTIONS:
IF UserInput = "OPTIONS" THEN GOTO OPTIONS:
IF UserInput = "MENU" THEN GOTO OPTIONS:
IF UserInput = "GAMES" THEN GOTO Gamesmenu:
IF UserInput = "PLAY" THEN GOTO Gamesmenu:
IF UserInput = "CALCULATOR" THEN GOTO Calculator:
IF UserInput = "CALCULATE" THEN GOTO Calculator:
IF UserInput = "FART" THEN SOUND 100, 20
IF UserInput = "END" THEN END
IF UserInput = "END PROGRAM" THEN END
IF UserInput = "FAVORITE MOVIE" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / \ / \ "
PRINT "| Tron | | | "
PRINT "| | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "FAVORITE FOOD" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / \ / \ "
PRINT "| Block | | | "
PRINT "| Bytes | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "NAME" THEN
PRINT "Your name is "; Username
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / My \ / \ "
PRINT "| name is | | | "
PRINT "| Codey | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "FAVORITE GAME" THEN
PRINT
PRINT " _________ "
PRINT " / \ ______ "
PRINT " / I \ / \ "
PRINT "| like | | | "
PRINT "| Atari | | 0 0 | "
PRINT " \ / | __ | "
PRINT " \_________/ \______/ "
END IF
IF UserInput = "GRAPH" THEN GOTO Graph:
IF UserInput = "TOWER TRIALS" THEN GOTO TowerTrials:
IF UserInput = "NIBBLES" THEN GOTO Nibbles:
IF UserInput = "HOW ARE YOU" THEN PRINT "I am good, how are you, "; Username
IF UserInput = "DATE" THEN PRINT Clock$
IF UserInput = "TIME" THEN PRINT Clock$
IF UserInput = "CLOCK" THEN PRINT Clock$
LOOP
Gamesmenu:
CLS
COLOR 31: LOCATE 2, 2: PRINT "This is my Digital Arcade..."
COLOR 15: LOCATE 3, 2: PRINT STRING$(78, 196)
COLOR 25: LOCATE 4, 2: PRINT "Commands"
COLOR 23: LOCATE 9, 2: PRINT "N";: COLOR 7: PRINT "ibbles";: COLOR 15: PRINT "............ Navigate your snakes around, trying to eat up numbers"
COLOR 18: LOCATE 13, 2: PRINT "T";: COLOR 2: PRINT "ower Trials";: COLOR 15: PRINT ".................. Smite all the creatures in your trials"
COLOR 20: LOCATE 21, 2: PRINT "Esc";: COLOR 12: PRINT "................... press Esc to end the program"
DO
K$ = INKEY$
K$ = UCASE$(K$)
LOOP UNTIL K$ = "N" OR K$ = "T" OR K$ = "B" OR K$ = CHR$(27)
_SNDPLAY h&
IF K$ = "N" THEN GOTO Nibbles:
IF K$ = "T" THEN GOTO TowerTrials:
IF K$ = CHR$(27) THEN GOTO OPTIONS:
TowerTrials:
CONST TRUE2 = 1
CONST FALSE2 = 0
CLS
ask = question
IF ask = 1 THEN
SOUND 100, 18.2
SOUND 300, 18.2
SOUND 200, 18.2
SOUND 500, 18.5
SOUND 200, 20
SOUND 0, 18.2
SOUND 300, 6
SOUND 800, 18.5
END IF
STARTALLOVER:
COLOR 12, 0: PRINT TAB(23); "Welcome to T O W E R T R I A L S"
COLOR 5: PRINT "Welcome to this game. From here you will solve your way through the game until completion is reached... (Make sure that everything you type should be in CAPS)"
COLOR 31, 1: PRINT "(WARNING: this game is very confusing and requires thought and patience. PLAYER DISGRESSION IS ADVIZED)"
COLOR 10, 0: PRINT "Darn! I forgot my glasses in my other cloak. Can you tell me if you are a boy or a girl"
DO
INPUT pASSWORD$
IF pASSWORD$ = "GIRL" THEN GOTO GIRL:
IF pASSWORD$ = "BOY" THEN GOTO BOY: ELSE PRINT "I don't understand..."
LOOP UNTIL GETOUT = 1
BOY:
PRINT "Alright! Let's venture yonder, champ!"
GOTO FIRSTRIDDLE:
GIRL:
PRINT "Oh. Now I recognize you! Alright! Follow me, milady..."
FIRSTRIDDLE:
COLOR 4: PRINT "Okay, let's start with a mathematical riddle."
COLOR 12: PRINT "If 2=6, 3=12, 4=20, what does 5 equal?"
LET GETOUT = 0
DO
INPUT pASSWORD$
IF pASSWORD$ = "30" THEN GETOUT = 1: PRINT "Good thinking! You're just the kind of person I'm looking for!" ELSE PRINT "Try again please..."
LOOP UNTIL GETOUT = 1
COLOR 2: PRINT "Let's move on..."
COLOR 6: PRINT "Let's go on our way through town to the tower."
PRINT "There is a gate to the place we are visiting and the guardsman asks for a passcode to get in."
COLOR 3: PRINT "The guardsman says... 'What is the answer to 2(5+7) 1 + 2 x 4'"
LET GETOUT = 0
DO
INPUT pASSWORD$
IF pASSWORD$ = "30" THEN GETOUT = 1: PRINT "You shall pass, brilliant one." ELSE PRINT "Please try again, your answer is incorrect."
LOOP UNTIL GETOUT = 1
COLOR 8: PRINT "This is a palace in which there are 3 floors. Each floor contains a trial. But, only on the roof, will be your final trial and crowning moment."
FIRSTTRIAL:
COLOR 4: PRINT "HERE IS YOUR FIRST TRIAL!!! (An experienced witch flies down with 500 health points.Your magic deals 25% damage of what the witch already has and your punch deals 100 health points. Your objctive is to slay the witch by choosing either MAGIC or PUNCH to attack)"
LET GETOUT = 0
LET Life = 500
LET Witch = 500
COLOR 6:
DO
INPUT pASSWORD$
IF pASSWORD$ = "MAGIC" THEN
Witch = Witch * .25
Life = Life - 110
COLOR 2: PRINT "You did 25% damage of what the witch already has! You got hit by the witch's magical staff's WACK!"
PRINT "You currntly have"; Life
PRINT "life points."
PRINT "The witch still has"; Witch
PRINT "life points. Make another move. Your options are MAGIC, or PUNCH."
ELSE PRINT "You punched 100 damage! You got hit by the witch's magical staff's flame bolt."
Life = Life - 110
Witch = Witch - 100
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The witch still has"; Witch
PRINT "life points. Make another move. Your options are MAGIC, or PUNCH."
END IF
IF Witch <= 0 OR Life <= 0 THEN GETOUT = 1
LOOP UNTIL GETOUT = 1
IF Witch <= 0 THEN PRINT "You defeated the witch!"
IF Life <= 0 THEN PRINT "You got annihilated by the witch and have been slain."
Decision = StillWantsToPlay2
IF Life <= 0 AND Decision = TRUE2 THEN GOTO STARTALLOVER:
IF Decision = FALSE2 THEN END
COLOR 0, 0
COLOR 2: PRINT "Hoo-ray!!! You have defeated the witch. It's time to go to to the next floor for trial 2."
COLOR 6: PRINT "(As you step up to the second trial, you see a minotaur inside a cage) Here is your second trial... Defeat the MINOTAUR!!!"
COLOR 14: PRINT "(You have earned a new power and your magic has improved! Your options are MAGIC: does 50% damage of what the minotaur currently has; and SWORD that does 300 damage to the minotaur health points. YOU BOTH HAVE 1,000 HEALTH POINTS"
LET GETOUT = 0
LET Life = 1000
LET Minotaur = 1000
COLOR 10:
DO
INPUT pASSWORD$
IF pASSWORD$ = "MAGIC" THEN
Minotaur = Minotaur * .50
Life = Life - 230
PRINT "You did 50% damage! You got hit by the minotaur's RAM"
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The minotaur still has"; Minotaur
PRINT "life points. Make another move. Your options are MAGIC, or SWORD."
ELSE
PRINT "You hacked 300 damage! You got hit by the minotaur's GIGA IMPACT!"
Life = Life - 230
Minotaur = Minotaur - 300
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The minotaur still has"; Minotaur
PRINT "life points. Make another move. Your options are MAGIC, or SWORD."
END IF
IF Minotaur <= 0 OR Life <= 0 THEN GETOUT = 1
LOOP UNTIL GETOUT = 1
COLOR 20, 7:
IF Minotaur <= 0 THEN PRINT "You defeated the minotaur!"
IF Life <= 0 THEN PRINT "You got annihilated by the minotaur and have been slain."
Decision = StillWantsToPlay2
IF Life <= 0 AND Decision = TRUE2 THEN GOTO STARTALLOVER:
IF Decision = FALSE2 THEN GOTO OPTIONS:
COLOR 3, 0: PRINT "We are heading to the third floor for your final trial. How do you feel?"
INPUT pASSWORD$
IF pASSWORD$ = "GOOD" THEN PRINT "It's all good, just remember what you have learned." ELSE PRINT "It's all good, just remember what you have learned."
PRINT "We are heading towards the third floor now."
COLOR 15: PRINT "(The dragon awits your arrival) It says: I SHALL DISINTIGRATE YOU!!!"
LET GETOUT = 0
LET Life = 10000
LET Dragon = 10000
PRINT "Make your first move. Your options are MAGIC, or SWORD."
COLOR 10:
DO
INPUT pASSWORD$
IF pASSWORD$ = "MAGIC" THEN
Dragon = Minotaur * .50
Life = Life - 1000
PRINT "You did 50% damage! You got hit by the dragon's DRILL RUN!!!"
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The dragon still has"; Dragon
PRINT "life points. Make another move. Your options are MAGIC, or SWORD."
ELSE
PRINT "You hacked 300 damage! You got hit by the dragon's FLARE CRASH!!!"
Life = Life - 1000
Dragon = Dragon - 300
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The dragon still has"; Dragon
PRINT "life points. Make another move. Your options are MAGIC, or SWORD."
END IF
IF Dragon <= 0 OR Life <= 0 THEN GETOUT = 1
LOOP UNTIL GETOUT = 1
COLOR 20, 7:
IF Dragon <= 0 THEN PRINT "You defeated the dragon!"
COLOR 12, 0: PRINT TAB(23); "C O N G R A D U L A T I O N S ! ! ! You have won T O W E R T R I A L S"
IF Life <= 0 THEN PRINT "You got annihilated by the dragon and have been slain. You shall start over..."
Decision = StillWantsToPlay2
IF Life <= 0 AND Decision = TRUE2 THEN GOTO STARTALLOVER:
IF Decision = FALSE2 THEN GOTO OPTIONS:
COLOR 5: PRINT "(Word qickly spread of the victor of all three trials at the tower. It has never been done by any other challenger, wizard, nor even royal blood had completed the challenge.) This is your ceremony, on the roof of the tower. As promised"
COLOR 8: PRINT "You hear the king say: ... and here you are, your medal to show that you are the first in all the kingdom to complete the legendary challenge and I hereby claim you as CHAMPION of our kingd---"
COLOR 4: PRINT "(A rumble is felt on the ground and the distance you see a huge giant, as tall as the tower, coming to crash your party)"
COLOR 5: PRINT "It is only you who can save us all from the marauding giant. Your SWORD has been upgraded to FLAMING SWORD: does 1,000 damage; MAGIC: does 50% damage of what the marauding giant currently has. You both have 10,000 life points."
COLOR 14: PRINT "Your options are MAGIC, or FLAMING SWORD"
LET GETOUT = 0
LET Life = 10000
LET giant = 10000
COLOR 1:
DO
INPUT pASSWORD$
IF pASSWORD$ = "MAGIC" THEN
giant = giant * .50
Life = Life - 1500
PRINT "You did 50% damage! You got hit by the marauding giant's CRASH!"
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The marauding giant still has"; giant
PRINT "life points. Make another move. Your options are MAGIC, or SWORD."
COLOR 20, 7: ELSE PRINT "You hacked 1000 damage! You got hit by the marauding giant's HEAD SMASH!"
Life = Life - 1500
giant = giant - 1000
PRINT "You currently have"; Life
PRINT "life points."
PRINT "The marauding giant still has"; giant
PRINT "life points remaining. Make another move. Your options are MAGIC, or SWORD."
END IF
IF giant <= 0 OR Life <= 0 THEN GETOUT = 1
LOOP UNTIL GETOUT = 1
COLOR 4:
IF giant <= 0 THEN PRINT "You defeated the marauding giant in front of everybody! Good work, champion!"
IF Life <= 0 THEN PRINT "You got annihilated by the marauding giant and have been slain. You shall restart at the first trial..."
IF Life <= 0 THEN GOTO FIRSTTRIAL:
COLOR 17, 15: PRINT "You have won Tower Trials! Please play again soon."
COLOR 15, 0: PRINT "CREDITS"
COLOR 7: PRINT "Helped by Gregory Davidson and Albert Davidson. Everything else: Ethan Davidson."
COLOR 10, 0: PRINT "THE END... or to be continued"
END
Nibbles:
CLS
'[RDHY
'[E '
' Q B a s i c N i b b l e s
'
' Copyright (C) Microsoft Corporation 1990
'
' Nibbles is a game for one or two players. Navigate your snakes
' around the game board trying to eat up numbers while avoiding
' running into walls or other snakes. The more numbers you eat up,
' the more points you gain and the longer your snake becomes.
'
' To run this game, press Shift+F5.
'
' To exit QBasic, press Alt, F, X.
'
' To get help on a BASIC keyword, move the cursor to the keyword and press
' F1 or click the right mouse button.
'
'Set default data type to integer for faster game play
DEFINT A-Z
'User-defined TYPEs
TYPE snakeBody
row AS INTEGER
col AS INTEGER
END TYPE
'This type defines the player's snake
TYPE snaketype
head AS INTEGER
length AS INTEGER
row AS INTEGER
col AS INTEGER
direction AS INTEGER
lives AS INTEGER
score AS INTEGER
scolor AS INTEGER
alive AS INTEGER
END TYPE
'This type is used to represent the playing screen in memory
'It is used to simulate graphics in text mode, and has some interesting,
'and slightly advanced methods to increasing the speed of operation.
'Instead of the normal 80x25 text graphics using chr$(219) " ", we will be
'using chr$(220)"_" and chr$(223) " " and chr$(219) " " to mimic an 80x50
'pixel screen.
'Check out sub-programs SET and POINTISTHERE to see how this is implemented
'feel free to copy these (as well as arenaType and the DIM ARENA stmt and the
'initialization code in the DrawScreen subprogram) and use them in your own
'programs
TYPE arenaType
realRow AS INTEGER 'Maps the 80x50 point into the real 80x25
acolor AS INTEGER 'Stores the current color of the point
sister AS INTEGER 'Each char has 2 points in it. .SISTER is
END TYPE '-1 if sister point is above, +1 if below
'Sub Declarations
DECLARE SUB Intro ()
DECLARE SUB SpacePause (text$)
DECLARE SUB PrintScore (numplayers%, score1%, score2%, lives1%, lives2%)
DECLARE SUB GetInputs (numplayers, speed, diff$, monitor$)
DECLARE SUB DrawScreen ()
DECLARE SUB PlayNibbles (numplayers, speed, diff$)
DECLARE SUB Set (row, col, acolor)
DECLARE SUB Center (row, text$)
DECLARE SUB DoIntro ()
DECLARE SUB Initialize ()
DECLARE SUB SparklePause ()
DECLARE SUB Level (WhatToDO, sammy() AS snaketype)
DECLARE SUB InitColors ()
DECLARE SUB EraseSnake (snake() AS ANY, snakeBod() AS ANY, snakeNum%)
DECLARE FUNCTION StillWantsToPlay ()
DECLARE FUNCTION PointIsThere (row, col, backColor)
'Constants
'CONST TRUE = -1
'CONST FALSE = NOT TRUE
'CONST MAXSNAKELENGTH = 1000
'CONST STARTOVER = 1 ' Parameters to 'Level' SUB
'CONST SAMELEVEL = 2
'CONST NEXTLEVEL = 3
DIM SHARED TRUE AS INTEGER
DIM SHARED FALSE AS INTEGER
DIM SHARED MAXSNAKELENGTH AS INTEGER
DIM SHARED STARTOVER AS INTEGER
DIM SHARED SAMELEVEL AS INTEGER
DIM SHARED NEXTLEVEL AS INTEGER
TRUE = -1
FALSE = NOT TRUE
MAXSNAKELENGTH = 1000
STARTOVER = 1
SAMELEVEL = 2
NEXTLEVEL = 3
'Global Variables
DIM SHARED arena(1 TO 50, 1 TO 80) AS arenaType
DIM SHARED curLevel, colorTable(10)
RANDOMIZE TIMER
GOSUB ClearKeyLocks
Intro
GetInputs numplayers, speed, diff$, monitor$
GOSUB SetColors
DrawScreen
DO
PlayNibbles numplayers, speed, diff$
LOOP WHILE StillWantsToPlay
GOSUB RestoreKeyLocks
COLOR 15, 0
CLS
END
ClearKeyLocks:
DEF SEG = 0 ' Turn off CapLock, NumLock and ScrollLock
KeyFlags = PEEK(1047)
POKE 1047, &H0
DEF SEG
RETURN
RestoreKeyLocks:
DEF SEG = 0 ' Restore CapLock, NumLock and ScrollLock states
POKE 1047, KeyFlags
DEF SEG
RETURN
SetColors:
IF monitor$ = "M" THEN
RESTORE mono
ELSE
RESTORE normal
END IF
FOR a = 1 TO 6
READ colorTable(a)
NEXT a
RETURN
'snake1 snake2 Walls Background Dialogs-Fore Back
mono: DATA 15,7,7,0,15,0
normal: DATA 14,13,12,1,15,4
END
'Center:
' Centers text on given row
SUB Center (row, text$)
LOCATE row, 41 - LEN(text$) / 2
PRINT text$;
END SUB
'DrawScreen:
' Draws playing field
SUB DrawScreen
'initialize screen
VIEW PRINT
COLOR colorTable(1), colorTable(4)
CLS
'Print title & message
Center 1, "Nibbles!"
Center 11, "Initializing Playing Field..."
'Initialize arena array
FOR row = 1 TO 50
FOR col = 1 TO 80
arena(row, col).realRow = INT((row + 1) / 2)
arena(row, col).sister = (row MOD 2) * 2 - 1
NEXT col
NEXT row
END SUB
'EraseSnake:
' Erases snake to facilitate moving through playing field
SUB EraseSnake (snake() AS snaketype, snakeBod() AS snakeBody, snakeNum)
FOR c = 0 TO 9
FOR b = snake(snakeNum).length - c TO 0 STEP -10
tail = (snake(snakeNum).head + MAXSNAKELENGTH - b) MOD MAXSNAKELENGTH
Set snakeBod(tail, snakeNum).row, snakeBod(tail, snakeNum).col, colorTable(4)
NEXT b
NEXT c
END SUB
'GetInputs:
' Gets player inputs
SUB GetInputs (numplayers, speed, diff$, monitor$)
COLOR 7, 0
CLS
DO
LOCATE 5, 47: PRINT SPACE$(34);
LOCATE 5, 20
INPUT "How many players (1 or 2)"; num$
LOOP UNTIL VAL(num$) = 1 OR VAL(num$) = 2
numplayers = VAL(num$)
LOCATE 8, 21: PRINT "Skill level (1 to 100)"
LOCATE 9, 22: PRINT "1 = Novice"
LOCATE 10, 22: PRINT "90 = Expert"
LOCATE 11, 22: PRINT "100 = Twiddle Fingers"
LOCATE 12, 15: PRINT "(Computer speed may affect your skill level)"
DO
LOCATE 8, 44: PRINT SPACE$(35);
LOCATE 8, 43
INPUT gamespeed$
LOOP UNTIL VAL(gamespeed$) >= 1 AND VAL(gamespeed$) <= 100
speed = VAL(gamespeed$)
speed = (100 - speed) * 5 + 1
DO
LOCATE 15, 56: PRINT SPACE$(25);
LOCATE 15, 15
INPUT "Increase game speed during play (Y or N)"; diff$
diff$ = UCASE$(diff$)
LOOP UNTIL diff$ = "Y" OR diff$ = "N"
DO
LOCATE 17, 46: PRINT SPACE$(34);
LOCATE 17, 17
INPUT "Monochrome or color monitor (M or C)"; monitor$
monitor$ = UCASE$(monitor$)
LOOP UNTIL monitor$ = "M" OR monitor$ = "C"
' startTime# = TIMER ' Calculate speed of system
' FOR i# = 1 TO 1000: NEXT i# ' and do some compensation
' stopTime# = TIMER
'
' speed = speed * .5 / (stopTime# - startTime# + .01)
END SUB
'InitColors:
'Initializes playing field colors