Skip to main content

Play Battleships, includes a basic cli front end

Project description

Python project to write a cli version of the classic game battleships. Uses classes. Works as an API, called from a seperate file, only imports needed are the references. Started as a project to cement my knowledge of the MVC patten, python classes, OOP and parts of the python standard libaries.

Features: human player input to place ships (checks for valid ship placements) auto populate boards for computer players human readable boards separate boards to record moves taken cheat mode to see the computer player's board

To use the CLI front end, and play the game, install the module, then simply run Battleships_api.CLIBattleships eg. py -m Battleships.CLIBattleships

This is the list of things that I think will end up with a reasonable working version of battleships. Please add to this list if you think of things that will be useful to the project.

  • Documentation for the API!!
  • Unittests
  • Have ship placement done on an individual basis so that front end can control display of the board.
  • Refactor winner method so that take shot returns simpler results. Winner should only return the winner not moves made as well.
  • Highlight last incoming shot when displaying player board in cli
  • Implement unit tests for public methods
  • Build a web front end
  • Use a framework such as Flask to make calls to the api according to GET and POST requests.

In the future I plan to rebuild this in c++ for the command line, and possibly Java to run as a back end to a web app.

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

Battleships_api-0.1.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Battleships_api-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file Battleships_api-0.1.2.tar.gz.

File metadata

  • Download URL: Battleships_api-0.1.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for Battleships_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4979372730cefe66071c0e3d8c0df1d9d2bbfe789c40cb7aab3a1f3735904772
MD5 90c954d1ecbdfbf08f3f05bf05313da2
BLAKE2b-256 f237f428155056feffe8b96cb90278100fc03d6bdc46434a2dd77ea64bc0c274

See more details on using hashes here.

File details

Details for the file Battleships_api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: Battleships_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for Battleships_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fe2c8a10bbee523d23af0cea6b8dabca0276dc3e241773779186d7f81d73d69
MD5 ee6c2416ea730c25da2696e2ba232323
BLAKE2b-256 ca768c09f911dbfd7b0f83fdd4ae44b6ed109610863aa2e3562797d85e856066

See more details on using hashes here.

Supported by

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