Skip to content

Instantly share code, notes, and snippets.

@anthonymorast
Created January 8, 2022 05:17
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 anthonymorast/f3e6e3e221e44e01be20902aa794c727 to your computer and use it in GitHub Desktop.
Save anthonymorast/f3e6e3e221e44e01be20902aa794c727 to your computer and use it in GitHub Desktop.
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