Author Topic: .xpos and .ypos/depth  (Read 3049 times)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
.xpos and .ypos/depth
« on: November 18, 2006, 01:33:05 PM »
This only works for field sizes 5 and smaller.  Larger fields have x and y positions (much) largeer than 32000.  Seems broken to have sysvars which only work right for small fields.

I could change these to be a percentage across/down the field or for more granulatiry, a number from 1 to 10,000 representing the same thing or mod them by 1000 or get rid of them or something else....

Any ideas or opinions?
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
.xpos and .ypos/depth
« Reply #1 on: November 18, 2006, 03:37:35 PM »
The way I solved this in the C++ source was to divide the values by 120.  Thus xpos and ypos measure distance in robot lengths.

I can see good arguments for using a percentage though.  This would allow bots to easily find the corners of a sim quite easily.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
.xpos and .ypos/depth
« Reply #2 on: November 22, 2006, 08:49:58 AM »
I quite like the idea of percentages in one way but I have problems with changing the values at all from another perspective.

Right now it is possible to be extremely precise with xpos and ypos, as long as you stick to smaller sims. Take the ant bot colonies in which the workers come back to the same coordinates each time to deliver food to the queen.
Bots programmed in this way would become unable to function if they were placed into a really large sim as a percentage would represent slightly different precision of coordinates for different sim sizes. This may or may not cause problems depending on how precise the robots programming is in the first place.

My solution would simply be to change the variables that the bot uses for xpos and ypos to doubles. Then it wouldn't matter how big your sim went.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
.xpos and .ypos/depth
« Reply #3 on: November 22, 2006, 11:44:24 AM »
Quote from: PurpleYouko
My solution would simply be to change the variables that the bot uses for xpos and ypos to doubles. Then it wouldn't matter how big your sim went.
Internally the variables the program uses are Longs, so we are cool there.  But the problem of course is how to project these values into the integer-valued array that the DNA operates upon.  You know this of course, so what I beleve you are suggesting is to use additionaal memory locations to help when values exceed 32000 - an .xposbig and .yposbig such that a field position of (64001, 96005) would be represented as

.xpos 1
.ypos 5
.xposbig 2
.yposbig 3

This would not break existing bots that use .xpos and .ypos and would provide location precision for bots beyond (32000, 32000).

I'm okay with this.  I'd also be okay with variants such as .xposbig and .yposbig counting in bot widths as Nums suggests and .xpos and .ypos wrapping at 32000.  The exact x position of a bot would then be

.xposbig 120 mult .xpos 120 mod add

This latter suggestion has the advantage that .xposbig and .yposbig alone could be used for approximate position.
« Last Edit: November 22, 2006, 12:28:18 PM by EricL »
Many beers....

Offline Zinc Avenger

  • Bot Builder
  • **
  • Posts: 56
    • View Profile
.xpos and .ypos/depth
« Reply #4 on: November 24, 2006, 07:51:32 AM »
And it wouldn't break existing bots in small sims too. Always a plus point!

/me likes antbots