-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (26 loc) · 929 Bytes
/
main.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
35
36
from gameboard import Gameboard
from ship import Ship
from utils import user_ships, console_ships
from txt_generation import save_boards_to_txt
from game import start_game
# Run main.py first
def main():
ships = [
Ship("Boat", 2, None, None, None, None),
Ship("Submarine", 3, None, None, None, None),
Ship("Destroyer", 4, None, None, None, None)
]
# Initialize game boards
user_gameboard = Gameboard()
console_gameboard = Gameboard()
# Place user's ships
user_ships(user_gameboard, ships)
# Place console's ships randomly
console_ships(console_gameboard, ships)
# Save boards to text files for user visualization
save_boards_to_txt(user_gameboard, console_gameboard)
# Start the game
start_game(user_gameboard, console_gameboard)
print("Thank you for playing Battleship!")
if __name__ == '__main__':
main()