• Impossible game output

Question related to mission Xs and Os Referee

 

One of tests is: ["OOO", "XX.", ".XX"] Witch is impossible in-game input, since in this case game wood finished one move before. Something like this:["OOO",".X.",".XX"]

So my cool algorithm, witch based on counting X and O does't work:

checkio(gr):
    r = gr[0]+gr[1]+gr[2]
    x = r.count("X")
    o = r.count("O")

    if x > o and x+o < 9:
        return "X"
    elif o == x:
        return "O"
    else:
        return "D"