Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My own try at A*
#41
Quote:hm, you do have a point there, i didn't use opened / closed squares, mainly because i don't think i get something....
if you have a map like this:

Code:
0,0,0,0,0
0,1,1,1,0
0,2,0,1,3
0,1,1,1,0
0,0,0,0,0

what's to keep it from going right? :/

Nothing, and in fact, it probably will check that square. But if you are using Closed lists, it should look at that square, put it on the closed list, then never check it again. You don't look at closed squares. Make sense?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#42
ok, but once i put it on the closed list, how do i know which squares to check next? the next one on the open list? :???:
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#43
Well, sort of. You go through the Open list, and choose the square that has the lowest F score. But make sure it isn't on the closed list.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#44
Also note that no squares/nodes are on the open or closed lists in the beginning.
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)
Reply
#45
Yeah, look at my code, you'll see I have 2 arrays called OpenList and ClosedList. You add to them as you go, which is why I have a AddToOpen and AddToClosed sub. I don't bother with removing squares from them, I just double check. Like first I'll make sure it isn't on the closed list then I'll see if it is on the open list.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#46
Quote: i read the normal a* shouldn't be able to find its way through what i gave it without modification like i did...
For one, A* always finds a way, for complex mazes it will take up almost as much space as a huge deep brute force tree though.
For two, there is no normal A*. Every A* has its own weighting functions and determination of the f = g + h function.

I don't know where you read it, but a good A* always finds a way, and if it doesn't, you either are just short on system memory, or there is no way to the end position.
Reply
#47
TY neo :wink: .

Edit: So you really shouldn't need that "timevisited" function. But it still finds a way, and that's good.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#48
Oh, and I forgot to thank TheBlueKeyboard for the compliment. Ty.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#49
ok, thanks, i guess i'll try and implement open / closed lists, doesn't sound too hard...
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#50
Nope, sure isn't.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)