public boolean step()
  {
    board[knight.y][knight.x] = VISITED;

    Point[] possibleMoves = getPossibleMoves(knight.x, knight.y);
    Random random = new Random(System.nanoTime());

    if (possibleMoves.length > 0)
    {
      Point nextMove = possibleMoves[0];
      int numOfPossibleMoves = getNumberOfPossibleMoves(nextMove.x, nextMove.y);

      for (int i = 1, length = possibleMoves.length; i < length; i++)
      {
        int nextNumOfPossibleMoves = getNumberOfPossibleMoves(possibleMoves[i].x, possibleMoves[i].y);

        if (nextNumOfPossibleMoves < numOfPossibleMoves)
        {
          nextMove = possibleMoves[i];
          numOfPossibleMoves = nextNumOfPossibleMoves;
        }
        else if (nextNumOfPossibleMoves == numOfPossibleMoves)
        {
          nextMove = random.nextBoolean() ? possibleMoves[i] : nextMove;

          random.setSeed(System.nanoTime());
        }
      }

      knight.setLocation(nextMove);
      squaresVisited++;

      return true;
    }
    else
      return false;
  }