Skip to content

Commit

Permalink
Merge pull request #334 from shankar-veludandi/new_puzzle-skyscrapers
Browse files Browse the repository at this point in the history
push
  • Loading branch information
ThisMatt authored Oct 18, 2022
2 parents 921d8cc + 5c7bcd3 commit f1d83ba
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package edu.rpi.legup.puzzle.skyscrapers.rules;

import edu.rpi.legup.model.gameboard.Board;
import edu.rpi.legup.model.gameboard.CaseBoard;
import edu.rpi.legup.model.gameboard.PuzzleElement;
import edu.rpi.legup.model.rules.ContradictionRule;
import edu.rpi.legup.puzzle.skyscrapers.SkyscrapersBoard;
import edu.rpi.legup.puzzle.skyscrapers.SkyscrapersCell;
import edu.rpi.legup.puzzle.skyscrapers.SkyscrapersClue;
import edu.rpi.legup.puzzle.skyscrapers.SkyscrapersType;

import java.awt.*;
import java.util.*;
import java.util.List;

public class PreemptiveTooFewContradictionRule extends ContradictionRule{

public PreemptiveTooFewContradictionRule() {
super("SKYS-CONT-0006", "Preemptive Too Few",
"Less skyscrapers are visible than there should be in an incomplete row/col",
"edu/rpi/legup/images/skyscrapers/contradictions/TooFew.png");
}

@Override
public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
SkyscrapersCell cell = (SkyscrapersCell) puzzleElement;
SkyscrapersBoard skyscrapersboard = (SkyscrapersBoard) board;
Point loc = cell.getLocation();

//get borders
int west = skyscrapersboard.getWestClues().get(loc.y).getData();
int east = skyscrapersboard.getEastClues().get(loc.y).getData();
int north = skyscrapersboard.getNorthClues().get(loc.x).getData();
int south = skyscrapersboard.getSouthClues().get(loc.x).getData();



InsufficientVisibilityContradictionRule tooFew = new InsufficientVisibilityContradictionRule();
CellForNumberCaseRule caseRule = new CellForNumberCaseRule();
System.out.println("1");


//Check Row


//check west


//create board with every possible row permutation given the current cell

System.out.println("2");
List<Board> list = caseRule.getCasesFor(board, skyscrapersBoard.getWestClues().get(loc.y), 1);



// for(int i = 0; i < list.size(); i++)
// System.out.println(list.get(i));

System.out.println("3");




//for each row call getCasesFor for each number progressively
//getCasesFor for each clue

//for each clue iterate 1-n for number

//
return null;


}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.rpi.legup.puzzle.skyscrapers.rules;

public class PreemptiveTooManyContradictionRule {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f1d83ba

Please sign in to comment.