deleted h(x) and changed cost

This commit is contained in:
Jonas Mucke
2020-04-20 14:41:29 +02:00
parent d60f93db3e
commit e2f50060db

View File

@@ -103,17 +103,18 @@ func getCost(field):
for i in grid.object_grid[field.x][field.y]: for i in grid.object_grid[field.x][field.y]:
match i: match i:
Grid.Kind.DAMAGE: Grid.Kind.DAMAGE:
cost += 100 cost += 15
Grid.Kind.SLOW: Grid.Kind.SLOW:
cost += 1 cost += 4
return cost return cost
#return an heurestic of distance #return an heurestic of distance
# curr - current position # curr - current position
# targ - a target position # targ - a target position
func h_fn(curr, target): func h_fn(curr, target):
return 0
var h = min(target[0]-curr[0],target[1]-curr[1]) var h = min(target[0]-curr[0],target[1]-curr[1])
return 0 return h
# currCost - currentCost # currCost - currentCost
# target - position of the field to move to # target - position of the field to move to