Skip to main content

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.
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

Build Status PyPi Status License

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 details)

Uploaded Source

Built Distribution

battleship_py-0.2.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file battleship-py-0.2.1.tar.gz.

File metadata

  • Download URL: battleship-py-0.2.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for battleship-py-0.2.1.tar.gz
Algorithm Hash digest
SHA256 503fa80ddbd88396652f58364210bea88d4a3cd8be0906971ba588479b3295c4
MD5 e808f4f9a2fc18a9b7890f60b4200256
BLAKE2b-256 1d778a855435144b52bbd6b780715c1792af29ac41403c4cceba33a1e089bdbf

See more details on using hashes here.

Provenance

File details

Details for the file battleship_py-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: battleship_py-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for battleship_py-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d00a42eaea63076b32d205bb46c034f2c3f9d78aca7fe96dfe894df0ca3c6bd
MD5 55c7f0b3e69fa670cad8abec7de47ce9
BLAKE2b-256 7238af1459f61fb82ff598c14d2cdd8b6d0467fe5714af86c9cf8e88df559b58

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page