Altered the code to use arrays (also encapsulated some stuff in functions)
Merge pull request #1 from Void-Director/ai

Altered the code to use arrays (also encapsulated some stuff in function...