Further refactor smart_player AI logic.