A Pythonic wargame engine for Guy Debord's Le Jeu de la Guerre
Project description
Pykrieg
A Pythonic wargame engine for Guy Debord's Le Jeu de la Guerre (A Game of War).
About
Pykrieg is a Python library that implements the complex rules of Guy Debord's strategic tabletop game, providing a clean, extensible API for developers to build custom interfaces, AI opponents, and analysis tools. The project is inspired by the successful python-chess library and follows similar design principles.
Planned Features
- Complete Game Engine: Full implementation of Debord's strategic game rules
- Clean API: Intuitive Pythonic interface modeled after python-chess
- Extensible Design: Easy to create custom variants, unit types, and victory conditions
- Format Support: Game record and position formats for saving/sharing games
- Engine Protocol: UCI-like protocol for communication between engines and frontends
- Well-Tested: Comprehensive test suite with 85%+ code coverage
Installation
pip install pykrieg
Quick Start
from pykrieg import Board, Fen
# Create a board
board = Board()
# Add pieces
board.set_piece(0, 0, {'type': 'INFANTRY', 'owner': 'NORTH'})
board.set_piece(5, 10, {'type': 'CAVALRY', 'owner': 'NORTH'})
board.set_piece(19, 24, {'type': 'INFANTRY', 'owner': 'SOUTH'})
# Serialize to FEN
fen = Fen.board_to_fen(board)
print(fen)
# Deserialize from FEN
board2 = Fen.fen_to_board(fen)
# Check territory
print(board.get_territory(0, 0)) # 'NORTH'
print(board.get_territory(19, 24)) # 'SOUTH'
# Convert coordinates
print(Board.tuple_to_spreadsheet(0, 0)) # 'A1'
print(Board.spreadsheet_to_tuple('A1')) # (0, 0)
Documentation
Comprehensive documentation is available at docs/ covering:
- Basic usage
- API reference for Board, FEN, and utility functions
- Coordinate system details
- FEN format specification
- Type definitions
Build documentation locally::
cd docs make html
Version 0.1.0 Features
- Board Representation: 20×25 grid with territory divisions (North/South)
- Coordinate System: Support for tuple, spreadsheet-style, and index formats
- FEN Serialization: Save and load board states in FEN format
- Territory Management: Query and manage North and South territories
- Well-Documented: Comprehensive docstrings and Sphinx documentation
Development Status
Current Version: 0.1.0
See 0.1.0-implementation-plan.ignore.md for the complete implementation plan.
Completed Features
- Project setup and tooling
- Board class with 20×25 grid representation
- Territory system (North/South)
- Coordinate system (tuple, spreadsheet-style, index)
- FEN serialization format
- Core data structures
- Game state management with FEN serialization
- Documentation framework setup
Next Steps
After 0.1.0, the next patch will implement:
- Unit type system (Infantry, Cavalry, Cannon, Arsenals, Relays)
- Unit class hierarchy
- Unit placement and querying
- Unit attribute testing
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Donations
If you like the project and want to support future development, consider donating!
License
This project is licensed under the GNU General Public License v3.0 - see LICENSE for details.
The GPL v3 license ensures that:
- The software remains free for all users
- Derivative works must be shared under the same license (copyleft)
- Commercial use is prohibited (requires separate commercial license)
- Users have the freedom to study, modify, and distribute the software
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pykrieg-0.1.0.tar.gz.
File metadata
- Download URL: pykrieg-0.1.0.tar.gz
- Upload date:
- Size: 35.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcdec74c28ecec09c31d457ac3fdaace2505423c86ffe8875c95d6329253175f
|
|
| MD5 |
822c509b1c6bad37a7c772f9f2f8d60d
|
|
| BLAKE2b-256 |
48490bf85cbcce5896b421b58a57c41f3d406951f46e3f859789254a11c9b4ee
|
File details
Details for the file pykrieg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pykrieg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f256969a0023d38cd80c2130cbb441f7f8699055639d79eec5a2171f0d447b3
|
|
| MD5 |
341fb663cd36930b414a2d7fa7a04f9b
|
|
| BLAKE2b-256 |
82cdef1bcc81f15a61afedfdc5b2ae9669fd2c3194f95a6bed3247d49aadc6ed
|