Package com.puzzlebazar.shared.util

Examples of com.puzzlebazar.shared.util.PuzzleMessage


   * connected group, otherwise return a {@link java.util.List} of cell
   *         locations that form a disconnected group.
   */
  public PuzzleMessage checkSolved() {

    PuzzleMessage result = null;
    int roomsPerCell[][] = countRoomsPerCell();
    for (int x = 0; x < getWidth(); ++x) {
      for (int y = 0; y < getHeight(); ++y) {
        if (roomsPerCell[x][y] != 1) {
          if (result == null) {
            result = new PuzzleMessage(true, "Some cells are covered by more than one room.");
          }
          result.addErrorLocation(new Vec2i(x,y));
        }
      }
    }

    if (result != null) {
      return result;
    }

    return new PuzzleMessage(false);
  }
View Full Code Here


        checkAndAdd(visited, valid, loc, stack);
      }
    }

    if (anyValidVisited(true, false, valid, visited)) {
      PuzzleMessage result = new PuzzleMessage(true);
      findValidVisited(result, true, true, valid, visited);
      return result;
    }

    return new PuzzleMessage(false);
  }
View Full Code Here

    for (int i = 0; i < valid.length - 1; ++i) {
      boolean prevValid = false;
      for (int j = 0; j < valid[i].length; ++j) {
        if (valid[i][j]) {
          if (prevValid) {
            PuzzleMessage result = new PuzzleMessage(true);
            result.addErrorLocation(new Vec2i(i, j));
            result.addErrorLocation(new Vec2i(i, j - 1));
            return result;
          }
          prevValid = true;
          if (valid[i + 1][j]) {
            PuzzleMessage result = new PuzzleMessage(true);
            result.addErrorLocation(new Vec2i(i, j));
            result.addErrorLocation(new Vec2i(i + 1, j));
            return result;
          }
        } else {
          prevValid = false;
        }
      }
    }

    return new PuzzleMessage(false);
  }
View Full Code Here

TOP

Related Classes of com.puzzlebazar.shared.util.PuzzleMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.