Skip to content

Instantly share code, notes, and snippets.

EMPTY = '.'
# making the matrix
matrix = []
for i in range(7):
# making a column
column = []
for j in range(6):
column.append(EMPTY)
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='')
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)