-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c67c0f
commit 5012532
Showing
3 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import itertools | ||
from src.card_decoder.decoder import CardDecoder | ||
|
||
# itertools.combinations(iterable, count) | ||
|
||
def make_card(runes_to_buy, honor_from_runes, power_to_defeat, honor_from_power): | ||
return (float(runes_to_buy), \ | ||
float(honor_from_runes), \ | ||
float(power_to_defeat), \ | ||
float(honor_from_power)) | ||
|
||
def get_monsters(): | ||
mephits = [(0, 0, 3, 2)] * 3 | ||
tormented_souls = [(0, 0, 3, 1)] * 3 | ||
tricksters = [(0, 0, 3, 1)] * 4 | ||
|
||
mistakes = [(0, 0, 4, 4)] * 4 | ||
widows = [(0, 0, 4, 3)] * 4 | ||
|
||
sea_tyrants = [(0, 0, 5, 5)] * 3 | ||
wind_tyrants = [(0, 0, 5, 3)] * 3 | ||
|
||
earth_tyrants = [(0, 0, 6, 5)] * 2 | ||
xerons = [(0, 0, 6, 3)] | ||
|
||
avatars = [(0, 0, 7, 4)] | ||
|
||
monsters = mephits + \ | ||
tormented_souls + \ | ||
tricksters + \ | ||
mistakes + \ | ||
widows + \ | ||
sea_tyrants + \ | ||
wind_tyrants + \ | ||
earth_tyrants + \ | ||
xerons + \ | ||
avatars | ||
|
||
return monsters | ||
|
||
def get_acquirables(): | ||
acquirables = CardDecoder()._decode_acquirables() | ||
return [make_card(c.cost, c.honor, 0, 0) for c in acquirables] | ||
|
||
### | ||
# Output: | ||
# ************************************************** | ||
# Expected center: | ||
# | ||
# expected runes to buy: 14.143 | ||
# expected honor from runes: 8.486 | ||
# expected honor / rune: 0.600 | ||
# | ||
# expected power to defeat: 10.029 | ||
# expected honor from power: 7.029 | ||
# expected honor / power: 0.701 | ||
# | ||
### | ||
def calculate_expected_center(center_cards): | ||
total_combinations = 0 | ||
total_runes_to_buy = 0.0 | ||
total_honor_from_runes = 0.0 | ||
total_power_to_defeat = 0.0 | ||
total_honor_from_power = 0.0 | ||
|
||
center_size = 6 | ||
|
||
for card in center_cards: | ||
runes_to_buy, honor_from_runes, power_to_defeat, honor_from_power = card | ||
total_combinations += 1 | ||
total_runes_to_buy += runes_to_buy | ||
total_honor_from_runes += honor_from_runes | ||
total_power_to_defeat += power_to_defeat | ||
total_honor_from_power += honor_from_power | ||
|
||
expected_runes_to_buy = total_runes_to_buy / total_combinations * center_size | ||
expected_honor_from_runes = total_honor_from_runes / total_combinations * center_size | ||
expected_power_to_defeat = total_power_to_defeat / total_combinations * center_size | ||
expected_honor_from_power = total_honor_from_power / total_combinations * center_size | ||
|
||
expected_honor_per_rune = expected_honor_from_runes / expected_runes_to_buy | ||
expected_honor_per_power = expected_honor_from_power / expected_power_to_defeat | ||
|
||
print "**************************************************" | ||
print "Expected center:" | ||
print "" | ||
print " expected runes to buy: %.03f" % expected_runes_to_buy | ||
print " expected honor from runes: %.03f" % expected_honor_from_runes | ||
print " expected honor / rune: %.03f" % expected_honor_per_rune | ||
print "" | ||
print " expected power to defeat: %.03f" % expected_power_to_defeat | ||
print " expected honor from power: %.03f" % expected_honor_from_power | ||
print " expected honor / power: %.03f" % expected_honor_per_power | ||
print "" | ||
|
||
def main(): | ||
cards = [] | ||
acquirables = get_acquirables() | ||
monsters = get_monsters() | ||
cards.extend(acquirables) | ||
cards.extend(monsters) | ||
|
||
calculate_expected_center(cards) | ||
|
||
if __name__ == "__main__": | ||
main() |