Last active
December 18, 2021 20:57
-
-
Save GabrielFreeze/7caed11cdca94b20b019974b013a7322 to your computer and use it in GitHub Desktop.
# This is an obfuscation of a function which either returns the summed manhattan distance of a 3x3 sliding puzzle game to it's goal state or just counts the number of misplaced tiles.
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
heuristic = lambda g,x=1:sum(x*(abs(i%3-((not t)*(((t-1)%(1<<3))+1)+(not not t)*(t-1))%3)+abs(i//3-([8,0,1,2,3,4,5,6,7][t])//3))+(not(x|((not t)*(((t-1)%8)+1)+(t&(not not ord("Gabriel_Freeze"[2+0+2+1])))*(t-1))-i)) for i,t in enumerate(g) if t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment