Skip to content

Barriose01/Battleship-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Battleship-Python

Battleship made in Python

Battleship Game Instructions

1. Objective

The goal of the game is to sink all 5 of your opponent’s ships before they sink yours.


2. Game Setup

  • The game is played on an 8×8 grid.
  • There are two players:
    • Human player
    • Computer
  • Each player has 5 ships.
  • Each ship occupies exactly one square (no multi-square ships).
  • Ships are placed secretly on the player’s own board.

3. Boards

Each player interacts with two boards:

Attack Board (Global Board)

  • Shows all available squares where attacks can be made.
  • Used to track hits and misses against the opponent.

Defense Board (Your Board)

  • Shows where your own ships are placed.

4. Symbols & Markings

  • [ ] → A square that contains a ship (only visible on your own board)
  • (X) → A successful hit on the opponent’s ship
  • (*) → A successful hit by the computer on your ship
  • (-) → An attack that missed (no ship in that square)

5. Turn Order

  • A coin is tossed to determine who goes first.

On your turn:

  1. Choose one square on the opponent’s board to attack.
  2. The square will be marked as:
    • (X) if you hit a ship
    • (-) if you miss

On the computer's turn:

  1. It randomly attacks one square on your board.
  2. The square will be marked as:
    • (*) if it hits your ship
    • (-) if it misses

6. Rules

  • A square can only be attacked once.
  • Ships do not move after being placed.
  • Players cannot see the opponent’s ship locations.
  • The computer follows the same rules as the player.

7. Winning the Game

The game ends when one player has all 5 ships hit.

  • If you sink all 5 computer ships first → You win! 🎉
  • If the computer sinks all 5 of your ships first → Computer wins 💻

About

Battleship made in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages