Skip to content

Commit

Permalink
A* completo
Browse files Browse the repository at this point in the history
  • Loading branch information
Macro21 committed Mar 10, 2018
1 parent 959301b commit 3f68925
Show file tree
Hide file tree
Showing 12 changed files with 508 additions and 189 deletions.
Binary file modified Practica 1/bin/aStar/Board$1.class
Binary file not shown.
Binary file modified Practica 1/bin/aStar/Board$2.class
Binary file not shown.
Binary file modified Practica 1/bin/aStar/Board$3.class
Binary file not shown.
Binary file modified Practica 1/bin/aStar/Board.class
Binary file not shown.
Binary file modified Practica 1/bin/aStar/Star$2.class
Binary file not shown.
Binary file modified Practica 1/bin/aStar/Star.class
Binary file not shown.
Binary file modified Practica 1/bin/dataStructures/Cell.class
Binary file not shown.
Binary file modified Practica 1/bin/dataStructures/Data.class
Binary file not shown.
340 changes: 289 additions & 51 deletions Practica 1/src/aStar/Board.java

Large diffs are not rendered by default.

311 changes: 188 additions & 123 deletions Practica 1/src/aStar/Star.java

Large diffs are not rendered by default.

38 changes: 30 additions & 8 deletions Practica 1/src/dataStructures/Cell.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ public class Cell {
private double g;
private double h;
private double f;
private Cell father;
private boolean isBarrier;

public Cell() {
this.cell = new JButton();
this.cell.setBackground(new Color(255,255,204));
isBarrier = false;
}

public Cell(int x, int y) {
this.x = x;
this.y = y;
this.cell = new JButton();
this.cell.setBackground(new Color(255,255,204));
isBarrier = false;
}

public void mark(Color c) {
Expand All @@ -41,15 +45,11 @@ public JButton getCell() {
return cell;
}

public void isBarrier() {
public void setBarrier() {
this.cell.setBackground(new java.awt.Color(0, 0, 0));
this.cell.setFont(new java.awt.Font("Verdana", 0, 16));
this.cell.setForeground(new java.awt.Color(255, 0, 0));
this.cell.setText("X");
}

public void setCell(JButton cell) {
this.cell = cell;
isBarrier = true;
//this.cell.setFont(new java.awt.Font("Verdana", 0, 16));
//this.cell.setForeground(new java.awt.Color(255, 0, 0));
}

public double getG() {
Expand Down Expand Up @@ -99,4 +99,26 @@ else if (this.h == c2.getH()) {
public void setDefaultColor() {
this.cell.setBackground(new Color(255,255,204));
}

public void setFather(Cell father) {
this.father = father;
}

public Cell getFather() {
return this.father;
}

public boolean isBarrier() {
return this.isBarrier;
}

public void setStart() {
// TODO Auto-generated method stub
this.cell.setBackground(new Color(0,0,153));
}

public void setGoal() {
// TODO Auto-generated method stub
this.cell.setBackground(new Color(128,255,0));
}
}
8 changes: 1 addition & 7 deletions Practica 1/src/dataStructures/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

public class Data {

private int index;
private boolean found;
private Cell cell;

public Data(boolean found, Cell cell, int index) {
public Data(boolean found, Cell cell) {
this.found = found;
this.cell = cell;
this.index = index;
}

public Cell getCell() {
Expand All @@ -20,10 +18,6 @@ public boolean isFound() {
return found;
}

public int getIndex() {
return index;
}

public void setCell(Cell cell) {
this.cell = cell;
}
Expand Down

0 comments on commit 3f68925

Please sign in to comment.