positionsline initializes it to the smallest possible valueand the loop in lines to searches for improvements each successor position is recursively evaluated in turn by lines to this is recursivebecauseas we will seefindhumanmove calls findcompmove if the human' response to move leaves the computer with more favorable position than that obtained with the previously best computer movethen the value and bestmove are updated figure shows the function for the human' move selection the logic is virtually identicalexcept that the human player chooses the move that leads to the lowestvalued position indeedit is not difficult to combine these two procedures into one by int tictactoe::findhumanmoveint bestmove int iresponsevalueint dc/dc means don' careits value is unused int valueiffullboardvalue drawelse ifimmediatehumanwinbestmove return comp_losselse value comp_winbestmove fori < ++ /try each square ifisemptyi placeihuman )responsevalue findcompmovedc )unplacei )/restore board ifresponsevalue value /update best move value responsevaluebestmove ireturn valuefigure minimax tic-tac-toe algorithmhuman selection