creates board data structure with random colors for each box board [for in range(width)column [for in range(height)column append(random randint( len(palettecolors )board append(columnmake board easier by setting some boxes to same color as neighbor determine how many boxes to change if difficulty =easyif boxsize =smallboxsizeboxestochange elseboxestochange elif difficulty =mediumif boxsize =smallboxsizeboxestochange elseboxestochange elseboxestochange change neighbor' colorsfor in range(boxestochange)randomly choose box whose color to copy random randint( width- random randint( height- randomly choose neighbors to change direction random randint( if direction = change left and up neighbor board[ - ][ =board[ ][yboard[ ][ - =board[ ][yelif direction = change right and down neighbor board[ + ][ =board[ ][yboard[ ][ + =board[ ][yelif direction = change right and up neighbor board[ ][ - =board[ ][yboard[ + ][ =board[ ][yelsechange left and down neighbor board[ ][ + =board[ ][yboard[ - ][ =board[ ][yreturn board