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


Replace winning_player with winning_row
Browse files Browse the repository at this point in the history
  • Loading branch information
edgenard committed Apr 3, 2018
1 parent 64d02e5 commit dc8849e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tic-tac-toe/tic_tac_toe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def winning_move?(square, player)

def winner
first_position_in_rows = [0, 3, 6]
first_position_in_rows.each { |position| return mark_at(position) if winning_player(position) }
first_position_in_rows.each { |position| return mark_at(position) if winning_row(position) }
return '-'

def winning_player(position)
def winning_row(position)

This comment has been minimized.

Copy link

medwards1771 Apr 3, 2018


That's nice. I like this change because it replaces the concept of a winning PERSON (player) with a winning COMBINATION (row of Xs or Os)

position_occupied?(position) &&
mark_at(position) == mark_at( &&
mark_at( == mark_at(
Expand Down

0 comments on commit dc8849e

Please sign in to comment.