Skip to main content

API to parse Twilight Struggle game logs into a structured format.

Project description

PyPI version Python Support

twilight-log-parser

twilight-log-parser is a Python package that parses Twilight Struggle game logs into a structured format for analysis or other uses.

Installation

Install twilight-log-parser using pip:

pip install twilight-log-parser

Usage

An example of how to use the package to ingest a single log file can be found in src/ingest_log.py.

To parse a single log file and output to CSVs (plays and board states) you can run the following command:

python -m twilight_log_parser.ingest_log test_logs/<pick-a-log-file>.txt [--output-dir <output-dir>]

Current Features

  • CSV output of plays and board states
  • Tracked objects during each play include
    • Board state (influence)
    • Defcon changes
    • Space Race changes
    • Headline changes
    • VP Track
    • MilOps
    • Revealed Cards
    • Deck Status (cannot track known cards in hand)
    • Dice Rolls
    • Active Effects per Play
    • Influence Changes
    • Targets Country(s) - Coup, War, Realignment
  • Determines winner and win type
  • API for accessing the above

Roadmap

  • Add real unit tests
  • SQLAlchemy DB integration tooling (for easier analysis)
  • Log Validation
  • Improved error handling

Contributions

Maintaining twilight-log-parser is a community effort, and we'd love to have help! You can support the project by reporting bugs, requesting features, writing documentation, helping to narrow down issues, and submitting code.

Especially if you have unique game situations, we'd like to work on validating them and adding them to a test suite!

License

This project is licensed under the GNU General Public License v3 or later (GPLv3+) - see the LICENSE file for details.

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

twilight_log_parser-0.1.0.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

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

twilight_log_parser-0.1.0-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file twilight_log_parser-0.1.0.tar.gz.

File metadata

  • Download URL: twilight_log_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for twilight_log_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02487557e1fed4c5c42d98c6202b2d54496c27866e8a8b381fea8eac3d808756
MD5 13a5cd4d9cfcd8b28bf6fa63b8d760fd
BLAKE2b-256 2be0d6eedd5b514800852219b88bfbd654be116c4b1b242eed2d0b9dc7ee8b24

See more details on using hashes here.

File details

Details for the file twilight_log_parser-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for twilight_log_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3779aefa717045d51f0efdb4acb386e1581777077ebb28377a458ad4b4b17ef3
MD5 507c6e885fe7cecaeb34070b37c51f74
BLAKE2b-256 53b4261fce142c91f174fea4b77ed3a33461b35b1c05ce08fcc6923597229082

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