player ' mainloop(we have not added much to the program most of the new action happens in the callback function every time someone clicks on cellwe first check to see if it is empty (that the corresponding index in states is )and if it iswe display an or on the screen and record the new value in states many games have variable like states that keeps track of what is on the board checking for winner we have winner when there are three ' or three ' in roweither verticallyhorizontallyor diagonally to check if there are three in row across the top rowwe can use the following if statementif states[ ][ ]==states[ ][ ]==states[ ][ ]!= stop_game=true [ ][ configure(bg'grey ' [ ][ configure(bg'grey ' [ ][ configure(bg'grey 'this checks to see if each of the cells has the same nonzero entry we are using the shortcut from section here in the if statement there are more verbose if statements that would work if we do find winnerwe highlight the winning cells and then set global variable stop_game equal to true this variable will be used in the callback function whenever the variable is true we should not allow any moves to take place nextto check if there are three in row across the middle rowchange the first coordinate from to in all three referencesand to check if there are three in row across the bottomchange the ' to ' since we will have three very similar if statements that only differ in one locationa for loop can be used to keep the code shortfor in range( )if states[ ][ ]==states[ ][ ]==states[ ][ ]!= [ ][ configure(bg'grey ' [ ][ configure(bg'grey ' [ ][ configure(bg'grey 'stop_game true nextchecking for vertical winners is pretty much the same except we vary the second coordinate instead of the first finallywe have two further if statements to take care of the diagonals the full program is at the end of this we have also added few color options to the configure statements to make the game look little nicer further improvements from here it would be easy to add restart button the callback function for that variable should set stop_game back to falseit should set states back to all zeroesand it should configure all the buttons back to text='and bg='yellowto add computer player would also not be too difficultif you don' mind it being simple com