The following few lines of Python can be used to compute the maximum amount of victory points that can be obtained for a given amount of tablet, compass, gear and joker cards. It does this by recursively finding the best allocation for the purple joker cards.
#!/usr/bin/env
python
"""
compute max nr of points for science cards """
#type1
: gear
#type2
: tablet
#type3
: compass
def
get_score(type1,
type2, type3):
b
=
min([type1,
type2, type3]) *
7
#sets
return
a+b
def
max_points(type1=0,
type2=0,
type3=0,
joker=0):
if
joker==0:
return
get_score(type1, type2, type3)
else:
return
max([
max_points(type1+1,type2
, type3 , joker-1),
max_points(type1 ,type2+1,
type3 , joker-1),
max_points(type1 ,type2 , type3+1,
joker-1)
])
No comments:
Post a Comment