X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=agents%2Fasmodeus%2Fpath.py;h=3a4527e333ed8e83b08e95b1240782519e0fd492;hp=3f08979e5e9faceee72a642039e8c4bd5c3072d3;hb=ac335e7c423d067effae82cc80db518f896271b9;hpb=7c42b4b7e5ed6e423f0c023ad6e8a2aa47a4f081 diff --git a/agents/asmodeus/path.py b/agents/asmodeus/path.py index 3f08979..3a4527e 100644 --- a/agents/asmodeus/path.py +++ b/agents/asmodeus/path.py @@ -32,7 +32,7 @@ class PathFinder: up = (start[0], start[1]-1) down = (start[0], start[1]+1) choices = [left, right, up, down] - choices.sort(key = lambda e : random.randint(0,5)) + choices.sort(key = lambda e : (e[0] - end[0])**2.0 + (e[1] - end[1])**2.0 ) options = [] for point in choices: option = [point, self.pathFind(point,end,board)]