Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
selimanac committed Aug 1, 2020
1 parent 14ba4e5 commit a4840ea
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main/main.collection
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ embedded_instances {
id: "go"
data: "components {\n"
" id: \"test\"\n"
" component: \"/main/path_test.script\"\n"
" component: \"/main/near_test.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
Expand Down
33 changes: 32 additions & 1 deletion main/near_test.script
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ local function result(near_size, near_result, nears)
end

function init(self)


astar.reset()
astar.reset_cache()

-- ***************************** --
-- * Initial reset empty cache * --
-- ***************************** --
Expand All @@ -147,6 +150,18 @@ function init(self)
result(near_size, near_result, nears)


-- ***************************** --
-- * Without Reset cache * --
-- ***************************** --
print("--------------------------")

-- Same w-h. No need to astar.setup.
-- It is closed. Should return NO_SOLUTION
astar.set_map(world2)
local near_result, near_size, nears = astar.solve_near(start_x, start_y, 1.5)
result(near_size, near_result, nears)



-- ***************************** --
-- * Reset cache * --
Expand Down Expand Up @@ -194,4 +209,20 @@ function init(self)
astar.set_costs(costs)
local near_result, near_size, nears = astar.solve_near(5, 5, 1.5)
result(near_size, near_result, nears)


-- ***************************** --
-- * Without Reset cache * --
-- ***************************** --
print("--------------------------")

map_width = 5
map_height = 5
allocate = map_width * map_height
astar.setup(map_width, map_height, direction, allocate, typical_adjacent, cache)
astar.set_map(world)
astar.set_costs(costs)

local near_result, near_size, nears = astar.solve_near(start_x, start_y, 1.5)
result(near_size, near_result, nears)
end

0 comments on commit a4840ea

Please sign in to comment.