1. As users we would like to enter our names.
2. Enter ships on our 2 different boards.
3. Players will start randomly.
4. Enter positions of shooting:
- if player miss, he lost his turn
- if player hit the ship of opponent, he can try another shot
5. While player take down all parts of ship he get a message.
6. While player take all ships of his opponent, he give a message about WIN!
main.py
square.py
Attributes
-
is_markedBool with starting False value. -
shotTuple of int, where player try hit the ship of opponent.
Instance methods
-
__init__(self, row, column, is_marked)Construct a piece of ship, and checking if player try shoot on this positions before. -
lifeCheck if player still have ships/squares on board. -
is_markedCheck if player try to hit in the same square of board
ship.py ###Class ship
Attributes
-
positions- positions x, y
-
squares- list of tuples positions of ships
Instance Methods
__init__(self, positions)
ocean.py
Attributes
-
shipslist -
boardlist
Instance methods
-
__init__(self, ships, board)Create an object is a game board. -
fill_boardCreate a empty template, than fill it up with ships. -
add_shipTake start position parameters and create ship.
player.py ###Class
Attributes
nameContain name of Players
Instance methods
put_ships_on_boardFill board with player ships