/
HackMIT project.py
1206 lines (1206 loc) · 48 KB
/
HackMIT project.py
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
import turtle
import webbrowser
import time
import math
import random
randomnumber = random.randint(0,3)
randomnumber = randomnumber + 1
randomnumbertwo = random.randint(0,2)
randomnumbertwo = randomnumbertwo +1
randomnumberthree = random.randint(0,1)
randomnumberthree = randomnumberthree +1
t = turtle.Turtle()
s = turtle.Screen()
t.speed(0)
s.bgcolor(0,0,0)
s.colormode(255)
t.ht()
t.penup()
def hydrogen(x,y):
t.penup()
t.goto(70+x,50+y)
t.pendown()
t.width(2)
t.pencolor(255,0,0)
t.goto(70+x,30+y)
t.penup()
t.pencolor(50,255,50)
t.goto(35+x,50+y)
t.pendown()
t.goto(35+x,30+y)
t.penup()
t.pencolor(0,0,215)
t.goto(23+x,50+y)
t.pendown()
t.goto(23+x,30+y)
t.penup()
t.pencolor(148,0,211)
t.goto(15+x,50+y)
t.pendown()
t.goto(15+x,30+y)
t.penup()
def helium(x,y):
t.width(2)
t.penup()
t.goto(73+x,50+y)
t.pencolor(255,0,0)
t.pendown()
t.goto(73+x,30+y)
t.penup()
t.width(1)
t.goto(76+x,50+y)
t.pencolor(210,0,0)
t.pendown()
t.goto(76+x,30+y)
t.penup()
t.width(4)
t.pencolor(255,255,0)
t.goto(50+x,50+y)
t.pendown()
t.goto(50+x,30+y)
t.penup()
t.goto(35+x,50+y)
t.pendown()
t.width(2)
t.pencolor(50,255,50)
t.goto(35+x,30+y)
t.penup()
t.goto(25+x,50+y)
t.pendown()
t.pencolor(50,255,150)
t.goto(25+x,30+y)
t.penup()
t.goto(5+x,50+y)
t.width(1)
t.pendown()
t.pencolor(130,0,200)
t.goto(5+x,30+y)
t.penup()
def oxygen(x,y):
t.penup()
t.goto(60+x,50+y)
t.width(1)
t.pencolor(0,210,0)
t.pendown()
t.goto(60+x,30+y)
t.penup()
t.goto(70+x,50+y)
t.pencolor(210,0,0)
t.pendown()
t.goto(70+x,30+y)
t.penup()
t.goto(75+x,50+y)
t.pencolor(180,0,0)
t.pendown()
t.goto(75+x,30+y)
t.penup()
def sodium(x,y):
t.penup()
t.goto(70+x,30+y)
t.pencolor(255,255,0)
t.pendown()
t.goto(70+x,50+y)
t.penup()
t.goto(75+x,50+y)
t.pendown()
t.pencolor(235,235,0)
t.pendown()
t.goto(75+x,30+y)
t.penup()
#ask which module they wish to use
while True:
try:
modulechoice = str(input("Welcome to spaceship, spaceship, SPACESHIP with Ben-ni, a fun game all about space! Would you like to play the gravity module, spectral analysis module, or the Mars mission module? "))
break
except ValueError:
print("Sorry, please only enter text.")
choice = 0
x=1
y=1
z=1
#loop to ensure the choice goes through
while x==1:
modulechoice.lower()
if modulechoice == "gravity" or modulechoice == "gravity module":
print("[Ben-ni]: Thank you for choosing the gravity module! I'm Ben-ni, your friendly astronaut guide to all things space. In the gravity module, we're going to have fun with seeing how much you weigh on different planets, and in space. Let's have some fun with WEIGHT!!")
choice = 1
x=0
elif modulechoice == "spectral" or modulechoice == "spectral analysis" or modulechoice == "spectral analysis module":
print("[Ben-ni]: Thank you for choosing the spectral analysis module! I'm Ben-ni, your friendly astronaut guide to all things space. In the spectral analysis module, we're going to have some fun with one of the coolest techniques in astronomy, and look at light to learn what stars are made of. Let's have some fun with LIGHT!!")
choice = 2
x=0
elif modulechoice == "mars" or modulechoice == "mars mission" or modulechoice == "mars mission module" or modulechoice =="mars module":
print("[Ben-ni]: Thank you for choosing the Mars mission module. I'm Ben-ni, your friendly astronaut guide to all things space. In the Mars mission module, we're going to explore travel to Mars, one of my dreams. And it will have a spaceship! Let's have some fun with SPACE!!")
choice = 3
x=0
else:
modulechoice = str(input("I'm sorry, that didn't quite register. For the gravity module, enter gravity; for the spectral analysis module, enter spectral analysis; and for the Mars mission module, enter mars mission. "))
#start the gravity module
if choice == 1:
#draw the planets
t_one = t.clone()
t_two = t.clone()
t.goto(-150,50)
t.pencolor((64,224,208))
t.setheading(0)
circlesegment = (100*3.14)/90
t.fillcolor((64,224,208))
t.pendown()
t.begin_fill()
for i in range (90):
t.fd(circlesegment)
t.right(4)
t.end_fill()
t.penup()
t_one.goto(0,50)
t_one.pencolor((64,224,208))
t_one.setheading(0)
circlesegment = (100*3.14)/90
t_one.fillcolor((64,224,208))
t_one.pendown()
t_one.begin_fill()
for i in range (90):
t_one.fd(circlesegment)
t_one.right(4)
t_one.end_fill()
#draw the people
t_one.penup()
t.goto(-140,49)
t.pendown()
t.pencolor((210,180,140))
t.goto(-150,62)
t.goto(-160,49)
t.goto(-150,62)
t.goto(-150,77)
t.goto(-160,67)
t.goto(-150,77)
t.goto(-140,67)
t.goto(-150,77)
t.goto(-150,80)
t.dot(8)
t_one.goto(10,49)
t_one.pendown()
t_one.pencolor((210,180,140))
t_one.goto(0,62)
t_one.goto(-10,49)
t_one.goto(0,62)
t_one.goto(0,77)
t_one.goto(-10,67)
t_one.goto(0,77)
t_one.goto(10,67)
t_one.goto(0,77)
t_one.goto(0,80)
t_one.dot(8)
t_two.goto(160,-1)
t_two.pendown()
t_two.pencolor((255,255,255))
t_two.goto(150,12)
t_two.goto(140,-1)
t_two.goto(150,12)
t_two.goto(150,27)
t_two.goto(140,17)
t_two.goto(150,27)
t_two.goto(160,17)
t_two.goto(150,27)
t_two.goto(150,30)
t_two.dot(8)
t_two.pencolor((210,180,140))
t_two.dot(5)
#ask their weight
print("[Ben-ni]: Shown is three versions of you, one on Earth, one on another planet, and one in space.")
while True:
try:
weight_on_earth = int(input("[Ben-ni]: What is your weight on Earth in pounds? Please enter so I can figure our how much you weight on different planets."))
if weight_on_earth > 1500:
print("Please enter your real weight")
else:
break
except ValueError:
print("Please enter a whole number instead (don't spell out the number)")
#calculate and write their weight and mass
print("[Ben-ni]: Great! Now that I have your weight, we can figure out your weigh in deep space, and on another planet. But there's more! We can also figure out your mass. Mass is an idea similar to weight, it is a measure of how much 'stuff' you are made of absolutely, while weight refers to how 'heavy' you are. The difference lies in a mysterious and powerful force that we use every day, gravity. I'll explain more in a little bit, but first let's play around with seeing your weight on another planet.")
earthwrite = "Your weigh on Earth is: " + str(weight_on_earth) + " pounds"
mass = weight_on_earth/2.20462262185
mass = mass*100
mass = math.floor(mass)
mass = mass/100
masswrite = "Your mass is: " + str(mass) + " kilograms"
t.penup()
t.goto(-225,-75)
t.pendown()
t.pencolor(255,255,0)
t.write(earthwrite,font=("Arial",8,"normal"))
t.penup()
t.goto(-225,-100)
t.pendown()
t.write(masswrite,font=("Arial",8,"normal"))
t.penup()
t.goto(170,-75)
t.pendown()
t.write("Your weight in deep space is: 0 pounds",font=("Arial",8,"normal"))
t.penup()
t.goto(170,-100)
t.pendown()
t.write(masswrite,font=("Arial",8,"normal"))
while x == 0 or x == 2:
y=1
#clear the old text if their was already stuff written
if x == 2:
t.penup()
t.goto(-35,-50)
t.pendown()
t.pencolor(0,0,0)
t.fillcolor(0,0,0)
t.begin_fill()
t.goto(165,-50)
t.goto(165,-100)
t.goto(-35,-100)
t.goto(-35,-50)
t.end_fill()
#ask for a planet choice
while x == 0:
try:
planetchoice = str(input("Please choose a planet from Mercury, Venus, Mars, Jupiter, Saturn, Uranus, or Neptune."))
planetchoice = planetchoice.lower()
if planetchoice == "mercury" or planetchoice == "venus" or planetchoice == "mars" or planetchoice == "jupiter" or planetchoice == "saturn" or planetchoice == "uranus" or planetchoice == "neptune":
x=1
else:
print("Sorry, that's not a choice. Please enter the name of the planet in the solar system you wish to choose.")
except ValueError:
print("Sorry, that's not a choice. Please enter the name of the planet in the solar system you wish to choose.")
#check the planet and change the appropriate variable for shifting weight
if planetchoice == "mercury":
factor = 3.7/9.81
planet = "Mercury"
if planetchoice == "venus":
factor = 8.87/9.81
planet = "Venus"
if planetchoice == "mars":
factor = 3.711/9.81
planet = "Mars"
if planetchoice == "jupiter":
factor = 2.528
planet = "Jupiter"
if planetchoice == "saturn":
factor = 10.44/9.81
planet = "Saturn"
if planetchoice == "uranus":
factor = 8.69/9.81
planet = "Uranus"
if planetchoice == "neptune":
factor = 11.15/9.81
planet = "Neptune"
weightanother = weight_on_earth*factor
weightanother = weightanother*100
weightanother = float(math.floor(weightanother))
weightanother = weightanother/100
#write out their weight
if z == 1:
earthwrite = "Your weigh on " + str(planet) + " is: " + str((weightanother)) + " pounds"
if z == 2:
earthwrite = "Their weigh on " + str(planet) + " is: " + str((weightanother)) + " pounds"
mass = weight_on_earth/2.20462262185
mass = mass*100
mass = math.floor(mass)
mass = mass/100
if z ==1:
masswrite = "Your mass is: " + str(mass) + " kilograms"
if z ==2:
masswrite = "Their mass is: " + str(mass) + " kilograms"
t.penup()
t.goto(-35,-75)
t.pendown()
t.pencolor(255,255,0)
t.write(earthwrite,font=("Arial",8,"normal"))
t.penup()
t.goto(-35,-100)
t.pendown()
t.write(masswrite,font=("Arial",8,"normal"))
#ask if they want to go again
while y == 1:
try:
planetagain = str(input("Would you like to explore weight more by seeing your weight on another planet? "))
planetagain = planetagain.lower()
if planetagain == "yes" or planetagain == "y":
print("Great!")
planetagain = "yes"
x=2
y=2
else:
y=2
except ValueError:
print("Sorry, that was unclear. Enter 'yes' for yes and 'no' for no.")
#choose a new planet if they want to go again
if planetagain == "yes":
while y == 2:
try:
planetchoice = str(input("Please choose a planet from Mercury, Venus, Mars, Jupiter, Saturn, Uranus, or Neptune."))
planetchoice = planetchoice.lower()
if planetchoice == "mercury" or planetchoice == "venus" or planetchoice == "mars" or planetchoice == "jupiter" or planetchoice == "saturn" or planetchoice == "uranus" or planetchoice == "neptune":
y=1
else:
print("Sorry, that's not a choice. Please enter the name of the planet in the solar system you wish to choose.")
except ValueError:
print("Sorry, that's not a choice. Please enter the name of the planet in the solar system you wish to choose.")
y=1
#ask if they want to go again with a new weight
weightagain = "no"
if planetagain != "yes":
while y == 1:
try:
weightagain = str(input("Would you like to play again, but using the weight of someone else you know this time?"))
weightagain = weightagain.lower()
if weightagain == "yes" or weightagain == "y":
print("Great!")
weightagain = "yes"
y = 2
x=2
else:
y=2
x=1
except ValueError:
print("Sorry, that was unclear. Enter 'yes' for yes and 'no' for no.")
y=2
if weightagain == "yes":
#erase old text
t.penup()
t.goto(-225,-50)
t.pendown()
t.pencolor(0,0,0)
t.fillcolor(0,0,0)
t.begin_fill()
t.goto(300,-50)
t.goto(300,-100)
t.goto(-225,-100)
t.goto(-225,-50)
t.end_fill()
#re-ask all the part about the weight and mass
while y==2:
try:
weight_on_earth = int(input("[Ben-ni]: What is the weight on Earth in pounds of the person you would like to calculate have their weight on another planet calculated? Please enter so I can figure our how much they weight on different planets."))
if weight_on_earth > 1500:
print("Please enter a real weight")
else:
y=1
except ValueError:
print("Please enter a whole number instead (don't spell out the number)")
print("[Ben-ni]: Great! Now that I have their weight, we can figure out their weigh in deep space, and on another planet. But there's more! We can also figure out theur mass. Mass is an idea similar to weight, it is a measure of how much 'stuff' you are made of absolutely, while weight refers to how 'heavy' you are. The difference lies in a invisible and powerful force that we use every day, gravity. I'll explain more in a little bit, but first let's play around with seeing weight on another planet.")
earthwrite = "Their weigh on Earth is: " + str(weight_on_earth) + " pounds"
#re-calculate weight and mass
mass = weight_on_earth/2.20462262185
mass = mass*100
mass = math.floor(mass)
mass = mass/100
masswrite = "Their mass is: " + str(mass) + " kilograms"
#re-write new text
t.penup()
t.goto(-225,-75)
t.pendown()
t.pencolor(255,255,0)
t.write(earthwrite,font=("Arial",8,"normal"))
t.penup()
t.goto(-225,-100)
t.pendown()
t.write(masswrite,font=("Arial",8,"normal"))
t.penup()
t.goto(170,-75)
t.pendown()
t.write("Their weight in deep space is: 0 pounds",font=("Arial",8,"normal"))
t.penup()
t.goto(170,-100)
t.pendown()
t.write(masswrite,font=("Arial",8,"normal"))
z=2
print("[Ben-ni]: I hope you had fun playing around with weights on other planets! As you probably saw through playing around with weights on other planets, weight in deep space is always zero and mass for a given person is always the same, but weight can change on other planets. This is because other planets have different amounts of gravity. Gravity is that invisible, powerful force I was talking about earlier. It's a force of an attraction, making everything in the universe 'pull' each other together. However, that pull is very weal for most things, so weak we can't feel or even notice it. For really massive things, like planets, it is definetly noticible, because the more mass something has, the more it 'pulls' other things towards it. Gravity is what pulls us towards the Earth and prevents us from flying away, or jumping as high as we want. Because other planets have more or less mass, they have a stronger or weaker gravity, and 'pull' things more or less. So, on Mercury, which has not a lot of mass, the 'pull' isn't very strong. But on Jupiter, which does have a lot of mass, it is very strong.")
z=1
#ask if they want more info
while z ==1:
try:
moreinfograv = str(input("Would you like to view more info on gravity?"))
if moreinfograv == "yes" or moreinfograv == "y":
moreinfograv = moreinfograv = "yes"
z = 2
else:
z=2
except ValueError:
print("Sorry, don't quite understand. Please enter 'yes' for yes, and 'no' for no.")
if moreinfograv == "yes":
webbrowser.open('https://spaceplace.nasa.gov/what-is-gravity/en/', new=2)
print("Thanks for playing the gravity module in spaceship, spaceship, SPACESHIP with Ben-ni! Come again soon!")
#start the spectral analysis module
if choice == 2:
#draw the spectrums
t.penup()
t.goto(-100,100)
t.pencolor(255,255,255)
t.pendown()
t.goto(-20,100)
t.goto(-20,80)
t.goto(-100,80)
t.goto(-100,100)
t.penup()
t.goto(-30,100)
t.pendown()
t.width(2)
t.pencolor(255,0,0)
t.goto(-30,80)
t.penup()
t.pencolor(50,255,50)
t.goto(-65,100)
t.pendown()
t.goto(-65,80)
t.penup()
t.pencolor(0,0,215)
t.goto(-77,100)
t.pendown()
t.goto(-77,80)
t.penup()
t.pencolor(148,0,211)
t.goto(-85,100)
t.pendown()
t.goto(-85,80)
t.width(1)
t.penup()
t.goto(0,50)
t.pencolor(255,255,255)
t.pendown()
t.goto(80,50)
t.goto(80,30)
t.goto(0,30)
t.goto(0,50)
t.penup()
t.goto(0,100)
t.pencolor(255,255,255)
t.pendown()
t.goto(80,100)
t.goto(80,80)
t.goto(0,80)
t.goto(0,100)
t.penup()
t.width(1)
t.penup()
t.goto(-100,50)
t.pencolor(255,255,255)
t.pendown()
t.goto(-20,50)
t.goto(-20,30)
t.goto(-100,30)
t.goto(-100,50)
t.penup()
t.width(1)
t.penup()
t.goto(-100,0)
t.pencolor(255,255,255)
t.pendown()
t.goto(-20,0)
t.goto(-20,-20)
t.goto(-100,-20)
t.goto(-100,0)
t.penup()
t.width(1)
t.penup()
t.goto(-100,-50)
t.pencolor(255,255,255)
t.pendown()
t.goto(-20,-50)
t.goto(-20,-70)
t.goto(-100,-70)
t.goto(-100,-50)
t.penup()
t.width(1)
t.penup()
t.goto(0,0)
t.pencolor(255,255,255)
t.pendown()
t.goto(80,0)
t.goto(80,-20)
t.goto(0,-20)
t.goto(0,0)
t.penup()
t.width(1)
t.penup()
t.goto(0,-50)
t.pencolor(255,255,255)
t.pendown()
t.goto(80,-50)
t.goto(80,-70)
t.goto(0,-70)
t.goto(0,-50)
t.penup()
t.width(2)
t.goto(-27,50)
t.pencolor(255,0,0)
t.pendown()
t.goto(-27,30)
t.penup()
t.width(1)
t.goto(-24,50)
t.pencolor(210,0,0)
t.pendown()
t.goto(-24,30)
t.penup()
t.width(4)
t.pencolor(255,255,0)
t.goto(-50,50)
t.pendown()
t.goto(-50,30)
t.penup()
t.goto(-65,50)
t.pendown()
t.width(2)
t.pencolor(50,255,50)
t.goto(-65,30)
t.penup()
t.goto(-75,50)
t.pendown()
t.pencolor(50,255,150)
t.goto(-75,30)
t.penup()
t.goto(-95,50)
t.width(1)
t.pendown()
t.pencolor(130,0,200)
t.goto(-95,30)
t.penup()
t.penup()
t.goto(-40,0)
t.width(1)
t.pencolor(0,210,0)
t.pendown()
t.goto(-40,-20)
t.penup()
t.goto(-30,0)
t.pencolor(210,0,0)
t.pendown()
t.goto(-30,-20)
t.penup()
t.goto(-25,0)
t.pencolor(180,0,0)
t.pendown()
t.goto(-25,-20)
t.penup()
t.penup()
t.goto(-30,-50)
t.pencolor(255,255,0)
t.pendown()
t.goto(-30,-70)
t.penup()
t.goto(-25,-50)
t.pendown()
t.pencolor(235,235,0)
t.pendown()
t.goto(-25,-70)
print(randomnumber, randomnumbertwo,randomnumberthree)
if randomnumber == 4 and randomnumbertwo == 3 and randomnumberthree==1:
answerd = "hydrogen"
answerc = "helium"
answera = "oxygen"
answerb = "sodium"
hydrogen(0,-100)
helium(0,-50)
oxygen(0,0)
sodium(0,50)
elif randomnumber == 4 and randomnumbertwo == 3 and randomnumberthree==2:
answerd = "hydrogen"
answerc = "helium"
answerb = "oxygen"
answera = "sodium"
hydrogen(0,-100)
helium(0,-50)
oxygen(0,50)
sodium(0,0)
elif randomnumber == 4 and randomnumbertwo == 2 and randomnumberthree==1:
answerd = "hydrogen"
answera = "helium"
answerc = "oxygen"
answerb = "sodium"
hydrogen(0,-100)
helium(0,50)
oxygen(0,-50)
sodium(0,0)
elif randomnumber == 4 and randomnumbertwo == 2 and randomnumberthree==2:
answerd = "hydrogen"
answera = "helium"
answerb = "oxygen"
answerc = "sodium"
hydrogen(0,-100)
helium(0,50)
oxygen(0,0)
sodium(0,-50)
elif randomnumber == 4 and randomnumbertwo == 1 and randomnumberthree==1:
answerd = "hydrogen"
answerb = "helium"
answerc = "oxygen"
answera = "sodium"
hydrogen(0,-100)
helium(0,0)
oxygen(0,-50)
sodium(0,50)
elif randomnumber == 4 and randomnumbertwo == 1 and randomnumberthree==2:
answerd = "hydrogen"
answerb = "helium"
answera = "oxygen"
answerc = "sodium"
hydrogen(0,-100)
helium(0,0)
oxygen(0,50)
sodium(0,-50)
elif randomnumber == 3 and randomnumbertwo == 3 and randomnumberthree==1:
answerc = "hydrogen"
answerb = "helium"
answerd = "oxygen"
answera = "sodium"
hydrogen(0,-50)
helium(0,0)
oxygen(0,-100)
sodium(0,50)
elif randomnumber == 3 and randomnumbertwo == 3 and randomnumberthree==2:
answerc = "hydrogen"
answerb = "helium"
answera = "oxygen"
answerd = "sodium"
hydrogen(0,-50)
helium(0,0)
oxygen(0,50)
sodium(0,-100)
elif randomnumber == 3 and randomnumbertwo == 2 and randomnumberthree==1:
answerc = "hydrogen"
answera = "helium"
answerb = "oxygen"
answerd = "sodium"
hydrogen(0,-50)
helium(0,50)
oxygen(0,0)
sodium(0,-100)
elif randomnumber == 3 and randomnumbertwo == 2 and randomnumberthree==2:
answerc = "hydrogen"
answera = "helium"
answerd = "oxygen"
answerb = "sodium"
hydrogen(0,-50)
helium(0,50)
oxygen(0,-100)
sodium(0,0)
elif randomnumber == 3 and randomnumbertwo == 1 and randomnumberthree==1:
answerc = "hydrogen"
answerd = "helium"
answera = "oxygen"
answerb = "sodium"
hydrogen(0,-50)
helium(0,-100)
oxygen(0,50)
sodium(0,0)
elif randomnumber == 3 and randomnumbertwo == 1 and randomnumberthree==2:
answerc = "hydrogen"
answerd = "helium"
answerb = "oxygen"
answera = "sodium"
hydrogen(0,-50)
helium(0,-100)
oxygen(0,0)
sodium(0,50)
elif randomnumber == 2 and randomnumbertwo == 3 and randomnumberthree==1:
answerb = "hydrogen"
answerc = "helium"
answerd = "oxygen"
answera = "sodium"
hydrogen(0,0)
helium(0,-50)
oxygen(0,-100)
sodium(0,50)
elif randomnumber == 2 and randomnumbertwo == 3 and randomnumberthree==2:
answerb = "hydrogen"
answerc = "helium"
answera = "oxygen"
answerd = "sodium"
hydrogen(0,0)
helium(0,-50)
oxygen(0,50)
sodium(0,-100)
elif randomnumber == 2 and randomnumbertwo == 2 and randomnumberthree==1:
answerb = "hydrogen"
answera = "helium"
answerc = "oxygen"
answerd = "sodium"
hydrogen(0,0)
helium(0,50)
oxygen(0,-50)
sodium(0,-100)
elif randomnumber == 2 and randomnumbertwo == 2 and randomnumberthree==2:
answerb = "hydrogen"
answera = "helium"
answerd = "oxygen"
answerc = "sodium"
hydrogen(0,0)
helium(0,50)
oxygen(0,-100)
sodium(0,-50)
elif randomnumber == 2 and randomnumbertwo == 1 and randomnumberthree==1:
answerb = "hydrogen"
answerd = "helium"
answera = "oxygen"
answerc = "sodium"
hydrogen(0,0)
helium(0,-100)
oxygen(0,50)
sodium(0,-50)
elif randomnumber == 2 and randomnumbertwo == 1 and randomnumberthree==2:
answerb = "hydrogen"
answerd = "helium"
answerc = "oxygen"
answera = "sodium"
hydrogen(0,0)
helium(0,-100)
oxygen(0,-50)
sodium(0,50)
elif randomnumber == 1 and randomnumbertwo == 3 and randomnumberthree==1:
answera = "hydrogen"
answerb = "helium"
answerd = "oxygen"
answerc = "sodium"
hydrogen(0,50)
helium(0,0)
oxygen(0,-100)
sodium(0,-50)
elif randomnumber == 1 and randomnumbertwo == 3 and randomnumberthree==2:
answera = "hydrogen"
answerb = "helium"
answerc = "oxygen"
answerd = "sodium"
hydrogen(0,50)
helium(0,0)
oxygen(0,-50)
sodium(0,-100)
elif randomnumber == 1 and randomnumbertwo == 2 and randomnumberthree==1:
answera = "hydrogen"
answerc = "helium"
answerb = "oxygen"
answerd = "sodium"
hydrogen(0,50)
helium(0,-50)
oxygen(0,0)
sodium(0,-100)
elif randomnumber == 1 and randomnumbertwo == 2 and randomnumberthree==2:
answera = "hydrogen"
answerc = "helium"
answerd = "oxygen"
answerb = "sodium"
hydrogen(0,50)
helium(0,-50)
oxygen(0,-100)
sodium(0,0)
elif randomnumber == 1 and randomnumbertwo == 1 and randomnumberthree==1:
answera = "hydrogen"
answerd = "helium"
answerc = "oxygen"
answerb = "sodium"
hydrogen(0,50)
helium(0,-100)
oxygen(0,-50)
sodium(0,0)
elif randomnumber == 1 and randomnumbertwo == 1 and randomnumberthree==2:
answera = "hydrogen"
answerd = "helium"
answerb = "oxygen"
answerc = "sodium"
hydrogen(0,50)
helium(0,-100)
oxygen(0,0)
sodium(0,-50)
t.penup()
t.pencolor(255,255,255)
t.goto(-100,105)
t.pendown()
t.write("Hydrogen",font=("Arial",8,"normal"))
t.penup()
t.goto(-100,55)
t.pendown()
t.write("Helium",font=("Arial",8,"normal"))
t.penup()
t.goto(-100,5)
t.pendown()
t.write("Oxygen",font=("Arial",8,"normal"))
t.penup()
t.goto(-100,-44)
t.pendown()
t.write("Sodium",font=("Arial",8,"normal"))
t.penup()
t.goto(0,105)
t.pendown()
t.write("A",font=("Arial",8,"normal"))
t.penup()
t.goto(0,55)
t.pendown()
t.write("B",font=("Arial",8,"normal"))
t.penup()
t.goto(0,5)
t.pendown()
t.write("C",font=("Arial",8,"normal"))
t.penup()
t.goto(0,-44)
t.pendown()
t.write("D",font=("Arial",8,"normal"))
t.penup()
#have them guess all the elements
print("[Ben-ni]: Shown are the emission spectra for several elements. You may be wondering what an emission spectrum is, and what an element is. Elements are the building blocks of the universe, comprising all of the things in the universe. When these elements are spread really thin, they can let light go through them, and 'split' it, making a rainbow. A rainbow is a type of spectrum. All a spectrum is is a collection of lights. When things get really hot, thousands of times hotter than a summer day, things start to glow, and light up. The sprectra shown are a sort of rainbow that you can see by looking at really hot versions of the elements through a prism, which is a triangular wedge of glass. Stars are me up of really hot elements, and by looking at them through a telescope and a prism, astronomers can see the 'rainbows' made by the elements in the star, and figure out what they're made of, which is pretty neat. Do you know another way of figuring out what things too far away to imagine are made of? I don't. Let's have some fun matching the known element's spectra, on the left, with the mystery ones on the right.")
while True:
try:
elementa = str(input("Which element do you think mystery spectrum 'A' is of?"))
elementa = elementa.lower()
if elementa == answera:
if answera == "helium":
print("[Ben-ni]: Spot on! There's Helium in many balloons. It also makes your voice sound squeaky if you inhale it!")
break
if answera == "hydrogen":
print("[Ben-ni]: Spot on! Hydrogen is the most common element in the universe..")
break
if answera == "oxygen":
print("[Ben-ni]: Spot on! Oxygen is very important for many kinds of life on Earth, and astronomers use the spectra of oxygen to help gauge if planets in other solar systems might have aliens.")
break
if answera == "sodium":
print("[Ben-ni]: Spot on! Sodium is one of the two elements in salt, along with chlorine.")
break
elif elementa == "hydrogen" or elementa == "helium" or elementa == "sodium" or elementa == "oxygen":
print("Sorry, that's incorrect. Try again!")
else:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
except ValueError:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
while True:
try:
elementb = str(input("Which element do you think mystery spectrum 'B' is of?"))
elementb = elementb.lower()
if elementb == answerb:
if answerb == "helium":
print("[Ben-ni]: Spot on! There's Helium in many balloons. It also makes your voice sound squeaky if you inhale it!")
break
if answerb == "hydrogen":
print("[Ben-ni]: Spot on! Hydrogen is the most common element in the universe..")
break
if answerb == "oxygen":
print("[Ben-ni]: Spot on! Oxygen is very important for many kinds of life on Earth, and astronomers use the spectra of oxygen to help gauge if planets in other solar systems might have aliens.")
break
if answerb == "sodium":
print("[Ben-ni]: Spot on! Sodium is one of the two elements in salt, along with chlorine.")
break
elif elementb == "oxygen" or elementb == "helium" or elementb == "sodium" or elementb == "hydrogen":
print("Sorry, that's incorrect. Try again!")
else:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
except ValueError:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
while True:
try:
elementc = str(input("Which element do you think mystery spectrum 'C' is of?"))
elementc =elementc.lower()
if elementc == answerc:
if answerc == "helium":
print("[Ben-ni]: Spot on! There's Helium in many balloons. It also makes your voice sound squeaky if you inhale it!")
break
if answerc == "hydrogen":
print("[Ben-ni]: Spot on! Hydrogen is the most common element in the universe..")
break
if answerc == "oxygen":
print("[Ben-ni]: Spot on! Oxygen is very important for many kinds of life on Earth, and astronomers use the spectra of oxygen to help gauge if planets in other solar systems might have aliens.")
break
if answerc == "sodium":
print("[Ben-ni]: Spot on! Sodium is one of the two elements in salt, along with chlorine.")
break
elif elementc == "hydrogen" or elementc == "helium" or elementc == "oxygen" or elementc == "sodium":
print("Sorry, that's incorrect. Try again!")
else:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
except ValueError:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
while True:
try:
elementd = str(input("Which element do you think mystery spectrum 'D' is of?"))
elementd = elementd.lower()
if elementd == answerd:
if answerd == "helium":
print("[Ben-ni]: Spot on! There's Helium in many balloons. It also makes your voice sound squeaky if you inhale it!")
break
if answerd == "hydrogen":
print("[Ben-ni]: Spot on! Hydrogen is the most common element in the universe..")
break
if answerd == "oxygen":
print("[Ben-ni]: Spot on! Oxygen is very important for many kinds of life on Earth, and astronomers use the spectra of oxygen to help gauge if planets in other solar systems might have aliens.")
break
if answerd == "sodium":
print("[Ben-ni]: Spot on! Sodium is one of the two elements in salt, along with chlorine.")
break
elif elementd == "hydrogen" or elementd == "oxygen" or elementd == "sodium" or elementd == "helium":
print("Sorry, that's incorrect. Try again!")
else:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
except ValueError:
print("Sorry, didn't quite understand that. To guess Hydrogen, enter 'hydrogen'; to guess Helium, enter 'helium'; to guess Sodium, enter 'sodium'.")
print("[Ben-ni]: Congratulations! You have successfully determined all of the elements. I'd bet you'll make a great astronomer one day.")
#ask if they want more info
while True:
try:
moreinfospect = str(input("Would you like more info on spectrums?"))
moreinfospect = moreinfospect.lower()
if moreinfospect == "yes" or moreinfospect == "y":
print("Great!")
moreinfospect = "yes"
break
else:
break
except ValueError:
print("Sorry, didn't quite understand that. For yes, enter 'yes', and for no, enter 'no'.")
if moreinfospect == "yes":
webbrowser.open("http://loke.as.arizona.edu/~ckulesa/camp/spectroscopy_intro.html", new=2)
print("Thanks for playing the spectral analysis module of spaceship, spaceship, SPACESHIP with Ben-ni. Come again soon!")
#start the Mars mission module
if choice == 3:
spaceshipparts=[]
print("[Ben-ni]: In order to get to Mars, we have to build a spaceship. And not just any spaceship. We have to build one that's great. Let's build a great spaceship!")
w = 1
#start the mars mission adding rocket parts loop
while True:
#mars mission which part ask loop
while w ==1:
try:
newestpart = str(input("which part would you like to add to your spaceship next? An air scrubber, a food storage unit, a gym, a hull, an engine, fuel tanks, or a water slide? "))
newestpart = newestpart.lower()
if newestpart in spaceshipparts:
print("Sorry, you already have that part on your spaceship.")
elif newestpart == "air scrubber" or newestpart == "food storage" or newestpart == "gym" or newestpart == "hull" or newestpart == "engine" or newestpart == "fuel tanks" or newestpart == "water slide":
w = 2
else:
print("Sorry, don't quite understand. For an air scrubber, enter 'air scrubber'; for a food storage unit, enter 'food storage'; for a gym, enter 'gym'; for a hull, enter 'hull'; for an engine, enter 'engine'; for fuel tanks, enter 'fuel tanks'; and for a water slide, enter 'water slide'. ")
except ValueError:
print("Sorry, don't quite understand. For an air scrubber, enter 'air scrubber'; for a food storage unit, enter 'food storage'; for a gym, enter 'gym'; for a hull, enter 'hull'; for an engine, enter 'engine'; for fuel tanks, enter 'fuel tanks'; and for a water slide, enter 'water slide'. ")
w=1
#list of parts and code for graphics and text
if newestpart == "air scrubber":
print("[Ben-ni]: Great choice! There's no air in space, so the only air the astronauts have is that which they bring with them. Air scrubbers will turn carbon dioxide, the gas that we breath out, into oxygen, which we can breath in.")
spaceshipparts.append(newestpart)
t.pencolor(128,128,128)
t.penup()
t.goto(150,-150)
t.pendown()
t.dot(50)
t.pencolor(59,59,59)
t.dot(25)
t.penup()
t.goto(120,-190)
t.pendown()
t.pencolor(255,255,255)
t.write("Air scrubber",font=("Arial",8,"normal"))
elif newestpart == "food storage":
print("[Ben-ni]: Good choice! A journey to Mars would take several months at best, and their are no grocery stores on the way, so we have to bring all our food with us.")
spaceshipparts.append(newestpart)
t.penup()
t.goto(110,-30)
t.pencolor(128,128,128)
t.fillcolor(50,255,50)
t.begin_fill()
t.pendown()