in order to find which box the mouse coordinates are overwe will go through each box' coordinates and call the collidepoint(method on rect object with those coordinates when collidepoint(returns truewe know we have found the box that was clicked on or moved over and will return the box coordinates if none of them return truethen the getboxatpixel(function will return the value (nonenonethis tuple is returned instead of simply returning none because the caller of getboxatpixel(is expecting tuple of two values to be returned drawing the iconand syntactic sugar def drawicon(shapecolorboxxboxy) quarter int(boxsize syntactic sugar half int(boxsize syntactic sugar lefttop lefttopcoordsofbox(boxxboxyget pixel coords from board coords the drawicon(function will draw an icon (with the specified shape and colorat the space whose coordinates are given in the boxx and boxy parameters each possible shape has different set of pygame drawing function calls for itso we must have large set of if and elif statements to differentiate between them (these statements are on lines to the and coordinates of the left and top edge of the box can be obtained by calling the lefttopcoordsofbox(function the width and height of the box are both set in the boxsize constant howevermany of the shape drawing function calls use the midpoint and quarter-point of the box as well we can calculate this and store it in the variables quarter and half we could just as easily have the code int(boxsize instead of the variable quarterbut this way the code becomes easier to read since it is more obvious what quarter means rather than int(boxsize such variables are an example of syntactic sugar syntactic sugar is when we add code that could have been written in another way (probably with less actual code and variables)but does make the source code easier to read constant variables are one form of syntactic sugar precalculating value and storing it in variable is another type of syntactic sugar (for examplein the getrandomizedboard(functionwe could have easily made the code on lines and line into single line of code but it' easier to read as two separate lines we don' need to have the extra quarter and half variablesbut having them makes the code easier to read code that is easy to read is easy to debug and upgrade in the future draw the shapes if shape =donut