本文整理汇总了Python中Action.Action类的典型用法代码示例。如果您正苦于以下问题:Python Action类的具体用法?Python Action怎么用?Python Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, nodeName, imageName, node, newText):
Action.__init__(self, node.documentOwner)
self.nodeName = nodeName
self.imageName = imageName
self.node = node
self.newText = newText
self.oldText = self.node.GetText()
示例2: makeMove
def makeMove(self):
possibleActions = []
# add possible PLAYs, DISCARDs
for cardPos in range(0, len(self.agentStates[self].getCards())):
possibleActions.append(Action.createPlayAction(self,cardPos))
possibleActions.append(Action.createDiscardAction(self,cardPos))
# add possible HINTs
if self.gameState.getHintsRemaining():
for key in self.agentStates:
# can't hint myself
if self is key:
continue
else:
objectAgent = key
colors = {}
numbers = {}
for cardPos in range(0, self.agentStates[key].getNumCards()):
card = self.agentStates[key].getCard(cardPos)
color = card.getColor()
if not color in colors:
colors[color] = []
colors[color].append(cardPos)
number = card.getNumber()
if not number in numbers:
numbers[number] = []
numbers[number].append(cardPos)
for key in colors:
possibleActions.append(Action.createHintAction(self,objectAgent,Hint.createColorHint(colors[key],key)))
for key in numbers:
possibleActions.append(Action.createHintAction(self,objectAgent,Hint.createNumberHint(numbers[key],key)))
move = random.choice(possibleActions)
return move
示例3: get_opening_bet_action
def get_opening_bet_action(self, request, game, hand_state):
"""Get Action in response to open bet request"""
self.display_hand_state(request, game, hand_state)
user_selection = self._newUserSelection()
user_selection.add_option("c", "check", Action.new_check())
user_selection.add_option("b", "bet", Action.new_bet(request.amount))
return user_selection.get_user_selection()
示例4: __init__
def __init__(self, **kwargs):
Action.__init__(self, **kwargs)
# Push Bullet settings -- set up in site.cfg, or override in local-site.cfg
self.access_token = kwargs.get('access_token', "XXX")
self.triggers = json.loads(kwargs.get('triggers',"[]"))
print "Got Triggers: ",self.triggers
self.start()
示例5: __init__
def __init__ (self, command, *matchers):
"""
Command: command to execute
matchers: string(s) to match
"""
self.matchers = []
for m in matchers:
self.matchers.append(m.lower())
Action.__init__(self, command)
示例6: __init__
def __init__(self, target, lookAt = None):
Action.__init__(self)
self.command = commands.Attack
self.target = target
self.params['description'] = 'Attack'
if lookAt is not None:
self.params['lookAt'] = lookAt
示例7: drawCard
def drawCard(agent, deck, gameState, agentStates):
card = deck.pop()
agentStates[agent].addCard(card)
gameState.cardMinus()
agent.observeEvent(GameEvent(Action.createDrawAction(agent), Card.blank()))
for key in agentStates:
if key is agent:
continue
key.observeEvent(GameEvent(Action.createDrawAction(agent), card))
if printer.verbose: print str(agent) + " draws " + str(card)
示例8: __init__
def __init__(self, **kwargs):
Action.__init__(self, **kwargs)
# settings for XBee radio connect -- set up in site.cfg, or override in local-site.cfg
self.port = kwargs.get('port', "/dev/tty.usbmodem1431")
self.baud = int(kwargs.get('baud', 9600))
self.start_mute = int(kwargs.get('start_mute', 0)) # HHMM
self.end_mute = int(kwargs.get('end_mute', 0)) # HHMM
self.start()
self.timezone = kwargs.get('timezone', 'America/Los_Angeles')
示例9: __init__
def __init__(self, target):
Action.__init__(self)
#Command
self.command = commands.Defend
#Facing direction
self.target = target
#Parametres supplementaires
self.params['description'] = 'Defend'
示例10: get_option_action
def get_option_action(self, request, game, hand_state):
"""Get Action in request to option request"""
self.display_hand_state(request, game, hand_state)
user_selection = self._newUserSelection()
user_selection.add_option("c",
"check",
Action.new_check())
user_selection.add_option("r",
"raise {}".format(request.raise_amount),
Action.new_raise(request.raise_amount))
return user_selection.get_user_selection()
示例11: addNewTask
def addNewTask(self,taskName):
#this creates a new topic with no inputs or outputs. As subtasks are put under it the number of inputs and outputs should increase
if taskName not in [x.name for x in self.tree]:
newTask=Action(taskName) #add this task with no inputs and outputs
newTask.inputs=[]
newTask.outputs=[]
self.tree.append(newTask)
self.currentSubtask=len(self.tree)-1 #change current task to this new task
return True
else:
return False
示例12: __init__
def __init__(self, **kwargs):
Action.__init__(self, **kwargs)
# clock settings -- set up in site.cfg, or override in local-site.cfg
self.ring_quarters = parse_bool(kwargs.get('ring_quarters', False))
self.xmas_mode = parse_bool(kwargs.get('xmas_mode', False))
self.timezone = kwargs.get('timezone', 'America/Los_Angeles')
self.chimes = json.loads(kwargs.get('chimes',"{}"))
self.xmas_hours = json.loads(kwargs.get('xmas_hours',"[]"))
print "Got chimes", self.chimes
print "Got xmas_hours", self.xmas_hours
self.start()
示例13: get_call_action
def get_call_action(self, request, game, hand_state):
"""Get Action in response to call request"""
self.display_hand_state(request, game, hand_state)
user_selection = self._newUserSelection()
user_selection.add_option("c",
"call {}".format(request.amount),
Action.new_call(request.amount))
user_selection.add_option("f", "fold", Action.new_fold())
if request.raise_amount != None:
user_selection.add_option(\
"r",
"raise to {}".format(request.raise_amount),
Action.new_raise(request.raise_amount))
return user_selection.get_user_selection()
示例14: build_action
def build_action(self, response):
i = 0; A = None
while i <response.size():
if response.get(i).asString() == "Action":
if A != None:
A.connect("abstract_signal", self.abstract_action)
self.bootstrap_action(A); A = None
A = Action()
A.name = response.get(i+1).asString()
i +=2; continue
else:
p = response.get(i).asString()
try:
ps = response.get(i+1).asDouble()
except:
try:
ps = response.get(i+1).asInt()
except:
ps = response.get(i+1).asString()
if type(ps)==type(str()) and ps[0] == "$":
A.props_var[p] = response.get(i+1).asString()
A.props[p] = None
else:
A.props[p] = ps; A.props_var[p] = None
i +=2; continue
A.connect("abstract_signal", self.abstract_action)
self.bootstrap_action(A)
示例15: blinds
def blinds(self, hand_state):
"""Handle blinds."""
# XXX What if # blinds < # players?
blinds = self.structure.get_blinds()
betting = hand_state.get_current_betting_round()
for blind in blinds:
player = betting.get_action_player()
if player.stack < blind:
action = Action.new_blind(player.stack,
all_in=True)
else:
action = Action.new_blind(blind)
betting.process_action(action)
self.report_action(player, action)