Hello, I need help to make this code to run please. this is just a part of the code.
I have the imports below, but hsa.Console is not imported, I have tried to download de jar files for it but cannot find it. Is there a way I could make it work?

import hsa.Console;
import java.io.Console;

Console c;
Console d;

private void askData ()

  d.setCursor ((selection == -1) ? (2): ** // d.setCursor shows an error that says: cannot resolve method "setCursor" in "Console"**
     (3), 1);

  d.println (); **// same error here**

  if (selection2 != -1)
     d.setCursor ((selection == -1) ? (2):
        (3), 1);
  else

     d.clear(); **// same error here**
     d.setCursor (2, 1);

  if (selection == -1)

     d.println ("Please enter the first tower.");
     userInput = d.getChar (); **// same error here**
     if ((userInput - '0' > 3 || userInput - '0' < 1) && userInput != 'e' && userInput != 'E' && userInput != 's' && userInput != 'S')

        JOptionPane.showMessageDialog (null, "Error! Invalid range! The range must be between 1 and 3!");
        askData ();
        return;

     else
     if (userInput == 'e' || userInput == 'E' || userInput == 's' || userInput == 'S')
        return;
     d.println ((selection = (userInput - '0') - 1) + 1);

  d.print ("Please enter the destination tower.");
  userInput = d.getChar ();
  if (userInput - '0' > 3 || userInput - '0' < 1 && userInput != 'e' && userInput != 'E' && userInput != 's' && userInput != 'S')

     JOptionPane.showMessageDialog (null, "Error! Invalid range! The range must be between 1 and 3!");
     selection2 = -1; //Here.
     askData ();

  else
  if (userInput == 'e' || userInput == 'E' || userInput == 's' || userInput == 'S')
     return;
  d.println ((selection2 = (userInput - '0') - 1) + 1);
  if ((highlightIndex (selection, false, false) != -1 && highlightIndex (selection2, false, false) != -1 && board [((difficulty - (highlightIndex (selection, false, false)) == -1) ? (0):
     ((difficulty - highlightIndex (selection, false, false))))] [selection] > board [(difficulty - (highlightIndex (selection2, false, false)) == -1) ? (0):
     (difficulty - ((highlightIndex (selection2, false, false))))] [selection2]))

     selection = -1;
     selection2 = -1;
     JOptionPane.showMessageDialog (null, "Error! Invalid choices! You cannot place a big block over a smaller block.");
     askData ();
     return;

Recommended Answers

All 2 Replies

PS. I can't guess what game this is. It's not in any comment but in another discussion 8 years ago you had a reply to what might be the old
Rock Paper Scissors game. Example code that seems fine is at https://junilearning.com/blog/coding-projects/rock-paper-scissors-java-project/

Now a quick look sees this might be the old Tower of Hanoi game. Let's find that too at https://www.geeksforgeeks.org/c-program-for-tower-of-hanoi/

Recap: Don't make people guess what your code is supposed to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.