Skip to content

Instantly share code, notes, and snippets.

@zamfi
Created June 21, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamfi/4e0c3af1bc2aa2c0532e to your computer and use it in GitHub Desktop.
Save zamfi/4e0c3af1bc2aa2c0532e to your computer and use it in GitHub Desktop.
def determine_winner(board):
""" board takes the form of a String
with the indices representing each
of these squares:
0 | 1 | 2
---+---+---
3 | 4 | 5
---+---+---
6 | 7 | 8
"""
return 'X'
def test_board_winner(board, winner):
if determine_winner(board) is winner:
print "SUCCESS"
else:
print "Expected", winner, "got", determine_winner(board)
test_board_winner("XXXOX OO ", "X")
test_board_winner(" ", None)
test_board_winner("XO XO OXX", "X")
test_board_winner(" XOXOXOXO ", "O")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment