
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.robotika.sk/robowiki/index.php?action=history&amp;feed=atom&amp;title=Tic_Tac_Toe_-_Code</id>
		<title>Tic Tac Toe - Code - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.robotika.sk/robowiki/index.php?action=history&amp;feed=atom&amp;title=Tic_Tac_Toe_-_Code"/>
		<link rel="alternate" type="text/html" href="https://wiki.robotika.sk/robowiki/index.php?title=Tic_Tac_Toe_-_Code&amp;action=history"/>
		<updated>2026-05-05T07:59:36Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.robotika.sk/robowiki/index.php?title=Tic_Tac_Toe_-_Code&amp;diff=10874&amp;oldid=prev</id>
		<title>Robot at 15:27, 4 June 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.robotika.sk/robowiki/index.php?title=Tic_Tac_Toe_-_Code&amp;diff=10874&amp;oldid=prev"/>
				<updated>2023-06-04T15:27:35Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:27, 4 June 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Return back to project page: [[Spike Prime - Tic Tac Toe - Fedor Agarshev|Tic Tac Toe - Fedor Agarshev]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Return back to project page: [[Spike Prime - Tic Tac Toe - Fedor Agarshev|Tic Tac Toe - Fedor Agarshev]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Python code for the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Spike Pong &lt;/del&gt;project:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Python code for the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Tic Tac Toe &lt;/ins&gt;project:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=python&amp;gt; &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=python&amp;gt; &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Robot</name></author>	</entry>

	<entry>
		<id>https://wiki.robotika.sk/robowiki/index.php?title=Tic_Tac_Toe_-_Code&amp;diff=10711&amp;oldid=prev</id>
		<title>Robot: Created page with &quot;Return back to project page: Tic Tac Toe - Fedor Agarshev  Python code for the Spike Pong project:  &lt;syntaxhighlight lang=python...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.robotika.sk/robowiki/index.php?title=Tic_Tac_Toe_-_Code&amp;diff=10711&amp;oldid=prev"/>
				<updated>2023-04-23T10:56:32Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Return back to project page: &lt;a href=&quot;/robowiki/index.php?title=Spike_Prime_-_Tic_Tac_Toe_-_Fedor_Agarshev&quot; title=&quot;Spike Prime - Tic Tac Toe - Fedor Agarshev&quot;&gt;Tic Tac Toe - Fedor Agarshev&lt;/a&gt;  Python code for the Spike Pong project:  &amp;lt;syntaxhighlight lang=python...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Return back to project page: [[Spike Prime - Tic Tac Toe - Fedor Agarshev|Tic Tac Toe - Fedor Agarshev]]&lt;br /&gt;
&lt;br /&gt;
Python code for the Spike Pong project:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=python&amp;gt; &lt;br /&gt;
from spike import PrimeHub, LightMatrix, Button, StatusLight, ForceSensor, MotionSensor, Speaker, ColorSensor, App, DistanceSensor, Motor, MotorPair&lt;br /&gt;
from spike.control import wait_for_seconds, wait_until, Timer&lt;br /&gt;
&lt;br /&gt;
hub = PrimeHub()&lt;br /&gt;
&lt;br /&gt;
hub.light_matrix.show_image('HAPPY')&lt;br /&gt;
wait_for_seconds(2)&lt;br /&gt;
&lt;br /&gt;
motor_up = Motor('F')&lt;br /&gt;
motor_down = Motor('B')&lt;br /&gt;
head_colorsensor = ColorSensor('D')&lt;br /&gt;
motor_up.set_default_speed(100)&lt;br /&gt;
motor_down.set_default_speed(10)&lt;br /&gt;
player = 0&lt;br /&gt;
robot = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class TikTakToeWithRobot:&lt;br /&gt;
    degree_for_move_one_line = 30&lt;br /&gt;
    degree_for_move_one_row1 = 250&lt;br /&gt;
    degree_for_move_one_row2 = 225&lt;br /&gt;
    whose_move = ''&lt;br /&gt;
    robot_chip_color = 'violet'&lt;br /&gt;
    player_chip_color = 'black'&lt;br /&gt;
    tic_tac_toe_matrix = [['', '', ''], ['', '', ''], ['', '', '']]&lt;br /&gt;
    number_of_moves = 0&lt;br /&gt;
&lt;br /&gt;
    def play(self):&lt;br /&gt;
        hub.light_matrix.off()&lt;br /&gt;
        while True:&lt;br /&gt;
            hub.right_button.wait_until_pressed()&lt;br /&gt;
            new_tic_tac_toe_matrix = self.get_new_tic_tac_toe_matrix()&lt;br /&gt;
            self.check_tic_tac_toe_matrix_for_player_move(new_tic_tac_toe_matrix)&lt;br /&gt;
            self.show_light_matrix()&lt;br /&gt;
            print(self.tic_tac_toe_matrix)&lt;br /&gt;
            win = evaluate(self.tic_tac_toe_matrix)&lt;br /&gt;
            if win == 10:&lt;br /&gt;
                hub.light_matrix.write('I WIN!!!')&lt;br /&gt;
                return&lt;br /&gt;
            elif win == -10:&lt;br /&gt;
                hub.light_matrix.write('You WIN!!!')&lt;br /&gt;
                return&lt;br /&gt;
            elif not isMovesLeft(self.tic_tac_toe_matrix):&lt;br /&gt;
                hub.light_matrix.write('Draw')&lt;br /&gt;
                return&lt;br /&gt;
            # if self.win_check():&lt;br /&gt;
            #    return&lt;br /&gt;
&lt;br /&gt;
            line_move, column_move = self.get_move()&lt;br /&gt;
            self.show_move(line_move, column_move)&lt;br /&gt;
            self.show_light_matrix()&lt;br /&gt;
&lt;br /&gt;
            win = evaluate(self.tic_tac_toe_matrix)&lt;br /&gt;
            if win == 10:&lt;br /&gt;
                hub.light_matrix.write('I WIN!!!')&lt;br /&gt;
                return&lt;br /&gt;
            elif win == -10:&lt;br /&gt;
                hub.light_matrix.write('You WIN!!!')&lt;br /&gt;
                return&lt;br /&gt;
            elif not isMovesLeft(self.tic_tac_toe_matrix):&lt;br /&gt;
                hub.light_matrix.write('Draw')&lt;br /&gt;
                return&lt;br /&gt;
            # if self.win_check():&lt;br /&gt;
            #    return&lt;br /&gt;
&lt;br /&gt;
    def show_light_matrix(self):&lt;br /&gt;
        hub.light_matrix.off()&lt;br /&gt;
        for line in range(3):&lt;br /&gt;
            for column in range(3):&lt;br /&gt;
                if self.tic_tac_toe_matrix[line][column] == player:&lt;br /&gt;
                    hub.light_matrix.set_pixel(line, column, 80)&lt;br /&gt;
                elif self.tic_tac_toe_matrix[line][column] == robot:&lt;br /&gt;
                    hub.light_matrix.set_pixel(line, column, 100)&lt;br /&gt;
&lt;br /&gt;
    def get_new_tic_tac_toe_matrix(self):&lt;br /&gt;
        new_tic_tac_toe_matrix = [['', '', ''], ['', '', ''], ['', '', '']]&lt;br /&gt;
        self.number_of_moves = 0&lt;br /&gt;
        for line in range(3):&lt;br /&gt;
            for column in range(3):&lt;br /&gt;
                color = head_colorsensor.get_color()&lt;br /&gt;
                print(color)&lt;br /&gt;
                if color == &amp;quot;black&amp;quot;:&lt;br /&gt;
                    new_tic_tac_toe_matrix[line][column] = player&lt;br /&gt;
                    hub.light_matrix.set_pixel(line, column, 80)&lt;br /&gt;
                    self.number_of_moves +=1&lt;br /&gt;
                elif color == &amp;quot;violet&amp;quot;:&lt;br /&gt;
                    new_tic_tac_toe_matrix[line][column] = robot&lt;br /&gt;
                    hub.light_matrix.set_pixel(line, column, 100)&lt;br /&gt;
                    self.number_of_moves +=1&lt;br /&gt;
                else:&lt;br /&gt;
                    hub.light_matrix.set_pixel(line, column, 0)&lt;br /&gt;
&lt;br /&gt;
                if column == 0:&lt;br /&gt;
                    motor_up.run_for_degrees(self.degree_for_move_one_row1 * -1)&lt;br /&gt;
                elif column == 1:&lt;br /&gt;
                    motor_up.run_for_degrees(self.degree_for_move_one_row2 * -1)&lt;br /&gt;
&lt;br /&gt;
            motor_up.run_for_degrees(self.degree_for_move_one_row1 + self.degree_for_move_one_row2)&lt;br /&gt;
            if line != 2:&lt;br /&gt;
                motor_down.run_for_degrees(self.degree_for_move_one_line * -1)&lt;br /&gt;
&lt;br /&gt;
        motor_down.run_to_position(340)&lt;br /&gt;
        return new_tic_tac_toe_matrix&lt;br /&gt;
&lt;br /&gt;
    def check_tic_tac_toe_matrix_for_player_move(self, new_tic_tac_toe_matrix):&lt;br /&gt;
        self.tic_tac_toe_matrix = new_tic_tac_toe_matrix&lt;br /&gt;
        return&lt;br /&gt;
&lt;br /&gt;
    def get_move(self):&lt;br /&gt;
        if self.number_of_moves == 0:&lt;br /&gt;
            return 0,0&lt;br /&gt;
        elif self.number_of_moves == 1:&lt;br /&gt;
            # if self.tic_tac_toe_matrix[0][0] == player or self.tic_tac_toe_matrix[0][2] == player or self.tic_tac_toe_matrix[2][0] == player or self.tic_tac_toe_matrix[2][2] == player:&lt;br /&gt;
            #     return 2,1&lt;br /&gt;
            # else:&lt;br /&gt;
            if self.tic_tac_toe_matrix[0][0] == '':&lt;br /&gt;
                return 0,0&lt;br /&gt;
            elif self.tic_tac_toe_matrix[2][0] == '':&lt;br /&gt;
                return 2,0&lt;br /&gt;
        elif self.number_of_moves == 2:&lt;br /&gt;
            if self.tic_tac_toe_matrix[1][1] == player:&lt;br /&gt;
                return 2,2&lt;br /&gt;
            if self.tic_tac_toe_matrix[0][1] == player or self.tic_tac_toe_matrix[1][0] == player or self.tic_tac_toe_matrix[1][2] == player or self.tic_tac_toe_matrix[2][1] == player:&lt;br /&gt;
                return 1,1&lt;br /&gt;
            else:&lt;br /&gt;
                if self.tic_tac_toe_matrix[2][2] == '':&lt;br /&gt;
                    return 2,2&lt;br /&gt;
                elif self.tic_tac_toe_matrix[2][0] == '':&lt;br /&gt;
                    return 2,0&lt;br /&gt;
                else :&lt;br /&gt;
                    return 0, 2&lt;br /&gt;
        return findBestMove(self.tic_tac_toe_matrix)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    def show_move(self, line, column):&lt;br /&gt;
        while not hub.left_button.was_pressed():&lt;br /&gt;
            for i in range(5, 10):&lt;br /&gt;
                hub.light_matrix.set_pixel(line, column, 10 * i)&lt;br /&gt;
                wait_for_seconds(0.25)&lt;br /&gt;
            for i in range(0, 5):&lt;br /&gt;
                hub.light_matrix.set_pixel(line, column, 100 - 10 * i)&lt;br /&gt;
                wait_for_seconds(0.25)&lt;br /&gt;
        self.tic_tac_toe_matrix[line][column] = robot&lt;br /&gt;
        hub.light_matrix.set_pixel(line, column, 100)&lt;br /&gt;
        return&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This function returns true if there are moves&lt;br /&gt;
# remaining on the board. It returns false if&lt;br /&gt;
# there are no moves left to play.&lt;br /&gt;
def isMovesLeft(board):&lt;br /&gt;
    for i in range(3):&lt;br /&gt;
        for j in range(3):&lt;br /&gt;
            if (board[i][j] == ''):&lt;br /&gt;
                return True&lt;br /&gt;
    return False&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This is the evaluation function as discussed&lt;br /&gt;
# in the previous article ( http://goo.gl/sJgv68 )&lt;br /&gt;
def evaluate(b):&lt;br /&gt;
    # Checking for Rows for 1 or 0 victory.&lt;br /&gt;
    for row in range(3):&lt;br /&gt;
        if (b[row][0] == b[row][1] and b[row][1] == b[row][2]):&lt;br /&gt;
            if (b[row][0] == robot):&lt;br /&gt;
                return 10&lt;br /&gt;
            elif (b[row][0] == player):&lt;br /&gt;
                return -10&lt;br /&gt;
&lt;br /&gt;
    # Checking for Columns for 1 or 0 victory.&lt;br /&gt;
    for col in range(3):&lt;br /&gt;
&lt;br /&gt;
        if (b[0][col] == b[1][col] and b[1][col] == b[2][col]):&lt;br /&gt;
&lt;br /&gt;
            if (b[0][col] == robot):&lt;br /&gt;
                return 10&lt;br /&gt;
            elif (b[0][col] == player):&lt;br /&gt;
                return -10&lt;br /&gt;
&lt;br /&gt;
    # Checking for Diagonals for 1 or 0 victory.&lt;br /&gt;
    if (b[0][0] == b[1][1] and b[1][1] == b[2][2]):&lt;br /&gt;
&lt;br /&gt;
        if (b[0][0] == robot):&lt;br /&gt;
            return 10&lt;br /&gt;
        elif (b[0][0] == player):&lt;br /&gt;
            return -10&lt;br /&gt;
&lt;br /&gt;
    if (b[0][2] == b[1][1] and b[1][1] == b[2][0]):&lt;br /&gt;
&lt;br /&gt;
        if (b[0][2] == robot):&lt;br /&gt;
            return 10&lt;br /&gt;
        elif (b[0][2] == player):&lt;br /&gt;
            return -10&lt;br /&gt;
&lt;br /&gt;
    # Else if none of them have won then return 0&lt;br /&gt;
    return 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This is the minimax function. It considers all&lt;br /&gt;
# the possible ways the game can go and returns&lt;br /&gt;
# the value of the board&lt;br /&gt;
def minimax(board, depth, isMax):&lt;br /&gt;
    score = evaluate(board)&lt;br /&gt;
&lt;br /&gt;
    # If Maximizer has won the game return his/her&lt;br /&gt;
    # evaluated score&lt;br /&gt;
    if (score == 10):&lt;br /&gt;
        return score&lt;br /&gt;
&lt;br /&gt;
    # If Minimizer has won the game return his/her&lt;br /&gt;
    # evaluated score&lt;br /&gt;
    if (score == -10):&lt;br /&gt;
        return score&lt;br /&gt;
&lt;br /&gt;
    # If there are no more moves and no winner then&lt;br /&gt;
    # it is a tie&lt;br /&gt;
    if (isMovesLeft(board) == False):&lt;br /&gt;
        return 0&lt;br /&gt;
&lt;br /&gt;
    # If this maximizer's move&lt;br /&gt;
    if (isMax):&lt;br /&gt;
        best = -1000&lt;br /&gt;
&lt;br /&gt;
        # Traverse all cells&lt;br /&gt;
        for i in range(3):&lt;br /&gt;
            for j in range(3):&lt;br /&gt;
&lt;br /&gt;
                # Check if cell is empty&lt;br /&gt;
                if (board[i][j] == ''):&lt;br /&gt;
                    # Make the move&lt;br /&gt;
                    board[i][j] = robot&lt;br /&gt;
&lt;br /&gt;
                    # Call minimax recursively and choose&lt;br /&gt;
                    # the maximum value&lt;br /&gt;
                    best = max(best, minimax(board,&lt;br /&gt;
                                            depth + 1,&lt;br /&gt;
                                            not isMax))&lt;br /&gt;
&lt;br /&gt;
                    # Undo the move&lt;br /&gt;
                    board[i][j] = ''&lt;br /&gt;
        return best&lt;br /&gt;
&lt;br /&gt;
    # If this minimizer's move&lt;br /&gt;
    else:&lt;br /&gt;
        best = 1000&lt;br /&gt;
&lt;br /&gt;
        # Traverse all cells&lt;br /&gt;
        for i in range(3):&lt;br /&gt;
            for j in range(3):&lt;br /&gt;
&lt;br /&gt;
                # Check if cell is empty&lt;br /&gt;
                if (board[i][j] == ''):&lt;br /&gt;
                    # Make the move&lt;br /&gt;
                    board[i][j] = player&lt;br /&gt;
&lt;br /&gt;
                    # Call minimax recursively and choose&lt;br /&gt;
                    # the minimum value&lt;br /&gt;
                    best = min(best, minimax(board, depth + 1, not isMax))&lt;br /&gt;
&lt;br /&gt;
                    # Undo the move&lt;br /&gt;
                    board[i][j] = ''&lt;br /&gt;
        return best&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This will return the best possible move for the player&lt;br /&gt;
def findBestMove(board):&lt;br /&gt;
    bestVal = -1000&lt;br /&gt;
    bestMove = (-1, -1)&lt;br /&gt;
&lt;br /&gt;
    # Traverse all cells, evaluate minimax function for&lt;br /&gt;
    # all empty cells. And return the cell with optimal&lt;br /&gt;
    # value.&lt;br /&gt;
    for i in range(3):&lt;br /&gt;
        for j in range(3):&lt;br /&gt;
&lt;br /&gt;
            # Check if cell is empty&lt;br /&gt;
            if (board[i][j] == ''):&lt;br /&gt;
&lt;br /&gt;
                # Make the move&lt;br /&gt;
                board[i][j] = robot&lt;br /&gt;
&lt;br /&gt;
                # compute evaluation function for this&lt;br /&gt;
                # move.&lt;br /&gt;
                moveVal = minimax(board, 0, False)&lt;br /&gt;
&lt;br /&gt;
                # Undo the move&lt;br /&gt;
                board[i][j] = ''&lt;br /&gt;
&lt;br /&gt;
                # If the value of the current move is&lt;br /&gt;
                # more than the best value, then update&lt;br /&gt;
                # best/&lt;br /&gt;
                print(&amp;quot;The value of the Move is :&amp;quot;, moveVal, &amp;quot;for&amp;quot;, i, j)&lt;br /&gt;
                if (moveVal &amp;gt; bestVal):&lt;br /&gt;
&lt;br /&gt;
                    bestMove = (i, j)&lt;br /&gt;
                    bestVal = moveVal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    print(&amp;quot;The value of the best Move is :&amp;quot;, bestVal)&lt;br /&gt;
    print()&lt;br /&gt;
    return bestMove&lt;br /&gt;
&lt;br /&gt;
game = TikTakToeWithRobot()&lt;br /&gt;
game.play()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Robot</name></author>	</entry>

	</feed>