本文整理汇总了Python中Type.resistances方法的典型用法代码示例。如果您正苦于以下问题:Python Type.resistances方法的具体用法?Python Type.resistances怎么用?Python Type.resistances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type.resistances方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify
# 需要导入模块: import Type [as 别名]
# 或者: from Type import resistances [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)
示例2: set
# 需要导入模块: import Type [as 别名]
# 或者: from Type import resistances [as 别名]
import sys
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: