当前位置: 首页>>代码示例>>Python>>正文


Python Player.getProbabilityMove方法代码示例

本文整理汇总了Python中Player.getProbabilityMove方法的典型用法代码示例。如果您正苦于以下问题:Python Player.getProbabilityMove方法的具体用法?Python Player.getProbabilityMove怎么用?Python Player.getProbabilityMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.getProbabilityMove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: callBS

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getProbabilityMove [as 别名]
	def callBS(self,hand,num_cards,curr_card,current_card_value,curr_player,numturns,player_trackers):

		#call bs if the cards they say they have plus
		#the number of cards we have of that same vaue
		#is greater than the total number fo that card
		num_cards_deck_match = 0
		num_cards_i_have = 0
		for c in hand.cards:
			if c.name == curr_card:	
				num_cards_i_have += 1
		# if matched in hand + matched in deck + number they claim > 4 call BS
		for c in range(1,14):
			if current_card_value == c:
				num_card_deck_match = player_trackers[self.name].known_cards_deck[c]
		if num_cards + num_cards_i_have + num_card_deck_match > 4*self.numDecks:
			return True
		num_cards_hand = player_trackers[curr_player].num_cards
		# if player plays last card call BS
		if num_cards_hand == 0:
			return True
		# if player caims mre than 4 cards call BS
		if num_cards > 4*self.numDecks:
			return True
		# else calculate probability player has what they claim
		prob_has_card = player_trackers[curr_player].probability_having_cards[current_card_value]
		if prob_has_card == 0.0:
			prob_has_card = Player.getProbabilityMove(num_cards, num_cards_hand, hand, current_card_value)

		#calculates the rate at which other players bluff
		numturns = floor(numturns * ((len(player_trackers) - 1) / len(player_trackers)))
		bs = 0
		for key in player_trackers.keys():
			if key != self.name:
				bs += player_trackers[key].number_BS
		if numturns != 0:
			percenBS = bs / numturns
		else:
			percenBS = 0
		
		#adjust alpha to be higher if bs rate is high, lower if low
		if percenBS < 0.2:
			adjust_alpha = (percenBS - 0.4) / 3.8
		else:
			adjust_alpha = 0
		if prob_has_card < self.alpha + adjust_alpha:
			return True
		else:
			return False
开发者ID:ernst183,项目名称:Cheat-AI,代码行数:50,代码来源:PlayerType.py


注:本文中的Player.getProbabilityMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。