Fish With AI
Fish is an assignment I worked on for a 4th year Computer Science course at York University called Artificial Intelligence. It involves emulating a predator (big red fish) chasing prey (small green fish).
The predator starts by swimming around looking for the nearest fish to chase. Once it finds a target it will move towards the target using the shortest route possible. The prey will attempt to run away from any predator it sees by following the shortest route to an area that isn't visible to the predator. The program takes into account walls which block the sightlines between fish. None of the fish can swim through walls (grey), and only smaller fish can swim through the hatch filled walls.
I had fun with this project because it was one of the few times in Computer Science we were allowed to be a little creative. Although the professor already gave us the algorithm to use for the predators chasing prey, he let me come up with my own platform for emulating the fish. I decided to use DirectX and some graphics libraries I had created earlier for my personal work to make this a more interesting project, so that I had animated fish instead of just using plain text. Programming was done in C++.
Languages Used: C++, DirectX
Screenshots
Green fish escaping from the red fish. Part of the AI for the prey involved determining which half of the screen had fewer predators and having the prey gravite to that half. If you let this program keep running, the red fish will eventually eat everyone.
Fish will get eaten more quickly in this map, as there are fewer walls to hide behind.