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.2.tar.gz (61.6 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.2-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twilight_log_parser-0.1.2.tar.gz
  • Upload date:
  • Size: 61.6 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.2.tar.gz
Algorithm Hash digest
SHA256 1fe4c56466b1f858873756a43b45091b911a824ef9789308cf5136cace9ef52b
MD5 fdf0ca6c4340a0af33d3b7c9023eb765
BLAKE2b-256 3068c4f9e1d6ba4c70a56d369fa07b3fdab0b05100ecaa515b367c59e8da91a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for twilight_log_parser-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3acdc330e240bd299f942ab93509f2293f772b76aa34fbd8e30bc3213be2208
MD5 229101e9dfe8f36a213ec74a37e21064
BLAKE2b-256 1a7feb91612b93fdaca308a15566cc1beac023c7e01a377e59b8d421a6ed8b83

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