Added an interface to allow for simplier traversal. Need to implement to DFS as well.

This commit is contained in:
Jonathan Turner 2024-02-11 03:38:54 -05:00
parent f7d888305d
commit 1e554fbdb0
4 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,9 @@
package Assignments.A1.models;
import Assignments.A1.models.Board;
import Assignments.A1.models.BoardNode;
public interface Solver {
BoardNode traverse(Board board);
}

View File

@ -3,13 +3,14 @@ package Assignments.A1.solving_algorithms;
import Assignments.A1.models.Board;
import Assignments.A1.models.BoardNode;
import Assignments.A1.models.Move;
import Assignments.A1.models.Solver;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
public class AStar {
public class AStar implements Solver {
private final Board solved = new Board();
private final HashSet<Board> visited = new HashSet<>();

View File

@ -3,13 +3,14 @@ package Assignments.A1.solving_algorithms;
import Assignments.A1.models.Board;
import Assignments.A1.models.BoardNode;
import Assignments.A1.models.Move;
import Assignments.A1.models.Solver;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
public class BFS {
public class BFS implements Solver {
private final HashSet<Board> visited = new HashSet<>();
private static final Board solved = new Board();

View File

@ -3,13 +3,14 @@ package Assignments.A1.solving_algorithms;
import Assignments.A1.models.Board;
import Assignments.A1.models.BoardNode;
import Assignments.A1.models.Move;
import Assignments.A1.models.Solver;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
public class UCS {
public class UCS implements Solver {
private final Board solved = new Board();
private final HashSet<Board> visited = new HashSet<>();