refactored optimal_move logic that find first blank position into separate method