forked from landalex/FinalProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonShine.py
More file actions
125 lines (97 loc) · 2.92 KB
/
pythonShine.py
File metadata and controls
125 lines (97 loc) · 2.92 KB
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
# PYTHON LOL (Name a Work in Progess)
# Created by Evan Chisholm and Alex Land
import random
import turtle as t
# VARIABLES
godMode = ""
biomePosition = ""
fillColor = "tan"
catastropheNumber = 0
# FUNCTIONS
def gameStart():
global godMode
godMode = ""
while godMode == "":
godModeInput = raw_input("Would you like to manually choose biomes (y/n)? ")
if godModeInput == "y":
godMode = 1
elif godModeInput == "n":
godMode = 0
else:
print "Please enter y for yes or n for no."
return godMode
def biomeGenerator(godMode):
global biomePosition
biomePosition = ""
if godMode == 1:
biomePosition = input("Which biome would you like to start at (Pick a number between 1 and 8)? ")
if godMode == 0:
biomePosition = random.randint(1,8)
return biomePosition
def biomeDraw(fillColor):
t.fillcolor(fillColor)
t.begin_fill()
t.forward(50)
t.left(90)
t.forward(100)
t.left(90)
t.forward(50)
t.left(90)
t.forward(100)
t.left(90)
t.end_fill()
t.forward(70)
def playerDraw():
t.fillcolor("red")
t.begin_fill()
t.circle(50)
t.end_fill()
def drawBoard(catastropheNumber):
biomeDraw() * (8 - catastropheNumber)
def drawPlayer(biomeNumber):
t.penup()
t.forward(25)
t.forward((biomeNumber - 1) * 50)
playerDraw()
def read_string_list_from_file(the_file):
'''
CODE PROVIDED TO INCORPORATE
<file-name including extension .txt>(String) --> List of strings
Assumptions:
1) the_file is in the same directory as this program
2) the_file contains one biome data per line
3) after each biome in the file there is a return (
so that the next biome is in the next line), and also
there is (one single) return after the last biome
in the_file
to call or invoke this function:
listStrings = read_string_list_from_file(<file-name.txt in quotes>)
'''
fileRef = open(the_file,"r") # opening file to be read
localList=[]
for line in fileRef:
string = line[0:len(line)-1] # eliminates trailing '\n'
# of each line
localList.append(string) # adds string to list
fileRef.close()
#........
#print "\n JUST TO TRACE, the local list of strings is:\n"
#for element in localList:
# print element
#print
#........
return localList
def create_lists_board(listStrings):
'''
RECOMMENDED
'''
# your code...
return #.... as many lists as needed to represent the board
# one for the diamonds values, etc.
def show_board(mssg):
'''
RECOMMENDED
'''
print "\nShowing board... " + mssg
print "\n The board at this point contains..."
# your code...