def getcomputermove(boardcomputertile) given board and the computer' tiledetermine where to move and return that move as [xylist possiblemoves getvalidmoves(boardcomputertile randomize the order of the possible moves random shuffle(possiblemoves always go for corner if available for xy in possiblemoves if isoncorner(xy) return [xy go through all possible moves and remember the best scoring move bestscore - for xy in possiblemoves dupeboard copy deepcopy(board makemove(dupeboardcomputertilexy score getscoreofboard(dupeboard)[computertile if score bestscore bestmove [xy bestscore score return bestmove def checkforquit() for event in pygame event get((quitkeyup))event handling loop if event type =quit or (event type =keyup and event key =k_escape) pygame quit( sys exit( if __name__ ='__main__' main(email questions to the authoral@inventwithpython com