Question
Code is not working import java.util.Scanner; public class MazeContols { public static void main(String[] args) { System.out.println(Greetings Player!, welcome to maze runner.Your goal is to
Code is not working
import java.util.Scanner; public class MazeContols { public static void main(String[] args) { System.out.println("Greetings Player!, welcome to maze runner.Your goal is to collect all coins , Here are keypoints you should note"); System.out.println("S = Start"); System.out.println("E = End"); System.out.println("i = items"); System.out.println("c = coins"); char[][]maze = { {'X','0','X','X','X','X'}, {'X','0','C','C','0','X'}, {'X','C','X','X','X','X'}, {'X','C','O','C','C','X'}, {'X','X','X','X','C','X'}, {'X','C','C','C','C','X'}, {'X','0','X','0','X','X'}, {'X','0','C','X','X','X'}, {'X','C','X','0','X','X'}, {'X','C','C','C','C','X'}, {'X','0','X','X','C','X'}, {'X','0','X','X','C','X'}, {'X','0','X','X','C','X'}, {'X','X','X','X','0','X'} }; maze[0][1] = 'S'; maze[13][4] = 'E'; printMaze(maze); int startRow = 1; int startCol = 1; int[]currLoc= {startRow, startCol}; //do{ Scanner input = new Scanner(System.in); System.out.println("enter which direction you would like to move. 1 = move up 2 = move down 3= move right 4 = move left"); int Direction = input.nextInt(); if ( Direction == 1); { currLoc = moveUP(maze, currLoc[0], currLoc[1]); printMaze(maze); } if ( Direction == 2); { currLoc = moveDown(maze, currLoc[0], currLoc[1]); printMaze(maze); } if ( Direction == 3); { currLoc = moveRight(maze, currLoc[0], currLoc[1]); printMaze(maze); } if ( Direction == 4); { currLoc = moveLeft(maze, currLoc[0], currLoc[1]); printMaze(maze); } // }while() } public static void assignValues( int [][] printMaze, int value){ //Assigns a value to each element of a two dimensional array for (int row = 0;row< printMaze.length; row++){ for (int col = 0;col
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started