taparkins / pydip Goto Github PK
View Code? Open in Web Editor NEWpython library for Diplomacy rules system
License: MIT License
python library for Diplomacy rules system
License: MIT License
Hey! First off, thanks for making this! I'm tinkering with an AI project revolving around Diplomacy and this library looks really useful.
I found the entry points you mentioned in the other issue, and got a basic turn loop working, but there's one thing I'm confused about. Player objects have lists of Unit objects, but the map also has a dict mapping country name strings to Unit objects, which seems like the same information being stored in two places. All the other functions seem to mostly operate on the map, and I'm unclear on how exactly to handle the Player.units lists - should I ignore them? If not, should I manually update them at the end of each turn, or is there a function to handle this that I missed?
Hey there! Nice looking library. I'm playing around with a little research project using Diplomacy, and I was wondering if you have any light documentation or examples of basic usage? If I can get a handle for what the main 'entrypoints' are here, I can bootstrap from there.
Just curious.
In the command folder (https://github.com/aparkins/pydip/tree/main/pydip/player/command) there are three types of commands. What is the distinction between command, adjustment command, and retreat command? Specifically I don't understand the comments describing adjust command.
Ah nevermind, I understand, adjustment commands are for builds and disbands.
Thanks for the well-designed package!
I did run into a strange situation that is somehow missed by the DATC suite (possibly because of the combination of using fleets and troops). I believe the resolution of the example below is incorrect as the troop attacking Bulgaria should be successful, despite its support getting attacked.
from pydip.player.unit import Unit, UnitTypes
from pydip.test.command_helper import CommandType, CommandHelper
from pydip.test.player_helper import PlayerHelper
from pydip.test.turn_helper import TurnHelper
helper = TurnHelper([
PlayerHelper('Italy', [
CommandHelper(CommandType.MOVE, UnitTypes.FLEET, 'Bulgaria South Coast', 'Greece Coast'),
]),
PlayerHelper('Austria', [
CommandHelper(CommandType.MOVE, UnitTypes.TROOP, 'Serbia', 'Bulgaria'),
CommandHelper(CommandType.SUPPORT, UnitTypes.TROOP, 'Greece', 'Serbia', 'Bulgaria'),
])
])
result = helper.resolve()
assert result == {
'Austria': {
Unit(UnitTypes.TROOP, 'Serbia'): None,
Unit(UnitTypes.TROOP, 'Greece'): None,
},
'Italy': {
Unit(UnitTypes.FLEET, 'Bulgaria South Coast'): None,
},
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.