Skip to content
Snippets Groups Projects
Commit 93a28dc6 authored by Bariatti Francesco's avatar Bariatti Francesco
Browse files

Added Main with ascii representation of the solution

parent 524ba9ed
No related branches found
No related tags found
No related merge requests found
package main;
import model.Board;
import model.Move;
import model.Solver;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Deque;
public class AsciiMain
{
public static void main(String[] args) throws IOException
{
System.out.println("Enter level filename:");
String filename = new BufferedReader(new InputStreamReader(System.in)).readLine();
Board level = new Board(filename);
System.out.println("Starting board:");
System.out.println(level);
System.out.println("Solving...");
Solver solver = new Solver(level);
Deque<Move> moves = solver.solve(true);
if(moves == null)
{
System.out.println("This level has no solution!");
}
else
{
System.out.println("Solved! The solution is composed of "+moves.size()+" steps.");
for (Move m : moves)
{
System.out.println(m);
level.play(m);
System.out.println(level);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment