Skip to content

Instantly share code, notes, and snippets.

@Ceasar Ceasar/eredan_arean.py
Last active Feb 12, 2018

Embed
What would you like to do?
Computes how an attack will go for some heroes in Eredan Arena.
"""
http://www.kongregate.com/games/feerik/eredan-arena
"""
import itertools
die = ['R', 'R', 'B', 'Y', 'S', 'S']
sides = set(die)
def count(combo):
return {side: combo.count(side) for side in sides}
class Attack(object):
def __init__(self, combo):
self.hit = 0
self.shield = 0
self.strength = 0
self._counts = count(combo)
def attack1(self):
pass
def attack2(self):
pass
def strength_attack(self):
self.hit += self.strength
def execute(self):
self.attack1()
self.attack2()
for _ in range(self._counts['S']):
self.strength_attack()
return self.hit, self.shield
class Faceless(Attack):
"""
Try to get at least two blues. The rest don't matter too much.
(2160, 0) BBBSSS
(2160, 0) BBBRSS
(2160, 0) BBBRRS
(2160, 0) BBBRRR
(1920, 0) BBSSSS
"""
def attack1(self):
attack1 = min(self._counts['R'], self._counts['Y'])
for _ in range(attack1):
self.hit += 420
self.shield += 210
def attack2(self):
for _ in range(self._counts['B']):
self.strength += 240
if self._counts['R'] > 0:
self._counts['R'] -= 1
self._counts['S'] += 1
# (1170, 0) {'Y': 0, 'R': 3, 'B': 0, 'S': 3}
class Enguerrand(Attack):
def __init__(self, combo):
super(type(self), self).__init__(combo)
self.strength = 90
def attack1(self):
for _ in range(self._counts['R']):
self.hit += 120
self.strength += 60
class GanSo(Attack):
"""
Try to get YR and then silvers.
(1820, 0) YYRRSS
(1800, 0) RRRRRR
(1740, 0) YRSSSS
(1680, 0) YRRSSS
(1620, 0) YRRRSS
"""
def __init__(self, combo):
super(type(self), self).__init__(combo)
self.strength = 110
def attack1(self):
for _ in range(self._counts['R']):
self.hit += 300
def attack2(self):
for _ in range(min(self._counts['R'], self._counts['Y'])):
self.hit += 250 * self._counts['S']
class Souchi(Attack):
"""
Try to get YY, rest doesn't matter too much.
(2460, 0) YYYRRR
(2300, 0) YYRRSS
(2240, 0) YYRRRS
(2180, 0) YYRRRR
(2020, 0) YRRRSS
"""
def __init__(self, combo):
super(type(self), self).__init__(combo)
self.strength = 110
self._powder = 0
def attack1(self):
for _ in range(min(self._counts['R'], self._counts['Y'])):
self.hit += 550
def attack2(self):
for _ in range(self._counts['R']):
self.hit += 270
self._powder += 1
def strength_attack(self):
if self._powder > 0:
self._powder -= 1
self.hit += self.strength * 3
else:
super(type(self), self).strength_attack()
def gen_combos():
return itertools.combinations_with_replacement(sides, 6)
def print_stats(Attack):
attacks = ((Attack(combo).execute(), combo) for combo in gen_combos())
for (stats, combo) in sorted(attacks, reverse=True):
print stats, ''.join(combo)
print_stats(Faceless)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.