-
-
Save anthonymorast/f3e6e3e221e44e01be20902aa794c727 to your computer and use it in GitHub Desktop.
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
def get_value(square): # determine the value for the LS -> number mapping | |
tot = 0 | |
s = 0 | |
col = 1 | |
row = 1 | |
for i in square: | |
if i == '\n': | |
continue | |
col += 1 | |
s += (int(i) + 1)**(col + row) | |
if col == (order + 1): | |
col = 1 | |
row += 1 | |
tot += np.log(s) | |
s = 0 | |
return square, tot | |
def build_dict(results): # build a dictionary of LS -> number for each result previously generated | |
totals = {} | |
for result in results: | |
sq, tot = result | |
if tot not in totals.values(): | |
totals[sq] = tot | |
else: | |
other = None | |
for t in totals: | |
if totals[t] == tot: | |
other = t | |
break | |
print(f"\t{tot}\n\t{sq}\n\t{other}\n\t{totals[other]}") | |
return totals |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment