SHOW:
|
|
- or go back to the newest paste.
1 | #include <stdio.h> | |
2 | #include <stdlib.h> | |
3 | #include <stdbool.h> | |
4 | ||
5 | int main() | |
6 | { | |
7 | - | int amountOfCookies=0, cookiePower=10, alternateCookiePower; |
7 | + | int amountOfCookies=0, cookiePower=10, alternateCookiePower, exitIntro=0; |
8 | - | int cookieInputNumber=1, alternateCookieInputNumber, shopAccessNumber=0; |
8 | + | int cookieClickNumber=1, alternateCookieClickNumber, showCookiesNumber=2, showBoughtItems=3; |
9 | - | int showCookiesNumber=2, changeControlsNumber=101, showControlsNumber=100, quitGameNumber=69; |
9 | + | int shopAccessNumber=0, showControlMenu=100; |
10 | - | int cookieModeInput, shopModeInput; |
10 | + | int showControlsNumber=1, showSaveCodeNumber=2, quitGameNumber=3; |
11 | int cookieModeInput, shopModeInput, controlModeInput=-1; | |
12 | - | bool saveCode=0, intro=1, changeControls=0, keepControls=0, correctControls=0, quitGame=0, inGame=1, cookieMode=1, shopMode=0, shopEnteredBefore=0, boughtSomething=1, firstTimeAtIntro=1;; |
12 | + | |
13 | bool saveCode=0, printMessage=1, inGame=1, cookieMode=1, shopMode=0, controlMode=0, shopEnteredBefore=0; | |
14 | bool boughtSomething=1, generateSaveCodeBeforeExit=0, sureToQuit=0, quitLoop=1; | |
15 | printf("Welcome to Cookie Clicker!\nDo you have a save code?(1 for yes, 0 for no).\n"); | |
16 | scanf("%d", &saveCode); | |
17 | - | intro=0; |
17 | + | |
18 | { | |
19 | printf("Load: "); | |
20 | scanf("%d %d %d", &amountOfCookies, &cursorNumber, &bakerNumber); | |
21 | cookiePower+=cursorNumber; | |
22 | - | printf("Please try again!"); |
22 | + | exitIntro=1; |
23 | - | if (intro==1) |
23 | + | |
24 | else if (saveCode!=0) | |
25 | - | printf("In the beginning, you get 1 cookie each time.\nYou can buy things to help you with getting more cookies.\n"); |
25 | + | printf("Please try again!"); |
26 | - | printf("In case you want to other controls, \ntype in %d anywhere during the game.\n", showControlsNumber); |
26 | + | if (exitIntro==0) |
27 | - | printf("Do you wish to change the default controls?(1 for yes, 0 for no)\n"); |
27 | + | |
28 | - | scanf("%d", &changeControls); |
28 | + | printf("In the beginning, you get 10 cookie each time.\nYou can buy things to help you with getting more cookies.\n"); |
29 | - | if (changeControls==0) |
29 | + | printf("To access the controls menu, \ntype in %d anywhere during the game.\n", showControlMenu); |
30 | printf("Press 1 to continue.\n"); | |
31 | - | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTo click a cookie, use %d\nTo go to the shop, use %d\n", cookieInputNumber, shopAccessNumber); |
31 | + | scanf("%d", &exitIntro); |
32 | - | intro=0; |
32 | + | while (exitIntro!=1) |
33 | { | |
34 | printf("Please try again.\n"); | |
35 | - | while (quitGame==0) |
35 | + | scanf("%d", &exitIntro); |
36 | } | |
37 | - | while (changeControls==1) |
37 | + | |
38 | } | |
39 | - | printf("What number do you want to use to click the cookies?(default \"%d\")\n",cookieInputNumber); |
39 | + | while(inGame==1) |
40 | - | scanf("%d",&cookieInputNumber); |
40 | + | |
41 | - | printf("What number for shop?(default \"%d\")\n", shopAccessNumber); |
41 | + | if (printMessage==1) |
42 | - | scanf("%d",&shopAccessNumber); |
42 | + | |
43 | - | if (shopAccessNumber!=cookieInputNumber) |
43 | + | printf("\nStart fabricating cookies!\nHave fun!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
44 | - | correctControls=1; |
44 | + | printMessage=0; |
45 | - | while (correctControls==0) |
45 | + | |
46 | while (controlMode==1) | |
47 | - | printf("You can't do that. Please try again"); |
47 | + | |
48 | - | scanf("%d", &shopAccessNumber); |
48 | + | quitLoop=1; |
49 | - | if (shopAccessNumber!=cookieInputNumber) |
49 | + | printf("Control Menu\n\n<1> Show Controls\n<2> Generate Save Code\n<3> Quit Game\n"); |
50 | - | correctControls=1; |
50 | + | if (controlModeInput==-1) |
51 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | |
52 | - | printf("What number do you want to use to show\nthe amount of cookies you have at anytime(default \"%d\")?\n", showCookiesNumber); |
52 | + | else if (controlModeInput<-1 || controlModeInput>quitGameNumber) |
53 | - | scanf("%d", &showCookiesNumber); |
53 | + | |
54 | - | printf("Do you want to keep these controls?(1 for yes, 0 for no)\n"); |
54 | + | printf("\n\n"); |
55 | - | scanf("%d", &keepControls); |
55 | + | printf("Unknown command"); |
56 | - | changeControls=!keepControls; |
56 | + | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
57 | - | if (changeControls==0) |
57 | + | |
58 | - | inGame=1; |
58 | + | else if (controlModeInput==showControlsNumber) |
59 | - | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
59 | + | |
60 | printf("\n\n"); | |
61 | - | if (firstTimeAtIntro==1) |
61 | + | printf("Controls\n"); |
62 | printf("Click cookie: %d\n", cookieClickNumber); | |
63 | - | printf("Start fabricating cookies!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
63 | + | printf("Go to shop: %d\n", shopAccessNumber); |
64 | - | firstTimeAtIntro=0; |
64 | + | printf("Access Control Menu: %d\n", showControlMenu); |
65 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); | |
66 | - | else |
66 | + | |
67 | - | printf("Get back to cookie fabricating!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
67 | + | else if (controlModeInput==showSaveCodeNumber) |
68 | - | alternateCookieInputNumber=cookieInputNumber*11; |
68 | + | |
69 | - | while(inGame==1) |
69 | + | printf("\n\n"); |
70 | printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber); | |
71 | - | while(cookieMode==1) |
71 | + | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
72 | } | |
73 | - | if (shopEnteredBefore==1) |
73 | + | else if (controlModeInput==0) |
74 | - | printf("Welcome back to your cookie fabricator!\n"); |
74 | + | |
75 | - | alternateCookiePower=cookiePower*2; |
75 | + | controlMode=0; |
76 | - | scanf("%d",&cookieModeInput); |
76 | + | cookieMode=1; |
77 | - | if (cookieModeInput==cookieInputNumber) |
77 | + | controlModeInput=-1; |
78 | } | |
79 | - | amountOfCookies+=cookiePower; |
79 | + | scanf("%d", &controlModeInput); |
80 | - | if (cookiePower==1) |
80 | + | if (controlModeInput==quitGameNumber) |
81 | - | printf("Made %d cookie!\n", cookiePower); |
81 | + | |
82 | printf("Are you sure you want to quit the game? (1 for yes, 0 for no)\n"); | |
83 | - | printf("Made %d cookies!\n", cookiePower); |
83 | + | scanf("%d", &sureToQuit); |
84 | while (quitLoop==1) | |
85 | - | else if (cookieModeInput==alternateCookieInputNumber) |
85 | + | |
86 | if (sureToQuit==1) | |
87 | - | amountOfCookies+=alternateCookiePower; |
87 | + | |
88 | - | printf("Made %d cookies!\n", alternateCookiePower); |
88 | + | controlMode=0; |
89 | inGame=0; | |
90 | - | else if (cookieModeInput==showCookiesNumber) |
90 | + | quitLoop=0; |
91 | - | printf("Cookies: %d\n", amountOfCookies); |
91 | + | |
92 | - | else if (cookieModeInput==shopAccessNumber) |
92 | + | else if (sureToQuit==0) |
93 | { | |
94 | - | cookieMode=0; |
94 | + | controlModeInput=-1; |
95 | - | shopMode=1; |
95 | + | quitLoop=0; |
96 | } | |
97 | - | else if (cookieModeInput==changeControlsNumber) |
97 | + | |
98 | } | |
99 | - | changeControls=1; |
99 | + | |
100 | - | cookieMode=0; |
100 | + | while(cookieMode==1) |
101 | - | inGame=0; |
101 | + | |
102 | alternateCookieClickNumber=cookieClickNumber*11; | |
103 | - | else if (cookieModeInput==quitGameNumber) |
103 | + | alternateCookiePower=cookiePower*2; |
104 | scanf("%d",&cookieModeInput); | |
105 | - | cookieMode=0; |
105 | + | if (cookieModeInput==cookieClickNumber) |
106 | - | inGame=0; |
106 | + | |
107 | - | quitGame=1; |
107 | + | amountOfCookies+=cookiePower; |
108 | printf("Made %d cookies!\n", cookiePower); | |
109 | - | else if (cookieModeInput==showControlsNumber) |
109 | + | |
110 | else if (cookieModeInput==alternateCookieClickNumber) | |
111 | - | printf("To click cookies: %d\nTo show amount of cookies: %d\n", cookieInputNumber, showCookiesNumber); |
111 | + | |
112 | - | printf("To go to the shop: %d\nTo change controls: %d\n", shopAccessNumber, changeControlsNumber); |
112 | + | amountOfCookies+=alternateCookiePower; |
113 | - | printf("To show controls again: %d\nTo quit the game: %d\n", showControlsNumber, quitGameNumber); |
113 | + | printf("Made %d cookies!\n", alternateCookiePower); |
114 | - | printf("Got it? Ok resume collecting cookies!\n"); |
114 | + | |
115 | else if (cookieModeInput==showCookiesNumber) | |
116 | printf("Cookies: %d\n", amountOfCookies); | |
117 | - | if (shopMode==1) |
117 | + | else if (cookieModeInput==shopAccessNumber) |
118 | { | |
119 | - | if (shopEnteredBefore==0) |
119 | + | cookieMode=0; |
120 | shopMode=1; | |
121 | - | printf("Welcome to the shop!(Exit:0)\n"); |
121 | + | |
122 | - | shopEnteredBefore=1; |
122 | + | else if (cookieModeInput==showControlMenu) |
123 | { | |
124 | controlMode=1; | |
125 | - | printf("Welcome back to the shop!\n"); |
125 | + | cookieMode=0; |
126 | - | while (shopMode==1) |
126 | + | |
127 | } | |
128 | - | cursorPrice=500+(cursorNumber*cursorNumber*400); |
128 | + | if (shopMode==1) |
129 | - | bakerPrice=1000+(cursorNumber*cursorNumber*600); |
129 | + | |
130 | - | if (boughtSomething==1) |
130 | + | if (shopEnteredBefore==0) |
131 | { | |
132 | - | printf("Cookies: %d\n\n", amountOfCookies); |
132 | + | printf("Welcome to the shop!(Exit:0)\n"); |
133 | - | printf("Number\t\t%-4s\t\t%-10s", "Name", "Price\t\tYou Have\tAdded CPC\n"); |
133 | + | shopEnteredBefore=1; |
134 | - | printf("<1>\t\t%s(1)\t%-d\t\t%d\t\t%d\n", "Cursor", cursorPrice, cursorNumber, cursorNumber); |
134 | + | |
135 | - | printf("<2>\t\t%s(5)\t%-d\t\t%d\t\t%d\n", "Baker", bakerPrice, bakerNumber, bakerNumber*5); |
135 | + | else |
136 | printf("Welcome back to the shop!\n"); | |
137 | while (shopMode==1) | |
138 | - | printf("You only have %d cookies.\n", amountOfCookies); |
138 | + | |
139 | - | scanf("%d",&shopModeInput); |
139 | + | cursorPrice=500+(cursorNumber*cursorNumber*400); |
140 | - | if (shopModeInput==1) |
140 | + | bakerPrice=1000+(cursorNumber*cursorNumber*600); |
141 | boughtSomething=1; | |
142 | - | if (amountOfCookies>=cursorPrice) |
142 | + | if(boughtSomething==1) |
143 | - | { |
143 | + | |
144 | - | printf("You bought 1 Cursor for %d\n", cursorPrice); |
144 | + | printf("Cookies: %d\n\n", amountOfCookies); |
145 | - | cursorNumber++; |
145 | + | printf("Number\t\t%-4s\t\t%-10s", "Name", "Price\t\tYou Have\tAdded CPC\n"); |
146 | - | cookiePower++; |
146 | + | printf("<1>\t\t%s(1)\t%-d\t\t%d\t\t%d\n", "Cursor", cursorPrice, cursorNumber, cursorNumber); |
147 | - | amountOfCookies-=cursorPrice; |
147 | + | printf("<2>\t\t%s(5)\t%-d\t\t%d\t\t%d\n", "Baker", bakerPrice, bakerNumber, bakerNumber*5); |
148 | - | boughtSomething=1; |
148 | + | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
149 | - | } |
149 | + | |
150 | - | else |
150 | + | |
151 | - | { |
151 | + | printf("You only have %d cookies.\n", amountOfCookies); |
152 | - | printf("You don't have enough cookies.\n"); |
152 | + | scanf("%d",&shopModeInput); |
153 | - | boughtSomething=0; |
153 | + | if (shopModeInput==1) |
154 | - | } |
154 | + | |
155 | if (amountOfCookies>=cursorPrice) | |
156 | - | else if (shopModeInput==2) |
156 | + | |
157 | printf("You bought 1 Cursor for %d\n", cursorPrice); | |
158 | - | if (amountOfCookies>=bakerPrice) |
158 | + | cursorNumber++; |
159 | - | { |
159 | + | cookiePower++; |
160 | - | printf("You bought 1 Baker for %d\n", bakerPrice); |
160 | + | amountOfCookies-=cursorPrice; |
161 | - | cursorNumber++; |
161 | + | boughtSomething=1; |
162 | - | cookiePower++; |
162 | + | |
163 | - | amountOfCookies-=bakerPrice; |
163 | + | |
164 | - | boughtSomething=1; |
164 | + | |
165 | - | } |
165 | + | printf("You don't have enough cookies.\n"); |
166 | - | else |
166 | + | boughtSomething=0; |
167 | - | { |
167 | + | |
168 | - | printf("You don't have enough cookies.\n"); |
168 | + | |
169 | - | boughtSomething=0; |
169 | + | else if (shopModeInput==2) |
170 | - | } |
170 | + | |
171 | if (amountOfCookies>=bakerPrice) | |
172 | - | else if (shopModeInput==0) |
172 | + | |
173 | printf("You bought 1 Baker for %d\n", bakerPrice); | |
174 | - | printf("You have exit the shop.\n"); |
174 | + | cursorNumber++; |
175 | - | shopMode=0; |
175 | + | cookiePower++; |
176 | - | cookieMode=1; |
176 | + | amountOfCookies-=bakerPrice; |
177 | boughtSomething=1; | |
178 | } | |
179 | else | |
180 | { | |
181 | printf("You don't have enough cookies.\n"); | |
182 | - | printf("Keep this code safe.\n"); |
182 | + | boughtSomething=0; |
183 | - | printf("%d %d %d\n", amountOfCookies, cursorNumber, bakerNumber); |
183 | + | |
184 | } | |
185 | else if (shopModeInput==0) | |
186 | { | |
187 | printf("You have exit the shop, welcome back to your cookie fabricator!\n"); | |
188 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | |
189 | boughtSomething=0; | |
190 | shopMode=0; | |
191 | cookieMode=1; | |
192 | } | |
193 | } | |
194 | } | |
195 | } | |
196 | printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); | |
197 | printf("Do you want to generate a save code before leaving?\n"); | |
198 | scanf("%d", &generateSaveCodeBeforeExit); | |
199 | if (generateSaveCodeBeforeExit==1) | |
200 | printf("Save Code: %d %d %d\n", amountOfCookies, cursorNumber, bakerNumber); | |
201 | else | |
202 | printf("Ok then.\n"); | |
203 | return 0; | |
204 | } |