https://github.com/joamag/battleship
Simple Battleship game written in Python 🐍
https://github.com/joamag/battleship
battleship game python
Last synced: about 2 months ago
JSON representation
Simple Battleship game written in Python 🐍
- Host: GitHub
- URL: https://github.com/joamag/battleship
- Owner: joamag
- License: apache-2.0
- Created: 2022-12-05T13:31:12.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-06T09:27:54.000Z (about 2 years ago)
- Last Synced: 2025-02-19T16:19:24.847Z (2 months ago)
- Topics: battleship, game, python
- Language: Python
- Homepage:
- Size: 1.63 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Battleship 🛥️
Simple Battleship game written in Python 🐍.
This is a simple implementation with dynamic grid support (defaults to 10x10).
## Challenge
Create an application to allow a single human player to play a one-sided game of Battleships against ships placed by the computer.
The program should create a 10x10 grid, and place a number of ships on the grid at random with the following sizes:
* 1x Battleship (5 squares)
* 2x Destroyers (4 squares)The player enters coordinates of the form “A5”, where "A" is the column and "5" is the row, to specify a square to target. Shots result in hits, misses or sinks. The game ends when all ships are sunk.
## Run
```bash
pip3 install battleship-py
python3 -m battleship
```## Commands
| Name | Description |
| ------- | ------------------------------------------------ |
| HELP | Prints an help message about the commands. |
| QUIT | Quits the Battleship game. |
| DESTROY | Destroys the game by shooting all the vessels. |
| PRINT | Prints the current state of the game to console. |
| EMOJI | Prints the emoji version of the state. |
| (X)(Y) | Shoots the target at coordinate (eg: A5). |## Build Automation
[](https://github.com/joamag/battleship/actions)
[](https://pypi.python.org/pypi/battleship-py)
[](https://www.apache.org/licenses/)