diplomacy.daide.notifications

DAIDE Notifications - Contains a list of responses sent by the server to the client

class diplomacy.daide.notifications.DaideNotification(**kwargs)[source]

Bases: object

Represents a DAIDE response.

__init__(**kwargs)[source]

Constructor

to_bytes()[source]

Returning the bytes representation of the response

to_string()[source]

Returning the string representation of the response

class diplomacy.daide.notifications.MapNameNotification(map_name, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a MAP DAIDE response. Sends the name of the current map to the client.

Syntax:

MAP ('name')
__init__(map_name, **kwargs)[source]

Builds the response :param map_name: String. The name of the current map.

class diplomacy.daide.notifications.HelloNotification(power_name, passcode, level, deadline, rules, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a HLO DAIDE response. Sends the power to be played by the client with the passcode to rejoin the game and the details of the game.

Syntax:

HLO (power) (passcode) (variant) (variant) ...

Variant syntax:

LVL n           # Level of the syntax accepted
MTL seconds     # Movement time limit
RTL seconds     # Retreat time limit
BTL seconds     # Build time limit
DSD             # Disables the time limit when a client disconects
AOA             # Any orders accepted

LVL 10:

Variant syntax:

PDA             # Accept partial draws
NPR             # No press during retreat phases
NPB             # No press during build phases
PTL seconds     # Press time limit
__init__(power_name, passcode, level, deadline, rules, **kwargs)[source]

Builds the response

Parameters:
  • power_name – The name of the power being played.
  • passcode – Integer. A passcode to rejoin the game.
  • level – Integer. The daide syntax level of the game
  • deadline – Integer. The number of seconds per turn (0 to disable)
  • rules – The list of game rules.
class diplomacy.daide.notifications.SupplyCenterNotification(powers_centers, map_name, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a SCO DAIDE notification. Sends the current supply centre ownership.

Syntax:

SCO (power centre centre ...) (power centre centre ...) ...
__init__(powers_centers, map_name, **kwargs)[source]

Builds the notification

Parameters:
  • powers_centers – A dict of {power_name: centers} objects
  • map_name – The name of the map
class diplomacy.daide.notifications.CurrentPositionNotification(phase_name, powers_units, powers_retreats, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a NOW DAIDE notification. Sends the current turn, and the current unit positions.

Syntax:

NOW (turn) (unit) (unit) ...

Unit syntax:

power unit_type province
power unit_type province MRT (province province ...)
__init__(phase_name, powers_units, powers_retreats, **kwargs)[source]

Builds the notification

Parameters:
  • phase_name – The name of the current phase (e.g. ‘S1901M’)
  • powers – A list of diplomacy.engine.power.Power objects
class diplomacy.daide.notifications.MissingOrdersNotification(phase_name, power, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a MIS DAIDE response. Sends the list of unit for which an order is missing or indication about required disbands or builds.

Syntax:

MIS (unit) (unit) ...
MIS (unit MRT (province province ...)) (unit MRT (province province ...)) ...
MIS (number)
__init__(phase_name, power, **kwargs)[source]

Builds the response :param phase_name: The name of the current phase (e.g. ‘S1901M’) :param power: The power to check for missing orders :type power: diplomacy.engine.power.Power

class diplomacy.daide.notifications.OrderResultNotification(phase_name, order_bytes, results, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a ORD DAIDE response. Sends the result of an order after the turn has been processed.

Syntax:

ORD (turn) (order) (result)
ORD (turn) (order) (result RET)

Result syntax:

SUC         # Order succeeded (can apply to any order).
BNC         # Move bounced (only for MTO, CTO or RTO orders).
CUT         # Support cut (only for SUP orders).
DSR         # Move via convoy failed due to dislodged convoying fleet (only for CTO orders).
NSO         # No such order (only for SUP, CVY or CTO orders).
RET         # Unit was dislodged and must retreat.
__init__(phase_name, order_bytes, results, **kwargs)[source]

Builds the response

Parameters:
  • phase_name – The name of the current phase (e.g. ‘S1901M’)
  • order_bytes – The bytes received for the order
  • results – An array containing the error codes.
class diplomacy.daide.notifications.TimeToDeadlineNotification(seconds, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a TME DAIDE response. Sends the time to the next deadline.

Syntax:

TME (seconds)
__init__(seconds, **kwargs)[source]

Builds the response :param seconds: Integer. The number of seconds before deadline

class diplomacy.daide.notifications.PowerInCivilDisorderNotification(power_name, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a CCD DAIDE response. Sends the name of the power in civil disorder.

Syntax:

CCD (power)
__init__(power_name, **kwargs)[source]

Builds the response :param power_name: The name of the power being played.

class diplomacy.daide.notifications.PowerIsEliminatedNotification(power_name, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a OUT DAIDE response. Sends the name of the power eliminated.

Syntax:

OUT (power)
__init__(power_name, **kwargs)[source]

Builds the response :param power_name: The name of the power being played.

class diplomacy.daide.notifications.DrawNotification(**kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a DRW DAIDE response. Indicates that the game has ended due to a draw

Syntax:

DRW
__init__(**kwargs)[source]

Builds the response

class diplomacy.daide.notifications.MessageFromNotification(from_power_name, to_power_names, message, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a FRM DAIDE response. Indicates that the game has ended due to a draw

Syntax:

FRM (power) (power power ...) (press_message)
FRM (power) (power power ...) (reply)
__init__(from_power_name, to_power_names, message, **kwargs)[source]

Builds the response

class diplomacy.daide.notifications.SoloNotification(power_name, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a SLO DAIDE response. Indicates that the game has ended due to a solo by the specified power

Syntax:

SLO (power)
__init__(power_name, **kwargs)[source]

Builds the response :param power_name: The name of the power being solo.

class diplomacy.daide.notifications.SummaryNotification(phase_name, powers, daide_users, years_of_elimination, **kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents a SMR DAIDE response. Sends the summary for each power at the end of the game

Syntax:

SMR (turn) (power_summary) ...

power_summary syntax:

power ('name') ('version') number_of_centres
power ('name') ('version') number_of_centres year_of_elimination
__init__(phase_name, powers, daide_users, years_of_elimination, **kwargs)[source]

Builds the Notification

class diplomacy.daide.notifications.TurnOffNotification(**kwargs)[source]

Bases: diplomacy.daide.notifications.DaideNotification

Represents an OFF DAIDE response. Requests a client to exit

Syntax:

OFF
__init__(**kwargs)[source]

Builds the response

diplomacy.daide.notifications.MAP

alias of diplomacy.daide.notifications.MapNameNotification

diplomacy.daide.notifications.HLO

alias of diplomacy.daide.notifications.HelloNotification

diplomacy.daide.notifications.SCO

alias of diplomacy.daide.notifications.SupplyCenterNotification

diplomacy.daide.notifications.NOW

alias of diplomacy.daide.notifications.CurrentPositionNotification

diplomacy.daide.notifications.MIS

alias of diplomacy.daide.notifications.MissingOrdersNotification

diplomacy.daide.notifications.ORD

alias of diplomacy.daide.notifications.OrderResultNotification

diplomacy.daide.notifications.TME

alias of diplomacy.daide.notifications.TimeToDeadlineNotification

diplomacy.daide.notifications.CCD

alias of diplomacy.daide.notifications.PowerInCivilDisorderNotification

diplomacy.daide.notifications.OUT

alias of diplomacy.daide.notifications.PowerIsEliminatedNotification

diplomacy.daide.notifications.DRW

alias of diplomacy.daide.notifications.DrawNotification

diplomacy.daide.notifications.FRM

alias of diplomacy.daide.notifications.MessageFromNotification

diplomacy.daide.notifications.SLO

alias of diplomacy.daide.notifications.SoloNotification

diplomacy.daide.notifications.SMR

alias of diplomacy.daide.notifications.SummaryNotification

diplomacy.daide.notifications.OFF

alias of diplomacy.daide.notifications.TurnOffNotification