code: def validate_index(self, index):
          
          if index < 0 or index >= self.size:
              raise ForbiddenIndex("Linear index {} not in {}x{} board.".format(
                  index, self.length, self.height))
docs: Check that a linear index of a square is within board's bounds.