Saturday, 30 March 2013

Elephant Algorithm: They Never Forget


At the moment the elephant memories are represented by a 2 dimensional array but I was actually thinking I might put different types of geographical locations in other that just the oasis, and use a 3 dimensional array for the elephant memories. The 3rd index being a 'tag' to distinguish between the type of location. This might end up as polish though as I want all the basics in by the end of this weekend so I can start on the crowd  algorithm.

Elephants can now store information on where the oasis' are located. This is done by calling a remember function on collision, which stores the current x and y position. An elephant will continue to store coordinates as long as there is collision. The result is the storage of not only the geographical location but also its partial coverage (the area in which the elephant travelled). Originally only one coordinate was going to be stored but this way has given the memories more depth and given the algorithm more functionality, without increasing the complexity. I'm very pleased with how this has worked out even though it isn't as planned. However it is currently using arrays 3600 in size, eventually this should be changed to a vector to increase efficiency.  

I would also rather the arrays size was set on the fly at run time based on the number of various locations, which would be randomly placed and in randomly set quantities. Probably with a limit to the amount of locations present based on the screen resolution. The amount of elephants could be generated at run time too. It's likely that these features won't be in the build I hand in in May but I have enjoyed working on this project and so I will carry on working on next semester.

No comments:

Post a Comment