There is a bug at source code in Page 617

   if isValidTile(position: newPosition) {
      if getTile(position: newPosition) <= 3 {
        currentLocation = newPosition
        if i == 0 && j == 0 {
          setTile(position: currentLocation, toValue: 5)
        } else {
          setTile(position: currentLocation, toValue: 3)
        }
      }
    }

If newPosition is invalid and i, j == 0, Level End Tile is missed.