source: geniuswebcore/geniusweb/inform/Voting.py@ 81

Last change on this file since 81 was 81, checked in by Bart Vastenhouw, 2 years ago

Added python timedependent parties (conceder, hardliner, etc)

File size: 1.2 KB
Line 
1from typing import Dict, List
2
3from geniusweb.actions.Offer import Offer
4from geniusweb.actions.PartyId import PartyId
5from geniusweb.inform.Inform import Inform
6
7
8class Voting (Inform):
9 '''
10 Informs a party that it's time to do voting.
11 '''
12 def __init__(self, offers:List[Offer] , powers:Dict[PartyId,int] ):
13 self._offers = offers
14 self._powers = powers
15
16 def getOffers(self) -> List[Offer] :
17 '''
18 @return list of bids to be voted on
19 '''
20 return list(self._offers);
21
22 def getPowers(self) -> Dict[PartyId, int]:
23 '''
24 @return map with the power of each party in the negotiation. This map may
25 contain parties that are already finished, eg they reached an
26 agreement or walked away.
27 '''
28 return dict(self._powers)
29
30 def __eq__(self, other):
31 return isinstance(other, self.__class__) and \
32 self._offers==other._offers and self._powers==other._powers
33
34 def __hash__(self):
35 return hash((tuple(self._offers), tuple(self._powers.items())))
36
37 def __repr__(self)->str :
38 return "Voting[" + str(self._offers) + "," + str(self._powers) + "]";
39
Note: See TracBrowser for help on using the repository browser.