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.1.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.1-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twilight_log_parser-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c94cbf35c410676306703e1e8ea0a0e578b87053410b7db5ea0c9a219835c5cd
MD5 a0827f0552c713f4d94a7173d80d933e
BLAKE2b-256 7cab2d161342cf8356d5bbcb0a6dcb89bd86b7c6d4916e9ab534562691720719

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for twilight_log_parser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 843b5635adee831fe9d451fe13f58c4e88d7759eafbfad0be79b8131adfa93e6
MD5 93c03e0257406bd17a78963c5c1234ab
BLAKE2b-256 1c33c54562bc915568ea0f6e65378af9db30e02d511c54681a7ff646629f2e94

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