Page 1 of 1

Whats the best way of "expressing" the position of

Posted: Wed Jun 06, 2007 9:17 am
by earlz
I am making a little robot AI complete with it's own brain instruction set. The isntruction set is very high level though, like there is a Forward command that moves the robot forward one.

But anyway..
What is the best way of expressing the position of something on a grid? like if I have one robot at 0,0 how could I make an instruction that lets the robot recognize a robot at 0,5?

The only two ways I can think of right now are a "Is robot left" and "Is robot right" or "Is robot infront" type thing..
and then there is just giving it the position of the nearest robot...which is where I have a problem..I kinda want the robots to be able to recognize individual robots, like tell robot A is different from robot B and whatnot..

I know no one will probably understand that..but anyone have any ideas on how to go about that?

Posted: Wed Jun 06, 2007 9:49 am
by mathematician
I suppose the first thing to do would be to put something in the structures/classes, which represent the robots, so that they can be distinguished one from another. Maybe the their "identities" could be assigned at startup time with the aid of a random number generator. If, somehow or other, their "personalities" could then be inferred from that randomly assigned number, you wouldn't know ahead of time how any of them would behave. (Using something like the date or time as the seed.)

Posted: Wed Jun 06, 2007 10:11 am
by earlz
I was going to use this pointer to the class as the unique identifier..I really do not know how to differentiate from there "personalities" as there brain is just randomly generated, and it's survival of the fittest..

I have thought of a hybrid system, like rather than using absolute positioning, use something like..I guess vector like...like if the robot A is at 5,10, and robot B is at 6,11, then it is at 1,1 relational to robot A and robot A is at -1,-1 relational to robot B
but basically using the relational system, be able to "find closest robto" and then get the unique identifier for that robot, and then use "where is" onthat identifier and find the relational coordinates..

I really want to do my best to avoid many maths implemented in the construction set though...one reason is because the brain size limit can be no more than 4k, and will probably actually be 1k

the limit is put there just because of how much execution time it should have..plus the amount of time to randomly generate it and execute it..(there will be about 50,000 robots at one time usually..)


edit:
I have come up with the idea of having a "virtual" display that is 1-D basically, loaded in extended memory, an array of bytes is there that expresses how the robot would see htings right in front of it...that way it can kind of "see" Then it can get how far away an object is by querying it or somethign..

Posted: Wed Jun 06, 2007 7:26 pm
by Kevin McGuire
All sensory input is input even if it is visual, taste, smell, or feeling. The key might be (if you are randomly generated their brains) to give them a standard interface to one or more sensory devices.

Through evolution or pure chance (random generation alone) you can expect that one will happen to start using the interface correctly. Even though it has no conscious thought about what it is doing.

A example of a interface might be using some of the robot's brain memory to map a interface too. Such that the vision sensor array might be located at 0x0 to 0x7. Where it sees squares above, behind, left, right, and the diagonal squares.

If the algorithmic and logical representation potential is high enough using this language you have that is interpreted -- and randomly generating the brain of each robot -- while never repeating a sequence (as will happen when using rand() with the Std. C Library) -- then at some point the robot should form the necessary logic to actually interpret objects and act accordingly.

If you split the brain regions you might be able to treat each region as a gene and during the fostering of a child robot you can simply have certain sex A dominate genes and vice-versa for sex B to model evolution similar to ours. You might be thinking, "That will never work...". I mean it would just mix the brains, right? No And Yes. Hopefully you will start having generated brain sequences that are capable of mating, and are capable of passing genes to the offspring that do not leave you with a mentally challenged robot -- although the parents operated at a optimal level. On the no part I mean that a brain will need to be generated that is capable of holding a structure that supports this evolution using genes like model. If done incorrectly via using too small of divisions of the brain for genes you could in turn just end up scrambling the brains and never producing anything interesting, because the algorithmic and logical total potential has a proportional relationship to the size of the chunk that is set to be a certain gene.

Where your language's algorithmic and logical potential is L, the size of the chunk is S, and T is the total. You get: LS=P.

The link below is a random number generated I wrote a few days ago and have not tested. I have been having rough work days and not messed with it. You might grasp my idea by looking at the code (which is short). Never the less I need it in a project and it is a very similar project.

Pseudo Random Non-Repeating Number Generator

Code: Select all

cPrNrNg MyNumberGenerator(ROBOT_BRAIN_BYTECOUNT);
uint8_t RobotBrainExample(ROBOT_BRAIN_BYTECOUNT);
// fill robot brain
for(uint32_t x = 0; x < ROBOT_BRAIN_BYTECOUNT; ++x)
{
	RobotBrainExample[x] = MyNumberGenerator.Next8();
}

// generate another sequence of pseudo random numbers
MyNumberGenerator.NextState();
The problem is you will never generate the same robot twice and the conditions in which you generate a potentially great robot might otherwise destroy this robot (just a bad situation in the world or such). But, you should generate more than one good robot so I figure the benefits out weight the risks possibly.

You might also have the realize that cycling through the entire sequence of a two-hundred-fifty byte sequence of numbers will take a very long time. So hopefully if done correctly with a little luck you might be able to generate a robot that does something interesting at the least and I think will do something really neat if done correctly.

A (not sure if it is the best) way to allow robot to recognize other robots is to represent them in the visual array as different values. You could deduce these values by taking a sample of the robot's brain. You might average all the values together to produce a single value then shift this to the right to allow room in each byte of the visual array for other objects such as a wall, food, or anything else.

And if you guys want to search this up on Google -- I am sorry, but I have never found it myself.

Posted: Wed Jun 06, 2007 8:15 pm
by earlz
hmmm..well the problem is I have with that kind of ID system is the way my video display works...I just use 8bit colors as I don't really need much(btw, I will make a system so that you can watch the robots doing stuff)
the opcode set will be byte based also, if possible I'd like to use 8bit internal registers, though that seems less and less likely..

attached is some bits I've written for what the opcode set will include..

note that nibble system won't be kept..



btw, why isn't PDF allowed to be uploaded?....or html...or rtf....this is just getting rediculus...


edit:
I had rather have an "imperfect" random number generator...
how would I make a random brain using rand() though? I looked at it and the RAND_MAX just doesn't make complete since to me...

Posted: Wed Jun 06, 2007 9:06 pm
by AndrewAPrice
How about getting a list of robots in view, each with a structure (their x pos, y pos, ID, colour).

Posted: Wed Jun 06, 2007 9:30 pm
by earlz
The colors are kind of meant to be reserved. Like red being a robot attacking, green just be normal robot, white just being blank space, black being dead robot(which a robot can eat) and blue being a robot mating or something..

but anyway..