public static void main(String[] args) {
    System.out.print("Enter infix: ");
    String infix = Keyboard.readString();

    String result = generatePostfix(infix);
    System.out.println(result);
  }
  public void prompt() {

    String prompt =
        "Choose your action:\n1 - Explore the town\n2 - Check your inventory\n3 - Go to the tavern\n4 - Go to the pub\n5 - Go to the next zone";
    System.out.println(prompt);
    String input = Keyboard.readString();

    if (input.equals("1")) {
      System.out.println("Under development");
      prompt();
    } else if (input.equals("2")) {
      System.out.println("You ruffle through your bag.");
      inventory.prompt(chara);
      prompt();
    } else if (input.equals("3")) {
      System.out.println("Under development");
      prompt();
    } else if (input.equals("4")) {
      System.out.println("Under development");
      prompt();
    } else if (input.equals("5")) {
      exit();
    } else {
      System.out.println("Try again");
      prompt();
    }
  }
Esempio n. 3
0
 /*====================================
 plays one turn of 2048
 ====================================*/
 public void playTurn() {
   String s = Keyboard.readString();
   if (s.equals("w") && swipeU()) addNewTile();
   else if (s.equals("a") && swipeL()) addNewTile();
   else if (s.equals("s") && swipeD()) addNewTile();
   else if (s.equals("d") && swipeR()) addNewTile();
   else return; // if the input is not w a s or d, do nothing
   // System.out.println("\n" + _board);
   System.out.println(_board);
 }
 public void choice() {
   System.out.println(
       "1 - Answer the Riddle(Hint: Remember hearing anything wierd in the towns or something?)\n2 - Leave your camel behind\n");
   String input = Keyboard.readString();
   if (input.equals("1")) {
     EndOne end1 = new EndOne(chara);
     end1.play();
   } else if (input.equals("2")) {
     EndTwo end2 = new EndTwo(chara);
     end2.play();
   } else {
     System.out.println("Invalid input");
   }
 }
Esempio n. 5
0
 public void SkillsDisplay(Monster m) {
   System.out.println(
       "1 - Charge: Costs 15 SpMp, This is a powerful charge and hit against your enemy!");
   System.out.println(
       "2 - Blunt Bash: Costs 25 SpMp, This ability has a chance to stun your enemy!");
   System.out.println(
       "3 - Precise Strike: Costs 20 SpMp, This ability has a chance to make your opponent bleed!");
   System.out.println("4 - Go Back");
   String input = Keyboard.readString();
   if (input.equals("1")) {
     Charge(m);
   } else if (input.equals("2")) {
     BluntBash(m);
   } else if (input.equals("3")) {
     PreciseStrike(m);
   } else if (input.equals("4")) {
     action(m);
   } else {
     System.out.println("Invalid input");
     SkillsDisplay(m);
   }
 }
Esempio n. 6
0
 public void action(Monster m) {
   System.out.println("1 - Basic Attack");
   System.out.println("2 - Use a Skill");
   System.out.println("3 - Use an Item");
   System.out.println("4 - Run away");
   String input = Keyboard.readString();
   if (input.equals("1")) {
     System.out.println(
         "Your majestic blade bathes in crimson as you dig the blade into your foe");
     attack(m);
   } else if (input.equals("2")) {
     SkillsDisplay(m);
   } else if (input.equals("3")) {
     System.out.println("Under development. Please understand fam");
     action(m);
   } else if (input.equals("4")) {
     System.out.println("Under development. Please understand fam");
     action(m);
   } else {
     System.out.println("Invalid input");
     action(m);
   }
 }
Esempio n. 7
0
 public static String ask(String question) {
   System.out.print(question + ": ");
   String ans = Keyboard.readString();
   return ans;
 }