This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game = [["x","x", "o"],["x", "o", "x"], ["x", "o", "x"]] | |
def game_winner?(game, player_sign) | |
result = get_winning_sign(game) | |
if result.nil? | |
return game.flatten.include?(nil) ? "Game in Progress" : "Draw" | |
else | |
return result == player_sign ? "Player #{player_sign} is the winner" : "Player #{player_sign} is the loser" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["es2015", "react", "babel-preset-stage-0"] | |
} |