Cleaned up and added some documentation. Also added a simple yet fun AI.