Skip to content

Commit

Permalink
FusionRoom
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBeauchet committed Feb 27, 2021
1 parent 78b5c99 commit 56add99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public static void main(String[] args) {
//myMap.setPath();
Procedure.setRamdomRooms(myMap);
Model.Procedure.setRamdomMob(myMap);

//System.out.println(Procedure.getRandomRoom());
myMap.FustionRoom();
new Affichage(myMap);
}
}
12 changes: 8 additions & 4 deletions src/main/java/Model/Map.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public ArrayList<Room> getRooms(){
}

//TODO c'est moche tkt (les angles marchent pas encore parfaitement
public void setPath(){
public void FustionRoom(){
ArrayList<ArrayList<Cell>> arrayListCell = new ArrayList<>();
for (int i = 0; i < SIZEY; i++) {
ArrayList<Cell> line= new ArrayList<>();
Expand Down Expand Up @@ -299,12 +299,16 @@ private boolean isWall(Position pos){

private boolean canPath(Position THIS, Position... pos){
int nbrMursVoisins=0;
int nbrMursVoisinsAngle=0;
for (Position p : pos){
if((isWall(p)) && (get(THIS).getType() != Cell.CellType.ANGLE)){
nbrMursVoisins=nbrMursVoisins+1;
if(isWall(p) && get(THIS).getType() != Cell.CellType.ANGLE && p.getX()>0 && p.getX()<SIZEX && p.getY()>0 && p.getY()<SIZEY) {
nbrMursVoisins++;
}
if(get(p).getType().equals(Cell.CellType.ANGLE)){
nbrMursVoisinsAngle++;
}
}
return nbrMursVoisins > 4;
return nbrMursVoisinsAngle < 2 && nbrMursVoisins > 4;
}
}

0 comments on commit 56add99

Please sign in to comment.