Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7862437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:07:44+00:00 2026-06-02T23:07:44+00:00

The code shown below is my main method of a maze game I am

  • 0

The code shown below is my main method of a maze game I am creating.
In this main method I have a while loop that goes on until the game is finished.
In the while loop I print the maze then ask the user which direction they want to move their character.
I am having a crazy problem, the prompt to the user asking for the key, wont display.
The output just prints the maze and then waits for user input.

        do
        {               
            maze.printArray();              
            //Asks the user which direction they wish to move THIS LINE NEVER SHOWS UP!
            System.out.print ("Enter U,L,D,R to indicate move direction:   ");              
            //Gets the string from user, and changes it to a char, then converts it to an uppercase 
            direction = read.next().charAt(0);
            direction = Character.toUpperCase(direction);                   
            //Moves the character and increments the invalidMoves counter if the move was not legal
            if(maze.move(direction) == false)
                invalidMoves++;                 
            //Increment the move count regardless of its validity
            moves++;
        }
        while(maze.isFinished() == false);

This is the printArray method which is called before the print.

public void printArray() 
{
    for (char [] x : mazeArray) 
    {
        for (char y : x) 
        {
            //Print the characters for the row
            System.out.print (y);
        }           
        //linebreak to go to next row
        System.out.println ();
    }
    System.out.println ();
}

The 2D array holds a maze pattern which is displayed to the screen as such

XXXXXXXXXX
XO-------X
XX-XXX-XXX
XX---X---X
XXXX-X-X-X
X----X-XXX
X-XXXX--$X
XXXXXXXXXX
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:07:45+00:00Added an answer on June 2, 2026 at 11:07 pm

    Try println instead of print…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code as shown below: - (IBAction)startButtonPressed:(id)sender { statusText.text = @Processing...; //here
I have a python psp page code is shown below. Currently it only prints
I currently have a library-like .c file (that'll be shown below). I have 2
In the code shown below, I need to manipulate the time var in python
In the code shown below, how to get the values of multiselect box in
I changed the code shown below into ARC compatible. I just changed it as
I've been working on the code shown below for udacity. I'm trying to figure
Okay, so I've got the following code shown below to create a dialog using
The code snippet shown below is supposed to be used to retrieve some data
I draw the ellipse with the code as shown below. How can I make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.