Skip to main content

A game of demons and soldiers on a 10x10 grid.

Project description

Interstice

interstice is a Python package that simulates a game involving soldiers and demons on a 10x10 grid. This package processes a 100-character string input to initialize the game state and determines the number of turns required for either soldiers or demons to win.

Installation

Install the package using pip (replace the version number as needed):

pip install interstice

Usage

Importing and Running the Game

The interstice package provides a single callable function, interstice, which takes a 100-character string as input and returns the number of turns the game lasted.

Example

from interstice import interstice

# Create a 100-character string with 'x', '*', and 'S'.
random_string = "S" * 50 + "*" * 30 + "x" * 20

# Run the game simulation
turns = interstice(random_string)
print(f"The game ended in {turns} turns.")

Input Validation

The input string must:

  • Be exactly 100 characters long.
  • Contain only the characters 'x', '*', or 'S'.

If the input is invalid, the function raises a ValueError.

Example Invalid Input

from interstice import interstice

# Invalid input
invalid_string = "S" * 101  # More than 100 characters

try:
    turns = interstice(invalid_string)
except ValueError as e:
    print(f"Error: {e}")

License

This project is licensed under the MIT 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

interstice-0.2.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

interstice-0.2.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file interstice-0.2.1.tar.gz.

File metadata

  • Download URL: interstice-0.2.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for interstice-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1c971791fcaa35e95978dcde282cbe327f6139d8a8550df08d1d720125512d82
MD5 45a315a1dec42528a0881a19544b9355
BLAKE2b-256 3e88c10c85e2f71c1882a4dd04aa5467abde3954d7becdd021c2d01881d47b8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: interstice-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for interstice-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 026b39c4384acebb42ee2abb80ff426cc01abf6bb8afd8582a37fefee36898de
MD5 cb3c32757db07b2ad2cd303b36d9a13a
BLAKE2b-256 0bcf697f0b4b1e0c5c73ba8eed8333ea60a5a4e0eeb5430d769f4900c60e87aa

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