and now that we can figure out where the falling piece' boxes are as board coordinateswe can see if they overlap with the landed boxes that are already on the board the nested for loops on lines and go through each of the possible coordinates on the falling piece we want to check if box of the falling piece is either off of the board or overlapping box on the board (although one exception is if the box is above the boardwhich is where it could be when the falling piece just begins falling line creates variable named isaboveboard that is set to true if the box on the falling piece at the coordinates pointed to be and is above the board otherwise it is set to false the if statement on line checks if the space on the piece is above the board or is blank if either of those is truethen the code executes continue statement and goes to the next iteration (note that the end of line has [ ][xinstead of [ ][ythis is because the coordinates in the pieces data structure are reversed see the previous section--setting up the piece templates|| adjy) blank if not isonboard( piece[' 'adjxy piece[' 'return false if board[ piece[' 'adjx][ piece[' 'adjy!return false return true the if statement on line checks that the piece' box is not located on the board the if statement on line checks that the board space the piece' box is located is not blank if either of these conditions are truethen the isvalidposition(function will return false notice that these if statements also adjust the coordinates for the adjx and adjy parameters that were passed in to the function if the code goes through the nested for loop and hasn' found reason to return falsethen the position of the piece must be valid and so the function returns true on line checking forand removingcomplete lines def iscompleteline(boardy) return true if the line filled with boxes with no gaps for in range(boardwidth) if board[ ][ =blank return false return true email questions to the authoral@inventwithpython com