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.3.tar.gz (63.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.3-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twilight_log_parser-0.1.3.tar.gz
  • Upload date:
  • Size: 63.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.3.tar.gz
Algorithm Hash digest
SHA256 bd36c62d0d28cbd557afb1e774f5c4168e747fa2c9d3c240dfc21a7ebc7d45c9
MD5 48a5ca221a4c3152556a4eee8a41b4e1
BLAKE2b-256 241a793003262dc879bbda6040489a14cb0559e8ee5e038c66ad2054e099d591

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for twilight_log_parser-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 74224e1d25b9d14ef0252642f69d12bda65855ac1bd83f19086803eea111a8ae
MD5 f413374ca2db4ce1aa60b9efc8176b31
BLAKE2b-256 689ab4651eaf9c2b862283aaa2a570baf9e1b170a4f3a388d7fc0d40ba7d857e

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