Object Oriented Programming – Ant simulation



For this project, we were allowed to buddy up with another student and work together as a team to complete what the brief had set out for us. We were tasked with creating an Ant Simulation that would allow the ants to pick up food and take it to a nest. The program would also have to allow the ants to communicate with each other and share the information they knew. This meant that if one ant knew where the nest was and another didn’t and they got within range of each other, they would both know where the nest is.

It took a while to get started on this one as it was our first project containing C#, and we were both unfamiliar with C#. After slogging through several “hacked” attempts at creating the simulation we managed to generate the ants and get them all moving.

From there it was easy to establish classes for the nest and food objects. Afterwards, it took some time to get the ants to behave the way we wanted them to in light of the new information they could gain.

Eventually, however, we were able to get the ants to move towards food and eventually back towards the nest after they got within range of it using simple case switches. We then implemented a range that the ants could communicate within, and the simulation contained a lot more motion, usually showing most of the ants moving at the same time.

A couple problems we ran into were not being able to have more than one FoodPile or Nest active at a time as well as buffering issues. We were unable to fix this in time for the hand in and so focused more on our evaluation and code mark up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s