getcomputermove(and is where the ai algorithm is implemented normally you use the results from getvalidmoves(for hints mode hints mode will print period characters on the board to show the player all the potential moves they can make but if getvalidmoves(is called with the computer ai' tile (in computertile)it will also find all the possible moves that the computer can make the ai will select the best move from this list randomize the order of the possible moves random shuffle(possiblemovesfirstrandom shuffle(will randomize the order of moves in the possiblemoves list why we want to shuffle the possiblemoves list will be explained laterbut first let' look at the algorithm corner moves are the best moves always go for corner if available for xy in possiblemovesif isoncorner(xy)return [xyfirstline loops through every move in possiblemoves if any of them are on the cornerreturn that space is returned as the move corner moves are good idea in reversi because once tile has been placed on the cornerit can never be flipped over since possiblemoves is list of two-item listsuse multiple assignment in the for loop to set and if possiblemoves contains multiple corner movesthe first one is always used but since possiblemoves was shuffled on line it is random which corner move is first in the list get list of the best scoring moves go through all the possible moves and remember the best scoring move bestscore - for xy in possiblemovesdupeboard getboardcopy(boardmakemove(dupeboardcomputertilexyscore getscoreofboard(dupeboard)[computertileif score bestscorebestmove [xybestscore score return bestmove if there are no corner movesloop through the entire list and find out which move results in the highest score line ' for loop will set and to every move in possiblemoves bestmove is post questions to