BATTLESHIP GAME
Table of contents
Introduction
This is a Python implementation of the Battleship game, with a Flask UI.
Description
Players can place their ships on a board, and can play against an AI opponent (or multiplayer in a future iteration!), taking turns to sink eachothers ships until one or the other sinka all ships, declaring one side the winner!
There are 3 different versions of the game. One is a simple version, where you can attack ships on a predetermined board, giving coordinates in the terminal. The second is with an AI opponent, which can attack your board and you aim to destroy all the opponents ships before it destroys yours, which is also in the terminal. The third is the main game which can be played on the browser against the AI opponent.
Prerequisites
To install Battleship, you will need to have python installed. Download python here
- Python 3.7 or higher
Installation
Flask is an external python library and so needs to be installed using pip.
- Type cd followed by a space in the command prompt window
- Drag and drop the battleship folder into the window and press Enter
- Type in
pip install -U Flaskto download flask
For more information check out the official flask documentation:
Getting started
To play the Battleship game, follow these steps:
- Type cd followed by a space in the command prompt window
- Drag and drop the battleship folder into the window and press Enter
Windows:
$ cd C:\Users\user\Downloads\battleship
MacOS:
$ cd /Users/username/Downloads/battleship
- Run the main application:
$ flask --app main run
- Open your web browser and navigate to http://127.0.0.1:5000/placement
- Click to place your battleships, with 'r' or 'R' to rotate the ships and start the game.
Testing
All tests are present in a tests folder where each file contains the keyword "test".
Pytest is an external python library and so needs to be installed using pip.
$ pip install pytest
You will also need to install these plugins:
$ pip install pytest-depends
$ pip install pytest-cov
To run the tests, use the following command:
Windows:
$ python -m pytest
MacOS:
$ pytest
Details
- Authors: Yousuf Ahmed Linkedin
- License: This project is licensed under the MIT License - see the LICENSE file for details.
- Source: GitHub Repository
Metadata
Release files for Battleship-yousufaa 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Battleship_yousufaa-0.0.1.tar.gz | 9.6 kB | Without provenance | Details for Battleship_yousufaa-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Battleship_yousufaa-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for Battleship_yousufaa-0.0.1-py3-none-any.whl |
Total release size: 18.2 kB
Release files / Battleship_yousufaa-0.0.1.tar.gz
| Download URL | Battleship_yousufaa-0.0.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee0f7cce5297b5d0d1a03a8186eb1ac1a726f70802676ba07a77b6b132a5e780
|
|
BLAKE2b-256 checksum How to use checksums |
593e170568b70d0a64a9341d6d5fdbbc445402f5c2e55c31dfdcf27613cc8daa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Release files / Battleship_yousufaa-0.0.1-py3-none-any.whl
| Download URL | Battleship_yousufaa-0.0.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16ff6685fedf29d1142862b3edfffd6bc40a68709d42a975bb9a49486ca460c9
|
|
BLAKE2b-256 checksum How to use checksums |
f3fb9464f272fcbe17f209706c685df878279a61e799d0314d51a083e5be4a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Security for Battleship-yousufaa 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.