Modified to return scores instead of returing maximum score.
Added max_direction internal function.
Modified to return direction expected to gain highest score.