C# port of the code from 'Programming Game AI by Example' book by Mat Buckland