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


Python Type.weaknesses方法代码示例

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


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

示例1: verify

# 需要导入模块: import Type [as 别名]
# 或者: from Type import weaknesses [as 别名]
	def verify(p1t1, p1t2, p2t1, p2t2):
		first = [t in Type.resistances(p2t1, p2t2) for t in Type.weaknesses(p1t1, p1t2)]
		second = [t in Type.resistances(p1t1, p1t2) for t in Type.weaknesses(p2t1, p2t2)]
		return all(first) and all(second)
开发者ID:kgilbert-cmu,项目名称:PokemonTypes,代码行数:6,代码来源:stallmates.py

示例2: set

# 需要导入模块: import Type [as 别名]
# 或者: from Type import weaknesses [as 别名]
stallmates = set()

# i = 0
for pokemon1_t1 in Type.types:
	for pokemon1_t2 in Type.types:
		for pokemon2_t1 in Type.types:
			for pokemon2_t2 in Type.types:
				# sys.stdout.write("\r" + str(i))
				poke1 = frozenset([pokemon1_t1, pokemon1_t2])
				poke2 = frozenset([pokemon2_t1, pokemon2_t2])
				pair = frozenset([poke1,poke2])
				if pair in stallmates:
					continue
				first = [t in Type.resistances(pokemon2_t1, pokemon2_t2) for \
				         t in Type.weaknesses(pokemon1_t1, pokemon1_t2)]
				second = [t in Type.resistances(pokemon1_t1, pokemon1_t2) for \
					      t in Type.weaknesses(pokemon2_t1, pokemon2_t2)]
				if all(first) and all(second):
					# print "Found pair!"
					stallmates.add(pair)
				# i = i + 1
# sys.stdout.write("\n")

for [typing1, typing2] in stallmates:
	try:
		[p1_t1, p1_t2] = typing1
	except:
		p1_t2 = None
	try:
		[p2_t1, p2_t2] = typing2
开发者ID:kgilbert-cmu,项目名称:PokemonTypes,代码行数:32,代码来源:stallmates.py


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