Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that you want to implement an algorithm that will compete on a two-playe

ID: 3889840 • Letter: S

Question

Suppose that you want to implement an algorithm that will compete on a two-player deterministic game of perfect information. Your opponent is a supercomputer called X. X does not use Minimax. You are given a library function XMove(S), that takes any state S as an argument, and returns the move that X will choose for that state S (more precisely, XMove (S) returns the state resulting from the opponent's move). Write an algorithm in pseudocode (following the style of the Minimax pseudocode) that will always make an optimal decision given the knowledge we have about X. You are free to use the library function XMove(S) in your pseudocode. If you think regular Minimax is the answer, just state so.

Explanation / Answer

XMove(s) /. function gives us the best move from state s.

To check whether the current move give us the better move than XMove we will check with the minmax and check for all possible way and gives us besy way.

function minimax(board, depth, isMaximizingPlayer):

if current board state is a terminal state :

return value of the board

  

if isMaximizingPlayer :

bestVal = -INFINITY

for each move in board :

value = minimax(board, depth+1, false)

bestVal = max( bestVal, value)

return bestVal

else :

bestVal = +INFINITY

for each move in board :

value = minimax(board, depth+1, true)

bestVal = min( bestVal, value)

return bestVal

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote