forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

shortest path

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Sat Sep 10, 2005 4:45 am    Post subject: shortest path Reply with quote

sorry to ask this here cause its not really luaplayer-specific...
BUT
what i am trying to do, is find the shortest way though an array from enemy to player (simple Ai)

got it working in java...
tried to convert it to lua, but i get errors all over

would be great if someone is willed to help me
(i publish the source for sure afterwards)

sample of what i try:
Code:
Map= {
   {8,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1},
   {0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},
   {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}
}

thats my map,
enemy (Ai) = 9 (pos 17/17)
player = 8 (pos 1/1)

enemy has to walk from 17/17 to 1/1 with the shortest way

the java-code solves the problem just fine (2 classes)

code can be viewed/downloaded here(bottom 3 files):
have a look here
Back to top
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Sep 10, 2005 7:21 am    Post subject: Re: shortest path Reply with quote

LuMo wrote:
sorry to ask this here cause its not really luaplayer-specific...


You are right, please ask this on http://www.lua.org/lua-l.html or irc://irc.freenode.net/lua , would be too much traffic at this forum, if every general Lua question is discussed.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group