0% found this document useful (0 votes)
65 views1 page

Battleship

This project report describes building a simplified one-player version of the board game Battleship in Python. A single ship is hidden in a random location on a 5x5 grid and the player has 4 guesses to try and sink the ship. While the full Battleship game rules would require many conditionals, this mini-project determines the winner by comparing the user's choice to the computer's random choice. The player loses if they guess off the board, a spot already guessed, or just miss the ship in 4 turns.

Uploaded by

Charan C G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views1 page

Battleship

This project report describes building a simplified one-player version of the board game Battleship in Python. A single ship is hidden in a random location on a 5x5 grid and the player has 4 guesses to try and sink the ship. While the full Battleship game rules would require many conditionals, this mini-project determines the winner by comparing the user's choice to the computer's random choice. The player loses if they guess off the board, a spot already guessed, or just miss the ship in 4 turns.

Uploaded by

Charan C G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

PROJECT REPORT

BATTLESHIP USING PYTHON

ABSTRACT
In this project you will build a simplified, one-player version of the classic board game Battleship
In this version of the game, there will be a single ship hidden in a random location on a 5x5 grid.
The player will have 4 guesses to try to sink the ship .To build this game we will use our
knowledge of if/elif/else, conditionals and functions in Python. 

APPROACH USED
While Battleship has a set a rules that logically determine who wins a round of Battleship,
coding up these rules would require a number of if/elif/else clauses in this mini-project code. A
simpler method for determining the winner is that user choice is compare with computer
Random choice and decide the winner based on that.

RESULTS
A simpler method for determining the winner is that user choice is compare with computer
Random choice and decide the winner based on that.
Miss condition:
1. They can enter a guess that's off the board.
2. They can guess a spot they’ve already guessed.
3. They can just miss the ship.

You might also like