diplomacy.engine.renderer

Renderer

  • Contains the renderer object which is responsible for rendering a game state to svg
class diplomacy.engine.renderer.Renderer(game, svg_path=None)[source]

Bases: object

Renderer object responsible for rendering a game state to svg

__init__(game, svg_path=None)[source]

Constructor

Parameters:
  • game (diplomacy.Game) – The instantiated game object to render
  • svg_path (str, optional) – Optional. Can be set to the full path of a custom SVG to use for rendering the map.
render(incl_orders=True, incl_abbrev=False, output_format='svg', output_path=None)[source]

Renders the current game and returns the XML representation

Parameters:
  • incl_orders (bool, optional) – Optional. Flag to indicate we also want to render orders.
  • incl_abbrev (bool, optional) – Optional. Flag to indicate we also want to display the provinces abbreviations.
  • output_format (str, optional) – The desired output format. Valid values are: ‘svg’
  • output_path (str | None, optional) – Optional. The full path where to save the rendering on disk.
Returns:

The rendered image in the specified format.