Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

ISBN: 3642412203, 978-3642412202

More Books

Students also viewed these Databases questions