This was an AI prototype I made using a finite state machine. The base was later used for the Bean wars Project. I made it in first half of my second year. You can find the Project on Github together with all the code. There is a diagram of the finite state machine and code for the AI brain and a few code snippets below.
Here is a code snippet of the finite state machine in the Brain script.
Here is a code snippet of the pursue behaviour script