It is currently Fri May 24, 2013 9:40 pm Advanced search
zanirzrold wrote:First of all, you should be able to have a minimum of 100 diffusions a turn with no problem (I can do about ~300 although only do 200 to make sure I don't time out). If you're doing multiple maps for different scents, thats~20-30 diffusions per map. If you're not this efficient, figure out a better way to do it.
mac wrote:C'mon... the guy is asking for help, not for being bashed.
Lets say I have a 1d "world" and X means food and the numbers are the current food scent.
00X000
A simple example would be if i diffuse from 0 to n in the array. My world would look like the following at each step:
00X000
00X000
00X600
00X630
00X631
With a single pass through this world front to back everything to the right of the food will get a diffused food scent. After this diffusion any ant to the right would be able to find the food. On every turn I could reset the food diffused values back to 0 so only brand new food would be discovered by the ants. But for other things like enemy ants or areas to explore you might not want to reset it back to 0.
blue_iris wrote:<snip>
A simple example would be if i diffuse from 0 to n in the array. My world would look like the following at each step:
00X000
00X000
00X600
00X630
00X631
With a single pass through this world front to back everything to the right of the food will get a diffused food scent. After this diffusion any ant to the right would be able to find the food. On every turn I could reset the food diffused values back to 0 so only brand new food would be discovered by the ants. But for other things like enemy ants or areas to explore you might not want to reset it back to 0.
result = ((1 - myBool) * someConstant + myBool * someOtherConstant) * valueresult = (1 - myBool) * someConstant * value + myBool * someOtherConstant * valueprecalcAllFixedThings();
for (int i = 0; i < numDiffusionSteps; ++i)
{
newFieldValues = Grid(rows, cols); // All entries should be 0 after initialization.
for (int row = 0; row < rows; ++row)
{
for (int col = 0; col < cols; ++col)
{
newFieldValues(row, col) = oldFieldValues(row, col) + diffusionCoef * (sum(oldFieldValues(neighborSquares)) - 4 * oldFieldValues(row, col)
}
}
setFixedPotentialsToWhatTheyShouldBe();
}Darhuuk wrote:After: 82 diffusions/round, total time: 45-70 ms (=> can do +-600 diffusions per round in the worst case)
bluegaspode wrote:Just to get a better feeling:
what type of computer?
which language?
size of map?
how much of the map is visible (if this influences the calculations)?
Users browsing this forum: No registered users and 0 guests