Main class

mail@pastecode.io avatar
unknown
java
a month ago
1.1 kB
43
Indexable
Never
/**
 * ES234211 - Basic Programming
 * Computing Lab. Work
 * Coursework No.   : 06
 * Student ID       : .......................
 * Student Name     : .......................
 * Class            : ...
 * Cohort           : ...
 */
 
import java.util.Scanner;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] args) {
        // task1();
        task2();
    }

    public static void task1() {
        Game game = new Game();
        game.startGame();
    }
    
    public static void task2() {
         try {
            Scanner sc = new Scanner(System.in);
            System.out.print("Enter the start and end position: ");
            int a,b,c,d;
            a = sc.nextInt();
            b = sc.nextInt();
            c = sc.nextInt();
            d = sc.nextInt();
            MazeSolver ms = new MazeSolver("maze.txt", a,b,c,d);
            ms.solve();
        } catch (InputMismatchException e){
            System.out.println("Error: Invalid input. Please enter integers only.");
        }
        
    }
}
Leave a Comment