Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 1d39354

Browse files
committed
combine loops into one
1 parent 1885386 commit 1d39354

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tic-tac-toe/tic_tac_toe.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ def best_move_for(player)
1515
if square_unoccupied?(square)
1616
move = square if winning_move?(square, player)
1717
end
18-
end
1918

20-
SQUARES_ON_BOARD.each do |square|
2119
if square_unoccupied?(square)
2220
move = square if move == NO_MOVE
2321
end
2422
end
23+
2524
return move
2625
end
2726

0 commit comments

Comments
 (0)