object-oriented programming higher (hor lower ( ) rightthat' in row tic-tac-toe example in this section we create an object-oriented tic-tac-toe game we use class to wrap up the logic of the game the class contains two variablesan integer representing the current playerand list representing the board the board variable consists of zerosonesand twos zeros represent an open spotwhile ones and twos represent spots marked by players and respectively there are four methodsget_open_spots -returns list of the places on the board that have not yet been marked by players is_valid_move -takes row and column representing potential moveand returns true if move is allowed and false otherwise make_move -takes row and column representing potential movecalls is_valid_move to see if the move is okayand if it issets the board array accordingly and changes the player check_for_winner -scans through the board list and returns if player has won if player has won if there are no moves remaining and no winnerand - if the game should continue here is the code for the classclass tic_tac_toedef __init__(self)self [[ , , ][ , , ][ , , ]self player def get_open_spots(self)return [[ ,cfor in range( for in range( if self [ ][ ]== def is_valid_move(self, , )if <= <= and <= <= and self [ ][ ]== return true return false def make_move(self, , )if self is_valid_move( , )self [ ][cself player self player (self player+ )% def check_for_winner(self)