Simple Battleship game
Project description
Battleship 🛥️
Simple Battleship game 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
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. |
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
battleship-py-0.2.1.tar.gz
(8.4 kB
view hashes)
Built Distribution
Close
Hashes for battleship_py-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d00a42eaea63076b32d205bb46c034f2c3f9d78aca7fe96dfe894df0ca3c6bd |
|
MD5 | 55c7f0b3e69fa670cad8abec7de47ce9 |
|
BLAKE2b-256 | 7238af1459f61fb82ff598c14d2cdd8b6d0467fe5714af86c9cf8e88df559b58 |