-
Notifications
You must be signed in to change notification settings - Fork 0
/
ship.py
34 lines (31 loc) · 840 Bytes
/
ship.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
"""
Description: Class for ship object
<pre>
Name: Gabriel Krishnadasan, Alizea Hinz, Aidan Rooney, Marissa Nicole Esteban (Pascal)
Course: COMP-305 FA22
Professor: A. Nuzen
</pre>
"""
class ship(object):
def __init__(self, length:int, horitontal:bool) -> None:
"""
Constructor for ship object
"""
self.length = length
self.horizontal = True
self.timeHit = 0
def change_orientation(self)->None:
"""
Funtion to change the orientation of a ship object
"""
if self.horizontal == True:
self.horizontal = False
else:
self.horizontal = True
def isSunk(self)->bool:
"""
Function to check if the ship is sunk
"""
if self.timeHit == self.length:
return True
return False