updates core game logic for a much smarter AI and includes corresponding tests and additional code cleanup