Is the token in the below and attached code serving as a secondary means
to ensure all values are the same? Meaning, it doesn’t matter what the
values are,
as long as they are all the same? If not, what is it’s purpose and how
would I do what I described?
Sorry, I’m very new to this and this is (a portion) of the first piece
I’ve ever written. Thank you!!
–
def player_winner?(box, token)
if box[‘1’] == token and box[‘2’] == token and box[‘3’] == token
return true
elsif box[‘4’] == token and box[‘5’] == token and box[‘6’] == token
return true
elsif box[‘7’] == token and box[‘8’] == token and box[‘9’] == token
return true
elsif box[‘1’] == token and box[‘4’] == token and box[‘7’] == token
return true
elsif box[‘2’] == token and box[‘5’] == token and box[‘8’] == token
return true
elsif box[‘3’] == token and box[‘6’] == token and box[‘9’] == token
return true
elsif box[‘1’] == token and box[‘5’] == token and box[‘9’] == token
return true
elsif box[‘3’] == token and box[‘5’] == token and box[‘7’] == token
return true
end
end