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.4.tar.gz (63.7 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.4-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twilight_log_parser-0.1.4.tar.gz
  • Upload date:
  • Size: 63.7 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.4.tar.gz
Algorithm Hash digest
SHA256 49f6f3e2b7933ff317ea7d57d81281ad0700831dd3247feae07c7389de0de171
MD5 18199f5d1feb14f1b4c634e8b1ef7d75
BLAKE2b-256 84ca177acbb14b3b6d90cbc7149a802509629d46ab8980ee3ae0907ba04766ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for twilight_log_parser-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 69f52b5db380f2f4ec65a42b9c6704604e5f92c52c007ce00f401b8db02b5ef4
MD5 3ac59a54160c4e50d3b512d0374710d4
BLAKE2b-256 fcdb032f1dcb118fce577ff7c419ff85a0d74c5412b2260454f434b21468ac38

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