-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowershell_version.ps1
565 lines (565 loc) · 18 KB
/
powershell_version.ps1
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
$host.UI.RawUI.WindowTitle="The Riddle Quiz Version 2.1.1";
$host.UI.RawUI.ForegroundColor="Green";
$host.UI.RawUI.BackgroundColor="Black";
function bpause
{
Write-Host "Press any key to continue...";
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown");
}
function jpause
{
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown");
}
function read
{
Write-Host $args[0] -NoNewline;
PSConsoleHostReadline;
}
function q1
{
Write-Host "Question One:";
Write-Host "";
$q1 = read "What's 9 + 10? ";
if ( $q1 -ceq "19" )
{
Clear-Host;
Write-Host "Ok, so you're not stupid.";
Write-Host "";
Write-Host "Don't worry though, every question is slightly harder than the last";
$global:score += 1;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q2;
}
else
{
gameover;
}
}
function q2
{
Write-Host "Question Two:";
Write-Host "";
$q2 = read "How many feet are in a mile? ";
if ( $q2 -ceq "5280" )
{
Clear-Host;
Write-Host "Great, you got another question correct. Let's see if you can get this next one right.";
$global:score += 1;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q3;
}
else
{
gameover;
}
}
function q3
{
Write-Host "Question Three:";
Write-Host "";
Write-Host "What is the last name of the candidate who won the 1968 Presidential Election?";
Write-Host "Remember answer in all lower case!";
$q3 = read "Answer: ";
if ( $q3 -ceq "nixon" )
{
Clear-Host;
Write-Host "Impressive, I hope you like riddles because that's what you've got next.";
$global:score += 1;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q4;
}
else
{
gameover;
}
}
function q4
{
Write-Host "Question Four";
Write-Host "";
Write-Host "A spirited jig it dances bright,";
Write-Host "Banishing all but darkest night.";
Write-Host "Give it food and it will live;";
Write-Host "Give it water and it will die";
Write-Host "";
$q4 = read "What am I? ";
if ( $q4 -ceq "fire" )
{
Clear-Host;
Write-Host "Nice, the next problem is a another riddle";
$global:score += 1;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q5;
}
else
{
gameover;
}
}
function q5
{
Write-Host "The life I lead is mere hours or less,";
Write-Host "I serve all my time by being consumed.";
Write-Host "I am quickest when thin, slowest when fat,";
Write-Host "And wind is the bane of the gift that I bring.";
Write-Host "";
$q5 = read "What am I? ";
if ( $q5 -ceq "candle" )
{
Clear-Host;
$host.UI.RawUI.WindowTitle="You've Almost Won $id";
Write-Host "Congrats you've almost made it to the end of the quiz!";
Write-Host "You've only got three more problems to go, and from now on points are worth triple their previous value!";
Write-Host "";
Write-Host "The next question is a math problem...";
$global:score += 1;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q6;
}
else
{
gameover;
}
}
function q6
{
$q6 = read "If you add up all the natural numbers (1 + 2 + 3 + 4 + 5...), what does it equal? ";
if ( $q6 -ceq "-1/12" )
{
Clear-Host;
Write-Host "Wow, I didn't expect you to get that one";
Write-Host "The next one is very difficult";
$global:score += 3;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q7;
}
else
{
gameover;
}
}
function q7
{
Write-Host "A fast food restaurannt sells chicken in orders of 6, 9, and 20.";
Write-Host "What is the largest number of pieces of chicken you cannot order from this restaurant.";
$q7 = read "Only answer the number please. ";
if ( $q7 -ceq "43" )
{
Clear-Host;
Write-Host "Very impressive, only one more problem to go... and this one's worth 5 points";
Write-Host "";
$global:score += 3;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q8;
}
else
{
gameover;
}
}
function q8
{
Write-Host "You have been given the task of transporting 3,000 apples 1,000 miles from ";
Write-Host "Appleland to Bananaville. Your truck can carry 1,000 apples at a time. Every ";
Write-Host "time you travel a mile towards Bananaville you must pay a tax of 1 apple, but";
Write-Host "you pay nothing when going in the other direction (towards Appleland).";
Write-Host "";
Write-Host "What is the highest number of apples you can get to Bananaville?";
Write-Host "";
$q8 = read "Only write the number please. ";
if ( $q8 -ceq "833" )
{
Clear-Host;
$host.UI.RawUI.WindowTitle = "You Win easy mode $id";
Write-Host "Wow you've gotten all these problems correct";
Write-Host "Congratulation you Win!";
$global:score += 5;
Write-Host "Your score is now: $score";
bpause;
winGame;
}
else
{
gameover;
}
}
function winGame
{
Clear-Host;
$hardmode = read "Would you like to continue to hard mode? Y or N: ";
if ( $hardmode -ceq "Y" )
{
Write-Host "These problems will challenge even the smartest of people...";
Start-Sleep 2;
bpause;
q9;
}
win2;
}
function win2
{
Write-Host "Thanks for playing, your score has been recorded!";
Write-Out "" > "$chooser\$id's_score.txt";
Write-Out "Your score was $score " >> "$chooser\$id's_score.txt";
Write-Out "Congratulations on winning, please play again when it is updated! " >> "$chooser\$id's_score.txt";
Write-Host "";
$winGame = read "Would you like to see the credits? Y or N: ";
if ( $winGame -ceq "Y" )
{
credits;
}
}
function credits
{
Clear-Host;
Write-Host "Main developer - Garrett Smith";
Write-Host "Graphics developer - Garrett Smith";
Write-Host "Story line director - Garrett Smith";
Write-Host "Question designer - Garrett Smith";
Write-Host "Easter Egg developer - Garrett Smith";
Write-Host "Question error fix - Zachary Taylor";
Write-Host "Translation from Batch to Powershell - Zachary Taylor";
Write-Host "All other major roles - Garrett Smith";
Write-Host "";
Write-Host "Thanks for playing! Press any key to close this window.";
jpause;
taskkill /f /im "powershell.exe";
}
function q9
{
Clear-Host;
Write-Host "Question 9";
Write-Host "";
Write-Host "It is greater than God and more evil than the devil. The poor have it, the rich need it and if you eat it you'll die. What is it?";
$q9 = read "Answer: ";
if ( $q9 -ceq "nothing" )
{
Clear-Host;
$host.UI.RawUI.WindowTitle = "HARDCORE MODE";
Write-Host "I bet you won't get the next one..."l
Write-Host "Oh yeah, your problems are now worth 10 points each";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q10;
}
else
{
gameover;
}
}
function q10
{
Write-Host "Question 10";
Write-Host "";
Write-Host "The Fibonacci Sequence is a series of numbers.";
$q10 = read "What type of series is it? ";
if ( $q10 -ceq "divergent" )
{
Clear-Host;
Write-Host "Impressive, another 10 points added to your score.";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q11;
}
else
{
gameover;
}
}
function q11
{
$q11 = read "The sum of the reciprocals of all powers of 2 equals what number? ";
if ( $q11 -ceq "2" )
{
Clear-Host;
Write-Host "Congrats, you get another 10 points!";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q12;
}
else
{
gameover;
}
}
function q12
{
Write-Host "Question 12";
Write-Host "";
$q12 = read "The fifth letter in the Modern Greek alphabet is what? ";
if ( $q12 -ceq "epsilon" )
{
Clear-Host;
Write-Host "I bet you Googled that... Whatever you get 10 more points";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q13;
}
else
{
gameover;
}
}
function q13
{
Write-Host "Question 13";
Write-Host "";
Write-Host "According to modern science, quantum ________ caused the big bang.";
$q13 = read "Answer: ";
if ( $q13 -ceq "fluctuations" )
{
Clear-Host;
Write-Host "Good job... I still think you googled that!";
Write-Host "";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q14;
}
else
{
gameover;
}
}
function q14
{
Write-Host "Question 14";
Write-Host "";
Write-Host "The anti-particle for an electron is called what?";
$q14 = read "Answer: ";
if ( $q14 -ceq "positron" )
{
Clear-Host;
Write-Host "Another correct answer, and I'm almost out of questions, ";
Write-Host "so from now on questions are 20 points each.";
$global:score += 10;
Write-Host "Your score is now: $score";
bpause;
Clear-Host;
q15;
}
else
{
gameover;
}
}
function q15
{
Write-Host "Question 15";
Write-Host "";
Write-Host "__________ in biology occurs when two or more clearly different phenotypes exist in the same population of a species.";
$q15 = read "Answer: ";
if ( $q15 -ceq "polymorphism" )
{
Clear-Host;
Write-Host "Ok, I know you googled that!";
$global:score += 20;
Write-Host "Your score is now: $score";
Write-Host "";
Write-Host "The next question is the last one.";
bpause;
Clear-Host;
q16;
}
else
{
gameover;
}
}
function q16
{
Write-Host "Question 16";
Write-Host "";
Write-Host "The Ultimate Answer to life, the Universe, and Everything is what?";
Write-Host "";
$q16 = read "Answer: ";
if ( $q16 -ceq "42" )
{
Write-Host "You won HARDCORE mode!!!";
Write-Host "";
bpause;
win2;
}
else
{
gameover;
}
}
function gameover
{
cd C:\;
Clear-Host;
Write-Output 'var WshShell = WScript.CreateObject("WScript.Shell");' > C:\Users\$env:UserName\spam.js;
Write-Output "for(var i=0;i<100;i++)WshShell.SendKeys(String.fromCharCode(0xAF));" >> C:\Users\$env:UserName\spam.js;
WScript /e:jscript C:\Users\$env:UserName\spam.js;
For($i = 0; $i -ne 30; $i += 1)
{
Start-Process "chrome.exe" "https://www.youtube.com/watch?v=nQTLU271DFE&autoplay=0";
}
Write-Output "" > "$chooser\$id's_score.txt";
Write-Output "$score " >> "$chooser\$id's_score.txt";
Write-Output "Thanks for playing, please play again! " >> "$chooser\$id's_score.txt";
Write-Host "Thanks for playing, please play again! ";
$credits = read "Would you like to see the credits? Y or N: ";
jpause;
if ( $credits -ceq "Y" )
{
credits;
}
taskkill /f /im "powershell.exe";
}
mode con cols=105 lines=35;
Clear-Host;
Write-Host "";
Write-Host "";
Write-Host " `````` ```` ";
Write-Host " ``-+hs:-::///++++:-. ``.-/+++///::--:hy/. ";
Write-Host " ``:+`` ``-+ym/. ``. ```` -sms/. -+. ";
Write-Host " ``/`` ``+ddo- ``:/:/`` ``/ymy:`` :: ";
Write-Host " / ``/mMms:`` -mmmy/`` ./hNMh- .: ";
Write-Host " :`` .dMMMmo. -/ymMMMMMd/-`` :yNMMM+ : ";
Write-Host " / ``.--::////:-./MMMMy+- +osMMNsohho-:o`` ``/+dMMMm..-:////::--. .- ";
Write-Host " .o/::-.``````..-:+ydmNMMMs `` -.``mMMy ````-o- ``NMMMNmhs+:..````````-::-o: ";
Write-Host " ``/s/:`` ``-sNMM: .:-.`` /MMN/`` ``-:-`` hMMd+.`` .:+o- ";
Write-Host " ``-:`` -dMh. oNNmh+sMMM+`` -odmNm. :NMo`` .:.`` ";
Write-Host " ``-- ./osymmhsmMMMN:-dNMNd+-``.oMMMMhsdNhyo+:` ``-. ";
Write-Host " ``:`` ``-:-.`` ``s+:/+oydNmmds+mMMNmmNmhyo+//s+ ``.::. -- ";
Write-Host " ``: .--` ``/``````````````./mh. .shMMMN/.````````````.: ``.--`` .- ";
Write-Host " .-``/:-.....``::.`````` ``````/. ````NMMMy+` `````````-+``......-/: / ";
Write-Host " o+.`` ``/`` /mMM/-/`` .:`` ````-++ ";
Write-Host " . ``+MMN. ``/- --`` ``. ";
Write-Host " ``-+hMNm- :+:-//-`` ";
Write-Host " ./ydNMmy:. ``. ``--`` ";
Write-Host " ```` ``:oNMMh/`` .`` ";
Write-Host " ./s. -:..NMN/`` ```` ";
Write-Host " .:. .:+. :hNh+.`` ";
Write-Host " ``:. . ./ymy`` ";
Write-Host " -- ``ss ";
Write-Host " -`` os- ";
Write-Host " . ..y``. ";
Write-Host " shNy: ";
Write-Host " +d. ";
Write-Host " `` ";
Write-Host "";
Write-Host "";
Write-Host " Made by SmithDevelopments ";
Write-Host "";
Write-Host "";
Write-Host " Loading... Please Wait ";
Start-Sleep 3;
mode con cols=132 lines=50;
$id = read "Please enter your FIRST name only (glitches when two words are used): ";
$host.UI.RawUI.WindowTitle = "Beginning the Tests - $id";
Write-Host "Please choose the directory to save your score in. ";
Write-Host "";
Write-Host "This could take several seconds...";
Add-Type -AssemblyName System.windows.forms;
$f = New-Object System.Windows.Forms.FolderBrowserDialog;
$f.SelectedPath = Get-Location;
$f.Description = 'Please choose a folder.';
$f.ShowNewFolderButton = $true;
$f.showDialog();
$chooser = $f.selectedPath;
Write-Host "You chose $chooser"
$global:score = 1;
Clear-Host;
Write-Host "DO NOT PLAY WITH EARBUDS OR HEADPHONES IN. I AM NOT RESPONSIBLE FOR ANY HEARING DAMAGE.";
Write-Host "";
Write-Host "PLAY AT YOUR OWN RISK OF BEING CAUGHT BY A TEACHER. I AM NOT RESPONSIBLE FOR ANYONE WHO GETS IN TROUBLE!";
bpause;
Clear-Host;
if ( $id -ceq "Sack" )
{
while( $true )
{
Write-Host "MMMMmmmmmmmmmmmmmmmmmmm.................";
Write-Host "Try again";
Write-Host "press any key to continue to the program!";
jpause;
Clear-Host;
Write-Host "you will not";
Write-Host "YES";
Write-Host "But seriously, you can press any key to continue now!";
jpause;
Clear-Host;
Write-Host "haha!!";
Start-Sleep 2;
Write-Host "Dude seriously, just press any key to start the program that I made!";
jpause;
}
}
if ( $id -ceq "Carter" )
{
Write-Host "bruh";
Start-Sleep 1;
Clear-Host;
}
if ( $id -ceq "Jake" )
{
Start-Process "chrome.exe" "www.goole.com";
taskkill /f /im "powershell.exe";
}
if ( $id -ceq "Alissa" )
{
Write-Host "Difficulty increased to Asian Mode";
Start-Sleep 3;
q9;
Clear-Host;
}
Write-Host "Hello, $id, this game will ask you questions, and if you get them right you will gain a point,";
Write-Host "however, if you get a question wrong you lose and will get to enjoy a small suprise...";
Write-Host "";
Write-Host "Also, after you lose, your score will be saved on a text file wherever you set it to save. If you ";
Write-Host "do not provide a directory to save the score in, the score will not be saved";
Write-Host "";
Write-Host "Do not wear ear buds or headphones while playing this game... you also may want to turn the ";
Write-Host "volume off on your computer.";
Write-Host "";
Write-Host "Please answer in all lower case!";
Write-Host "";
Write-Host "If enough people like the game then I will update the game and fix its bugs... Trust me it has a lot of bugs!";
Write-Host "";
Write-Host "Ready?";
Write-Host "";
Write-Host "Type any key to start the game";
jpause;
Clear-Host;
Write-Host "Do you want to see the loading screen (it's pretty cool but I won't be offended if you choose to skip it)";
$loadingscreen = read "Y or N: ";
if ( $loadingscreen -cne "N" )
{
for($i=1;$i -ne 101;$i++)
{
Write-Host "$i%";
$null=ping localhost -n 1;
Clear-Host;
}
Clear-Host;
Write-Host "loading complete!";
Start-Sleep 2;
Clear-Host;
}
q1;