Skip to content

Instantly share code, notes, and snippets.

@cwlucas41
Last active December 6, 2020 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwlucas41/2b1932c829ce6f8ac1f94787cdbfeb61 to your computer and use it in GitHub Desktop.
Save cwlucas41/2b1932c829ce6f8ac1f94787cdbfeb61 to your computer and use it in GitHub Desktop.
from __future__ import division
from itertools import permutations
powers=[1, 2, 3, 4, 5]
for power_perm in list(permutations(powers)):
elec = power_perm[0]
dupl = power_perm[1]
mstr = power_perm[2]
gaze = power_perm[3]
fire = power_perm[4]
def two_of_dupl_spades(total):
return total + 2**dupl
def two_of_mstr_hearts(total):
return total / 2**mstr
def three_of_elec_hearts(total):
return total / 3**elec
def four_of_elec_clubs(total):
return total * 4**elec
def four_of_fire_diamonds(total):
return total - 4**fire
hand=[
two_of_dupl_spades,
two_of_mstr_hearts,
three_of_elec_hearts,
four_of_elec_clubs,
four_of_fire_diamonds
]
for play_order in list(permutations(hand)):
r0 = ((2**fire - 4**dupl) * 5**fire / 5**dupl)
r1 = play_order[0](((3**gaze + 3**fire) / 5**dupl))
r2 = play_order[1](((3**mstr - 5**elec) * 2**fire))
r3 = play_order[2](((5**fire - 4**mstr) + 5**mstr))
r4 = play_order[3](((2**gaze / 4**dupl) * 4**gaze))
r5 = play_order[4](((2**elec - 3**dupl) * 5**gaze))
if (
r0 == 100 and
r1 == 6 and
r2 == 28 and
r3 == 496 and
r4 == 8128 and
r5 == 50000
):
print("Power Values")
print('elec: {}'.format(elec))
print('dupl: {}'.format(dupl))
print('mstr: {}'.format(mstr))
print('gaze: {}'.format(gaze))
print('fire: {}'.format(fire))
print("")
print("Play Order")
for card in [f.__name__ for f in play_order]:
print(card)
@cwlucas41
Copy link
Author

https://darocaro.github.io/puzzles/mathismath/mathismath

Result:

Power Values
elec: 2
dupl: 1
mstr: 4
gaze: 5
fire: 3

Play Order
three_of_elec_hearts
two_of_mstr_hearts
two_of_dupl_spades
four_of_fire_diamonds
four_of_elec_clubs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment