Skip to main content
Documentation Status Available on PyPI License

This package provides a simple client and server for the Battleship game. It tries to be roughly compatible with the Collaborative Software Design implementation. Behind the scenes, it uses WebSocket for communication between client and server.

Client Usage

The entire client functionality is encapsulated by battleship_mp.client.GameSession. This allows to join a game, transmit a board of set ships, and exchange shots. Note that the server does not perform any notable game state evaluation; multiplayer peers must exchange their game state (notably, their entire game board) to locally check the game progress. See the class’ description on how to use it.

Set the environment variable BMP_SERVER_URL to the server’s websocket URL. For example, if the server runs locally on port 8765 then use BMP_SERVER_URL="ws://localhost:8765" before starting the program. Alternatively, this can also be set inside Python by using os.environ["BMP_SERVER_URL"] = "ws://localhost:8765".

Server Usage

The server is self-contained and does not need to be embedded in a program. It can be run directly from the command line, requiring a port and optionally the addresses/hostnames to bind to. For testing, it is suitable to bind to localhost:

~ $ python3 -m battleship_mp.server 8765 localhost

See the --help flag for options.

Installation

You can install the package directly via pip; only Python >= 3.8 is required.

~ $ python3 -m pip install kcsd-battleship-mp

Metadata

Release files for kcsd-battleship-mp 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kcsd-battleship-mp 1.1.0
File Size Uploaded
kcsd-battleship-mp-1.1.0.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kcsd-battleship-mp 1.1.0
File Interpreter ABI Platform
kcsd_battleship_mp-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / kcsd-battleship-mp-1.1.0.tar.gz

Download URL kcsd-battleship-mp-1.1.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0fcfb153b09a117c4b2ea5f03e884fdb8eb03f6c1002e337dd9600f6f16a4435
BLAKE2b-256 checksum
How to use checksums
6506946720bbaa784131589d484508d7074042cfa1c7a78d4ebf9b0c3e5cb71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / kcsd_battleship_mp-1.1.0-py3-none-any.whl

Download URL kcsd_battleship_mp-1.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b052cb1b9672ec0a16c2e9623919d71bca9a381d82c3e24b067287992366fd0
BLAKE2b-256 checksum
How to use checksums
e57472f86d1f576ba154ef2f7fd0c921a9337ce11dca6689590b1e7e0f89fe1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page