This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EMPTY = '.' | |
# making the matrix | |
matrix = [] | |
for i in range(7): | |
# making a column | |
column = [] | |
for j in range(6): | |
column.append(EMPTY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Ship: | |
'''all ships are part of the boat class''' | |
number = 1 | |
def __init__(self, player, length): | |
'''chooses random location & direction for ship for a given length''' | |
# print('ship size: ', length, sep='') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Boat: | |
'''all ships are part of the boat class''' | |
def __init__(self, length): | |
'''chooses random location & direction for ship for a given length''' | |
# print('\n', 'ship size: ', length, sep='') | |
self.direction = random.randint(0, 3) | |
# print('direction:', self.direction) |