forked from edgardo13/gitlabfall2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpgGame.c
executable file
·2032 lines (1875 loc) · 74.5 KB
/
rpgGame.c
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
//Contributors
//G. Poppe
//Shane Cortez
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <stdbool.h>
void extraCredit(void);
void ignoreExtra(void);
int choice1(int number);
int choice2(char *ptr);
int choice3(int number1);
void gameRules(); //function to explain rules of room 12 game
void gameCraps(); //function to run room 12 game
int main(void)
{
int x,y,z,i,h,g,k,choice=0;
char decision;
char name[256];
int boxNum=0;
// NEEDED FOR ROOM 7:
srand(time(NULL));
printf("Please enter your name: "); //Input any number of array inputs
scanf("%s",name);
printf("Hello %s welcome to the rpgGame!\n",name);
while(choice != 99)
{
puts("You find yourself in a dark room and you are not sure how you got here.");
puts("As you look around you see the room has 25 doors, each labeled with a number. You are not sure how such a small room can have 25 doors, sooo magic...");
puts("The room starts filling with water and you must choose a door to open or you will likely drown. you may quit anytime by selecting option 99");
puts("What door do you choose?");
scanf("%d",&choice);
switch(choice)
{
case 1:
{
int length = 0, num = 0, magicNum = 0;
char word[40] = "sacramento";
char *ptr;
ptr = word;
srand(time(NULL));
length = strlen(name);
for(i = 0; i < length;i++)
{
if(isupper(name[i]))
{
name[i] = tolower(name[i]);
}
}
name[0] = toupper(name[0]); //Making sure the name is written correctly with uppercase first letter
printf("Hello %s, you have entered the room 1.\n", name);
puts("You have survived the first part of your adventure..the Drowning.\n");
puts("You have 5 choices to make in order to escape this horror adventure. \n");
printf( "1. You have to solve a math problem for survival. \n"
"2. You have to guess the word for survival. \n"
"3. You have to find the magic number for survival. \n"
"4. Guess the word for survival. \n"
"5. Try to make a run for it. \n");
while(choice != 99)
{
puts("Make a choice(99 to quit): ");
scanf(" %d", &choice);
switch(choice)
{
case 1:
{
puts("You have chosen to solve the math problem. Don't forget you have one chance. Now choose a number between 1-10: ");
scanf(" %d", &num);
choice1(num);
return EXIT_SUCCESS;
break;
}
case 2:
{
puts("You have chosen to guess the word. What is the capital of California?\n");
choice2(ptr);
return EXIT_SUCCESS;
break;
}
case 3:
{
puts("Enter the magic number(between 1 - 20) from the following math problems: ");
magicNum = 1 + rand() % 20;
choice3(magicNum);
return EXIT_SUCCESS;
break;
}
case 4:
{
puts("Choice 4.");
break;
}
case 5:
{
puts("This was the wrong choice to be made. Now you have ended up in a room with nowhere to go....");
return EXIT_SUCCESS;
break;
}
}
}
break;
}
case 2:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 3:
{
while(choice != 99)
{
printf("%s", "You open the door and find ........\n");
printf("%s", "You see extra credit for CSC 251-01\n Do you chase it?\n");
printf("%s%s%s", "1) To chase it\n","2) Ignore the tempations of passing the class!\n","99) If you don't want to play anymore\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
extraCredit();
break;
case 2:
ignoreExtra();
break;
case 99:
break;
default:
printf("%s", "Please follow the directions!\nYou're going to back to spawn!\n");
break;
}
break;
}
break;
}
case 4:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 5:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 6:
{
while(choice != 99)
{
}
break;
}
case 7:
{
int enteredRoom = 0;
int chestLocked = 0;
char chestInventory[4][25] = {"bottle of rum", "dead cricket", "odd device"};
char playerInventory[4][25] = {"", "", "", ""};
int count = 0; // 0 is locked, 1 is open.
char item[25];
int bottle = 3;
while(choice != 99)
{
if(enteredRoom == 0) {
puts("You quickly grab the door knob and open the 7th door. The water causes you to fall and forces you into the room. You immediately get to your feet and grab the door nob from the inside and turn it. It's jammed! Clearly the water must be forcing it closed.");
enteredRoom++;
}
if(bottle == 3) {
puts("You scan the room and find a large chest at the foot of an old bed. You also find a small table near the right side of the bed with a dusty old book and a bottle of rum. ");
}
else {
puts("You scan the room and find a large chest at the foot of an old bed. You also find a small table near the right side of the bed with a dusty old book. ");
}
puts("***********************************************");
puts("At this point you have 3 choices:");
puts("");
puts("1. Examine the chest.");
if(bottle == 3) {
puts("2. Approach the small table and examine the book next to the bottle of rum.");
}
else if((bottle > 0)) {
puts("2. Have another swig of that bottle on the small table. Hell, you don't even notice the book right next to it at this point.");
}
else {
puts("2. Approach the small table and examine the book.");
}
puts("3. Take a nap.");
puts("");
puts("What do you choose?");
scanf("%d",&choice);
if(choice == 1)
{
if(chestLocked == 0) {
puts("***********************************************");
puts("You walk over to the dark end of the room and approach the chest near the foot of the bed. It is made mostly of oak with broad iron bands reinforcing it. You jiggle the clasp but it appears to be locked.");
puts("");
}
else {
puts("***********************************************");
puts("You open the chest and see the following:");
for(count; count < 3; count++) {
printf("%d. %s \n", count +1, chestInventory[count]);
}
puts("4. Close the chest.");
puts("Select an item number to add it to your inventory, or simply close the chest.");
scanf("%d",&choice);
/*
Insert code for moving item from the chest to the players inventory. (if logic)
*/
}
}
else if(choice == 2)
{
if(bottle == 3) {
puts("***********************************************");
puts("You approach the small table near the bed and pick up the book. It's a bit dusty with faded red lettering accross the cover. The title of the book is, 'Diary'.");
puts("");
puts("You open the book, and sift through the crumpled pages. It appears to be giberish full of what looks like complex equations and symbols. You move to the last page and you see a sketch for an odd looking device. At the header, the page reads, 'Odd Device!'. In the print below the sketch is a somewhat cryptic statement:'");
puts("");
puts("'Only this 'odd device' will get you out of this room. But there is huge risk in using it, so I locked it away.'");
puts("");
puts("After reading the book, you grab the bottle of rum, pop the cork and take a huge swig!");
puts("");
}
else {
puts("");
}
// Random drunk behavior!
x = 1 + rand()%10;
if((x <= 5) && (bottle > 0)) {
if(bottle != 3) {
puts("***********************************************");
}
if(bottle == 3) {
puts("Ahhh! Good stuff. You have a compelling desire for another drink. Maybe you have a problem.");
bottle--;
}
else {
puts("Mmm, this must be spiced rum. You can't resist another drink.");
bottle--;
}
}
else if (((x > 5) && (x < 10)) && (bottle > 0)) {
if(bottle != 3) {
puts("***********************************************");
}
else {
puts("");
}
puts("The rum is already starting to hit you. You begin to feel light headed.");
bottle--;
}
else if ((x == 10) || (bottle == 0)) {
if(bottle != 3) {
puts("***********************************************");
}
else {
puts("");
}
puts("Damn! The rum is powerful stuff. You begin to feel dizzy. You find yourself having a difficult time standing. You have a compelling desire to sing. As you contemplate what the words are to that song vaguely in your head. You stumble, fall, knocking your head on the edge of the table.");
puts("");
puts("....a day passes....");
puts("");
puts("Your eyes slowly open. Wow, what a headache! Slowly your eyes begin to come into focus. You realize you are laying on the floor on the side of the bed. Under the bed you can see the empty bottle tipped over. Something near it catches your eye.");
puts("");
puts("Next to the bottle you see a small rusted looking key.");
bottle = 0;
playerInventory[0] == "key";
}
else {
puts("There's really nothing more for you at this table. Move on...");
}
}
else if(choice == 3)
{
puts("***********************************************");
puts("It's been a long day. *yawn* After an hour or so of sleep, something wakes you up! Oh yes! There's an unexplained flood in the room outside of your jammed door.");
puts("");
puts("You jump out of bed, with a clearer mind. The rest did you well. You vaguely recall a dream about having read the dusty old book on the table next to you.");
puts("");
}
else
{
puts("wrong choice");
puts("");
}
}
// Need to code an exit out of the loop for room 7
}
case 8:
{
while(choice != 99)
{
puts("Erick Vargas' Door\n"); //I'll remove this once we submit the final product, it's just a reminder for me
puts("You enter door 8 and you find yourself on a tropical island. You see a small group of people running around collecting materials, what do you do?\n");
printf("1) Introduce yourself 2) Ask where you are 3) Just watch them 4) Ignore them 5) Try to avoid them\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
{
while(choice != 99)
{
puts("You walk up to them and introduce yourself to them, they happily greet you and introduce themselves to you. They ask where you are from, how do you respond?\n");
printf(" choose \n"); //prompt choices about how to answer.
scanf("%d",&choice);
}
break;
}
case 2:
{
while(choice != 99)
{
puts("You walk up to them and ask where you are, they look at you confusingly and tell you that the island your on is named Destiny Island. Still looking confused they ask where you came from, how do you respond?");
printf(" choose \n"); //prompt choices about how to answer.
scanf("%d",&choice);
}
break;
}
case 3:
{
while(choice != 99)
{
puts("From a distance you stay watching them, you just see that they continue running around collecting materials for some reason. As you keep watching them you notice that once they huddled up the girl of the group starts marking off on a checklist. You start to wonder more what they're trying to do, what do you do?");
printf(" choose \n"); //prompt choices about what to do.
scanf("%d",&choice);
}
break;
}
case 4:
{
while(choice != 99)
{
puts("You decide to just ignore them, what do you do instead?");
printf(" choose \n"); //prompt choices about what to do instead
scanf("%d",&choice);
}
break;
}
case 5:
{
while(choice != 99)
{
puts("Panicked, you decide to hide from them. Where do you choose to hide?");
printf(" choose \n"); //prompt choices of where to hide
scanf("%d",&choice);
}
break;
}
}
break;
}
}
case 9:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 10:
{
while(choice != 99)
{
puts("you open the door and find ........");
puts("A lottery machine?");
puts("Welcome to Fabian's room");
int n1,n2,n3,newrn1,newrn2,newrn3;
bool checkNum1;
bool checkNum2;
bool checkNum3;
srand(time(NULL));
printf("Enter the lottery by entering three numbers. Each 1 digit\n");
scanf(" %d %d %d",&n1,&n2,&n3);
newrn1 = rand()%10;
newrn2 = rand()%10;
newrn3 = rand()%10;
printf("Your numbers are: %d, %d, %d\n",n1,n2,n3);
printf("The winning lottery numbers are: %d, %d, %d\n",newrn1,newrn2,newrn3);
if(n1==newrn1 || n1==newrn2 || n1==newrn3)
{
checkNum1= true;
}
else
{
checkNum1=false;
}
if(checkNum1)
{
if (n1==newrn1)
{
newrn1=420;
}
else if (n1==newrn2)
{
newrn2=420;
}
else
{
newrn3=420;
}
}
if(n2==newrn1 || n2==newrn2 || n2==newrn3)
{
checkNum2= true;
}
else
{
checkNum2=false;
}
if(checkNum2)
{
if (n2==newrn1)
{
newrn1=420;
}
else if (n2==newrn2)
{
newrn2=420;
}
else
{
newrn3=420;
}
}
if(n3==newrn1 || n3==newrn2 || n3==newrn3)
{
checkNum3= true;
}
else
{
checkNum3=false;
}
if(checkNum3)
{
if (n3==newrn1)
{
newrn1=420;
}
else if (n3==newrn2)
{
newrn2=420;
}
else
{
newrn3=420;
}
}
if(checkNum1 && checkNum2 && checkNum3)
{
if(n1==newrn1 && n2==newrn2 && n3==newrn3)
{
printf("You've hit the jackpot of 1,000,000\n");
}
else
{
printf("You wont 1,000\n");
}
}
else if ((checkNum1 && checkNum2 || checkNum1 && checkNum3) || (checkNum2 && checkNum3))
{
printf("You've won $100\n");
}
else if (checkNum1 || checkNum2 || checkNum3)
{
printf("You won $10\n");
}
else
{
printf("You won nothing sorry!\n");
}
puts("choose a new room now if you dare... \n");
scanf("%d",&choice);
}
break;
}
case 11:
{
while(choice != 99)
{
puts("you open the door and find 3 more doors.");
puts("On the left there is a door with a Skull and Bones. In the middle the door has an Angel. On the right it has no symbol.\n");
puts("1. Open the Skull and Bones door. \n2. Open the Angel door. \n3. Open the no symbol door.\n");
scanf("%d", &choice);
if(choice == 1){
puts("You proceed to open the door with Skull and Bones on it.\n");
printf("A skeleton stands before you. \n'Hello %s would you like to play a game?'\nThe door behind you disappears so its not like you have a choice to say no...so you agree to play without knowing what kind of game.\n",name);
puts("[Skeleton]: Wonderful! Choose a hand *Giant Grin on his face*\n");
puts("1. Left \n2. Right\n");
scanf("%d", &choice);
if(choice == 1){
puts("[Skeleton]: *Laughs* Excellent choice. If you chose the other hand your soul would have been mine\n");
puts("[Skeleton]: Now lets play one final game. You can roll this 100 sided die and if you get anything higher than 55 you can leave here with a million dollars. Or you can walk through that door *Skeleton points to a new door as it rises from the ground*\n");
puts("1. Roll the die. \n2. Open the door\n");
scanf("%d", &choice);
if(choice == 1){
puts("[Skeleton]: *Evil Laughs* You have chosen the right path so far. However, I never told you what happens if you get anything below 55. If you land below 55 you have to stay here for the rest of your life guarding this door and I will finally be free! \n");
puts("Ready to roll?\n1. Yes\n2. No");
scanf("%d", &choice);
puts("[Skeleton]: Ahh who cares not like you have a choice! *Rolls die*\n");
srand(time(NULL));
int roll = rand()%100;
printf("%d\n",roll);
if(roll>55){
puts("Congrats you are free to exit out that door\n");
puts("\n The door just leads you straight to where you started\n");
break;
}else{
puts("[Skeleton]: Finally I'm free!");
puts("You are not stuck in this room for eternity...");
choice = 99;
break;
}
}else if(choice == 2){
puts("[Skeleton]: Did you really think I would let you live?");
puts("You have died to a Skeleton \n");
break;
}
}else if (choice == 2){
puts("[Skeleton]: Thank you for playing. *He puts his hand over your head*\n");
puts("You have died try again!\n");
break;
}
}else if(choice == 2){
puts("You proceed to open the door with an Angel on it.\n");
puts("Welcome! You need to guess the following word or you can't come to heaven.\n");
puts("You can not get 1 letter wrong or you lose \n");
puts("What is yellow and can be found in water?\n");
char answer[20] = {'d', 'u','c','k'};
char guess[20];
int x = 0;
char letter;
while (x < 6){
scanf(" %c",&letter);
if (letter == answer[x]){
guess[x]= letter;
printf("keep going\n");
if(letter == 'k'){
puts("Congrats you guess the correct word: DUCK!\n");
break;
}
}else{
printf("You failed sorry!\n");
printf("\n");
break;
}
++x;
}
break;
}else if(choice == 3){
puts("You proceed to open the blank door.\n");
puts("You enter the room and its filled with clocks. Every clock instantly stops ticking and your vision slowly fades to black. You close your eyes hoping you get your vision back, but you open them and you are no longer in the room. Instead you you are placed straight back to where you started with the option to choose any room.");
break;
}
}
break;
}
case 12:
{
while(choice != 99)
{
puts("you open the door and find you've entered room 12........\n");
char response, temp; //char variables needed for game to work
{
printf("Since you're here and brave, will you take a chance and play a game of cards? Enter 'y' twice for yes or '99' to leave at any time...\n");
response = getchar(); //set response to equal user's input
temp = getchar(); //set temp value to equal user's input
if(response == 'y' || response == 'Y') //if answer is equal to letter 'y' or 'Y'...
{
gameRules(); //simple function that prints game rules for user before game begins
gameCraps(); //calls main game function
}
else if(response == 99) //had issues modifying this code to run no...using escape 99 for now to to exit game...
{
puts("You don't want to play, but you'll be back. Goodbye for now... >:D");
break;
}
}
scanf("%d", &choice); //scan in user's input for choice...
}
break;
}
case 13:
{
while(choice != 99)
{
puts("As your hand reaches for the 13th door you think about all the superstitions related to the number 13.");
puts("However, you open it anyways and you find yourself in a large dark room that is immedietly cold and nothing is visible.");
puts("Although the room is pitch black you cant even see your hands, you stop and look to your right when something catches your eye.");
puts("A samll bright light is floating in the distance, close enough to see but far enough to not be able to know what it is.");
puts("Do you walk towards the light or do you wak in the opposite direction.");
puts("1. Walk towards the light.");
puts("2. Walk in the other direction.");
scanf("%d",&choice);
if(choice == 1)
{
puts("feeling curious you walk towards the light.");
puts("As your walking, the light gets brighter and slowly getting closer until you feel a sudden rush of cold air on your left shoulder.");
puts("You look over and see a ghost like hand resting on your shoulder");
printf("It whispers into your ear with a low grungy voice \"%s turn around, I can give you anything you want \" \n",name);
puts("Do you turn around or keep walking towards the light?");
puts("1. Continue walking towards the light.");
puts("2. Turn around and face this mysterious voice");
scanf("%d", &choice);
if(choice == 1)
{
puts("Overcoming your curiosity once more, you continue walking towards the light,");
puts("As you get closer to the light you can now see a forest and wonder if this is the way out.");
puts("However, you once more hear this voice different from before.");
}
break;
}
else if(choice == 2)
{
puts("Not knowing what this light could be you decide to turn around and head deeper into the unknown darkness.");
puts("...more to come...");
break;
}
else
{
puts("Wrong choice");
}
}
break;
}
case 14:
{//Velasco,Jesse
srand(time(NULL));
//Room 1
//Magic Number
int mn = 7;
//Universal Response variable
int response;
//Room 2
int ClassScores = 1 + rand()%10;
int a,b,c,d,f;
//Room 3
int counter = 0;
int one,two,three,four,five,six;
int number = 0;
int guess = 0;
while(choice != 99)
{
printf("Desperately.You push door 14 open\n");
printf("Once inside you bear your entire weight against the door to slam it shut.\n");
printf("Recuperated you look around to find a door with an inscription attached to it via a wooden tablet fixated above the archway\n");
printf("Its a game.\n");
printf("Guess the magic number and you'll be allowed passage. Fail.Passage to the underworld will be granted instead\n");
printf("Welp.Time to take your shot.Good luck.\n");
printf("Enter a number between 1 and 10\n");
scanf("%d", &response);
while(response < 1 || response > 10)
{
printf("Please enter a number between 1 and 10 inclusively\n");
scanf("%d",&response);
}
printf("%d + magic number = %d\n",response,(response + mn));
printf("%d * magic number = %d\n",response,(response * mn));
printf("%d - magic number = %d\n",response,(response - mn));
printf("What is your guess? It states.\n");
scanf("%d",&response);
if(response == mn)
{
printf("You are correct! The door opens. You pass through with no issues.\n");
}
else
{
printf("Oh no. You guessed wrong.\n");
printf("The ceiling begins to lower. Looks like its game over.\n");
printf("Thanks for playing!\n");
exit(0);
}
//Room 2
printf("You enter an empty classroom.\n");
printf("A monitor begins to lower from the ceiling.\n");
printf("\"Samsung\" you notice. Nice.\n");
printf("On the screen a grading scale is shown.\n");
printf("A = 4.0, B = 3.0, C = 2.0, D = 1.0,F = 0\n");
printf("There are %d A's\n", a = 1 + rand()%10);
printf("There are %d B's\n", b = 1 + rand()%10);
printf("There are %d C's\n", c = 1 + rand()%10);
printf("There are %d D's\n", d = 1 + rand()%10);
printf("What is the average?\n");
scanf("%d",&response);
if(response == ((a*4) + (b*3) + (c*2) + (d*1) + (f*0)))
{
printf("Like a teacher you graded it! Nice job!\n");
printf("The room walls begin to shake as the one in front of you begins to open up. Revealing a secret tunnel.\n");
printf("You push on.\n");
}
else
{
printf("Looks like this is where you dropout.\n");
printf("Thanks for playing!\n");
exit(0);
}
//Room 3 HAS BUG
printf("As you exit the tunnel you find yourself in a casino\n");
printf("Oddly enough there is only one table with a single seat directly ahead of you.\n");
printf("You approach the table cautiously. The dealer says \"Do not be afraid. I will only take what you are willing to give\" he laughs. Try your luck.\n");
printf("The game is simple. Pick a number and guess the number of times that number will be rolled. The die will be rolled 10 times.\n");
printf("\"What are you willing to bet?\" asks the dealer.\n");
printf("Having nothing of value you bet what you have. Your life. A true gambler at heart.\n");
printf("\"Very well. I accept your bet. \"\n");
for(int i = 0 ; i < 10 ; i++)
{
counter = 1 + rand()%6;
switch(counter)
{
case 1:
one += 1;
break;
case 2:
two += 1;
break;
case 3:
three += 1;
break;
case 4:
four += 1;
break;
case 5:
five += 1;
break;
case 6:
six += 1;
break;
}
}
printf("Now state the number you would like to bet on between 1 and 6.\n");
scanf("%d",&number);
if(number < 1 || number >6)
{
printf("Please pick a number between 1 and 6 for your bet.\n");
scanf("%d",&number);
}
switch(number)
{
case 1:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (one - 1) || guess <= (one + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",one);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
case 2:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (two - 1) || guess <= (two + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",two);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
case 3:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (three - 1) || guess <= (three + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",three);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
case 4:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (four - 1) || guess <= (four + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",four);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
case 5:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (five - 1) || guess <= (five + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",five);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
case 6:
printf(" Now guess how many times that number has been rolled. You have a rage of 1 above and below the number. Good luck!\n");
scanf("%d",&guess);
if(guess >= (six - 1) || guess <= (six + 1))
{
printf("Your guess: %d\n", guess);
printf("# of rolls: %d\n",six);
printf("You win! You get to keep your life ,and get passage on.\n");
}
else
{
printf("I'm afraid you'll be cashing out now.\n");
printf("Thanks for playing!\n");
exit(0);
}
}
printf("To be cont.\n" );
}
break;
}
case 15:
{
while(choice != 99)
{
}
break;
}
case 16:
{
while(choice != 99)
{
}
break;
}
case 17:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 18:
{
while(choice != 99)
{
}
break;
}
case 19:
{
while(choice != 99)
{
puts("you open the door and find ........");
scanf("%d",&choice);
}
break;
}
case 20:
{
int level = 0,attack = 0,magic = 0,health = 0,defense = 0,totalHP = 0;
bool NEW = true;
srand(time(NULL));
while(choice != 99)
{
/*puts("you open the door and find ........");
scanf("%d",&choice);*/
bool gameLoop = false;
int option = 0;
int levelF = level;
int healthPOT = 3;
int damage = 0;
bool magician = false;
bool warrior = false;
bool loss = false;
int multiplier = 0;
char goblin[10] = "Goblin";
char zombie[10] = "Zombie";
char giant[10] = "Giant";
char highSumm[25] = "High Summoner";
char quetzal[25] = "God Quetzalcoatl";
char goblinATT[50] = "The Goblin takes his tiny shiv and cuts you.";
char zombieATT[50] = "The Zombie lunges forward and bites you.";
char giantATT[80] = "The Giant takes his club and strikes you in the chest";
char highATT[100] = "The High Summoner casts a large cloud above you and calls down a bolt of lightning.";
char quetzalATT[100] = "Quetzalcoatl, The Creator, blasts you with a blue stream of fire.";
while(NEW)
{
puts("Pick your class.");
puts("_________________________________________");
puts("1. Warrior.");
puts("2. Magician.");
puts("3. Exit.");
scanf(" %d",&option);
switch(option)
{