Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Xs and Os Referee by PawlakBartosz43
def checkio(x):
i = 0
while(i < 3):
if(x[0][i] == 'X' and x[1][i] == 'X' and x[2][i] == 'X'):
return 'X'
if (x[0][i] == 'O' and x[1][i] == 'O' and x[2][i] == 'O'):
return 'O'
i += 1
i = 0
while (i < 3):
if (x[i][0] == 'X' and x[i][1] == 'X' and x[i][2] == 'X'):
return 'X'
if (x[i][0] == 'O' and x[i][1] == 'O' and x[i][2] == 'O'):
return 'O'
i += 1
if(x[0][0] == 'X' and x[1][1] == 'X' and x[2][2] == 'X'):
return 'X'
if (x[0][0] == 'O' and x[1][1] == 'O' and x[2][2] == 'O'):
return 'O'
if (x[2][0] == 'X' and x[1][1] == 'X' and x[0][2] == 'X'):
return 'X'
if (x[2][0] == 'O' and x[1][1] == 'O' and x[0][2] == 'O'):
return 'O'
return 'D'
Jan. 3, 2017