Class PuzzleLevelDTO


public class PuzzleLevelDTO extends UpdatePuzzleLevelDTO
Represents a puzzle from the JSON file. Modified from: https://cs.plu.edu/courses/protected/cs390/2023s/project/iteration2.html
  • Constructor Details

    • PuzzleLevelDTO

      public PuzzleLevelDTO(int id, List<List<CellDTO>> regions, List<CellDTO> solution, int gridSize, int numStars, int solvedByNumPlayers)
      PuzzleLevelDTO constructor
      Parameters:
      id - the id of the puzzle
      regions - the regions of the puzzle
      solution - the solution to the puzzle
      gridSize - the size of the grid
      numStars - the number of stars per region
      solvedByNumPlayers - the number of players who have solved the puzzle
  • Method Details

    • getId

      public int getId()
      Returns:
      the id of the puzzle
    • fromJSON

      public static PuzzleLevelDTO fromJSON(File jsonFile) throws IOException
      Creates a PuzzleDTO from a JSON file
      Parameters:
      jsonFile - the JSON file
      Returns:
      the PuzzleDTO object
      Throws:
      IOException - if the file cannot be read
    • toString

      public String toString()
      Overrides:
      toString in class UpdatePuzzleLevelDTO