-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecies.go
208 lines (171 loc) · 4.62 KB
/
species.go
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
package main
type species interface {
Initialize()
ConsumptionRate() float64
Width() float64
Height() float64
FlightSpeed() float64
Song() string
SingingLikelihood() uint
Animation() string
}
// Northern Cardinal species.
type cardinal struct {
consumptionRate float64
width float64
height float64
flightSpeed float64
songName string
singingLikelihood uint
animation string
}
func (cardinal *cardinal) Initialize() {
cardinal.consumptionRate = .002
cardinal.width = 190
cardinal.height = 221
cardinal.flightSpeed = 30
cardinal.songName = "Downy Woodpecker"
cardinal.singingLikelihood = 100
cardinal.animation = "sprites/northernCardinal.png"
}
func (cardinal *cardinal) ConsumptionRate() float64 {
return cardinal.consumptionRate
}
func (cardinal *cardinal) Width() float64 {
return cardinal.width
}
func (cardinal *cardinal) Height() float64 {
return cardinal.height
}
func (cardinal *cardinal) FlightSpeed() float64 {
return cardinal.flightSpeed
}
func (cardinal *cardinal) Animation() string {
return cardinal.animation
}
func (cardinal *cardinal) Song() string {
return cardinal.songName
}
func (cardinal *cardinal) SingingLikelihood() uint {
return cardinal.singingLikelihood
}
// Downy Woodpecker species.
type downyWoodpecker struct {
consumptionRate float64
width float64
height float64
flightSpeed float64
songName string
singingLikelihood uint
animation string
}
func (downyWoodpecker *downyWoodpecker) Initialize() {
downyWoodpecker.consumptionRate = .003
downyWoodpecker.width = 190
downyWoodpecker.height = 221
downyWoodpecker.flightSpeed = 30
downyWoodpecker.songName = "Downy Woodpecker"
downyWoodpecker.singingLikelihood = 30
downyWoodpecker.animation = "sprites/downyWoodpecker.png"
}
func (downyWoodpecker *downyWoodpecker) ConsumptionRate() float64 {
return downyWoodpecker.consumptionRate
}
func (downyWoodpecker *downyWoodpecker) Width() float64 {
return downyWoodpecker.width
}
func (downyWoodpecker *downyWoodpecker) Height() float64 {
return downyWoodpecker.height
}
func (downyWoodpecker *downyWoodpecker) FlightSpeed() float64 {
return downyWoodpecker.flightSpeed
}
func (downyWoodpecker *downyWoodpecker) Song() string {
return downyWoodpecker.songName
}
func (downyWoodpecker *downyWoodpecker) Animation() string {
return downyWoodpecker.animation
}
func (downyWoodpecker *downyWoodpecker) SingingLikelihood() uint {
return downyWoodpecker.singingLikelihood
}
// Black-capped Chickadee species.
type chickadee struct {
consumptionRate float64
width float64
height float64
flightSpeed float64
songName string
singingLikelihood uint
animation string
}
func (chickadee *chickadee) Initialize() {
chickadee.consumptionRate = .005
chickadee.width = 190
chickadee.height = 221
chickadee.flightSpeed = 30
chickadee.songName = "Downy Woodpecker"
chickadee.singingLikelihood = 100
chickadee.animation = "sprites/blackCappedChickadee.png"
}
func (chickadee *chickadee) ConsumptionRate() float64 {
return chickadee.consumptionRate
}
func (chickadee *chickadee) Width() float64 {
return chickadee.width
}
func (chickadee *chickadee) Height() float64 {
return chickadee.height
}
func (chickadee *chickadee) FlightSpeed() float64 {
return chickadee.flightSpeed
}
func (chickadee *chickadee) Song() string {
return chickadee.songName
}
func (chickadee *chickadee) Animation() string {
return chickadee.animation
}
func (chickadee *chickadee) SingingLikelihood() uint {
return chickadee.singingLikelihood
}
// Tufted Titmouse species.
type titmouse struct {
consumptionRate float64
width float64
height float64
flightSpeed float64
songName string
singingLikelihood uint
animation string
}
func (titmouse *titmouse) Initialize() {
titmouse.consumptionRate = .002
titmouse.width = 190
titmouse.height = 221
titmouse.flightSpeed = 30
titmouse.songName = "Downy Woodpecker"
titmouse.singingLikelihood = 80
titmouse.animation = "sprites/tuftedTitmouse.png"
}
func (titmouse *titmouse) ConsumptionRate() float64 {
return titmouse.consumptionRate
}
func (titmouse *titmouse) Width() float64 {
return titmouse.width
}
func (titmouse *titmouse) Height() float64 {
return titmouse.height
}
func (titmouse *titmouse) FlightSpeed() float64 {
return titmouse.flightSpeed
}
func (titmouse *titmouse) Song() string {
return titmouse.songName
}
func (titmouse *titmouse) Animation() string {
return titmouse.animation
}
func (titmouse *titmouse) SingingLikelihood() uint {
return titmouse.singingLikelihood
}