sorry if this is really basic! i'm in first year computer science.
i am trying to write a function to check if there is a win on a tictactoe board of NxN size (so i can't hardcode any values); the win has to be from the top left, to the bottom right.
i've already written a function for the upwards diagonal, so i'ved based it around that, but with a list like this: [ [ 'X' , ' ' ] , [ ' ' , ' ' ] ] the function returns True - which it definitely should not.
here's what i have right now, but i have tried many things:
#these can be anything but here's just an example of what i'm using to test
cur = [['X',' '],[' ',' ']]
player= 'X'
def check_down_diag(cur, player):
columncount = 0
for row in cur:
if row[columncount] != player:
columncount += 1
return False
else:
return True