Quote:Original post by xEricx
Quote:Original post by Anonymous Poster
Quote:Original post by xEricx You DO use a 2D array for your world representation, but the robots do not need to know about it. |
It depends on his simulation. If it's discrete tile based, than the array matters.
If it's a continous based, than it doesn't matter, you just use physics and vector math. |
I was replying to
"How do I keep track of the robots in the "world" without using a 2D array?"
The world owns an array but does not need to make it public. I know it matters for the bot to know if he's using discrete tiles or not, that's not what I was commenting about. |
I still do not understand how to have the "Robot see the world" versus having to hand the entire world to the Robot so it can look at it.
I guess what I mean is this:
Although I have not BEEN to every country in the world, nor have I seen the world from outer space...other people have and have written about it and / or taken pictures that I can look at.
In essence...the world has been handed to me. I have a good idea about how big it is. I may never be able to travel around the globe, but that is a restriction of many things outside of my control (MONEY, time, hassle, wife, kids, work, etc.).
On the other hand...if I were in the middle of a city and had total memory loss...but I could still walk, communicate and make some basic decisions and had unlimited time, money, etc., I could start walking and come to the edge of the city. Then I could travel through the countryside. Eventually I would get to the ocean...and be sort of stuck...unless I decided to try and swim across or build a boat. I could discover the same world that the other me already knows about but will never travel to.
In one situation I know about the world in advance. I can trust Africa is real without ever going there.
In the other I do not know about the world but can still navigate through it. In time I can know everything the other "me" knows...by brute force.
Given enough time I would catch up to the omniscient version.
I want to get away from doing it this way (HANDING THE WORLD TO THE ROBOT):
public void LookAround(World temp_world)
{
N = temp_world.WhoIsAt(_row - 1, _col);
NE = temp_world.WhoIsAt(_row - 1, _col + 1);
E = temp_world.WhoIsAt(_row, _col + 1);
SE = temp_world.WhoIsAt(_row + 1, _col + 1);
S = temp_world.WhoIsAt(_row + 1, _col);
SW = temp_world.WhoIsAt(_row + 1, _col - 1);
W = temp_world.WhoIsAt(_row, _col - 1);
NW = temp_world.WhoIsAt(_row - 1,_col - 1);
}
WhoIsAt looks like this:
public string WhoIsAt(int temp_row, int temp_col)
{
string def_action = "wall";
if(temp_row < _MIN_ROW)
{
return def_action;
}
else if(temp_row > _MAX_ROW)
{
return def_action;
}
else if(temp_col < _MIN_COL)
{
return def_action;
}
else if(temp_col > _MAX_COL)
{
return def_action;
}
else
{
return obj[temp_row,temp_col].Kind;
}
}
[Edited by - Tom Knowlton on December 9, 2005 3:09:58 PM]