Hi, I hope this is a reasonable question. I do not understand this script at all. It's from the wiki, and I just don't get it. I'm probably an Intermediate scripter, however I don't know things like what a "node" is, and how this script was set up and what exactly it does. I'm really interested in it, I've been studying it for a while and I'd like some help breaking this down just a little? Or at least lead me into a direction to where I can smoothly read this script? I don't understand things like neighbors, and some of the very foreign syntax. Thanks for the help if you can. The wiki article I was looking at is here:
http://wiki.roblox.com/index.php?title=Hunt-and-Kill
Here's the script from that article, if you need it:
function Hunt_and_Kill(node)
node.visited = true
--Take visited neighbors out of the possible selections
local neighbors = node:neighbors()
for i=#neighbors,1,-1 do
if neighbors[i].visited then
table.remove(neighbors,i)
end
end
--if there are unvisited neighbors of node, select a random one
if #neighbors>0 then
local new_node = neighbors[math.random(#neighbors)]
--delete the wall between the two nodes
deleteBetween(node,new_node)
--repeat process on new_node
Hunt_and_Kill(new_node)
--if there are no unvisited neighbors, begin hunt for new neighbor
else
for y = 1, bottom_of_maze do
for x = 1, end_of_maze do
--if the node has not been visited and is next to a visited neighbor, select
if not maze[x][y].visited then
local visitedNeighbor = false
for _, neighbor in pairs(maze[x][y]:neighbors()) do
if v.visted then
visitedNeighbor = neighbor
break
end
end
--if found, begin process over again
if visitedNeighbor then
Hunt_and_Kill(visitedNeighbor)
end
end
end
end
end
end
