IOException;
import java.util.Scanner;
intro();
userMove();
System.out.println("\n\t___________________________________________________________");
getch();
myMap.printMap();
getch();
String move;
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
move = input.next();
if (move.equalsIgnoreCase("W")) {
if (myMap.isThereAPit(move)){
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
if (jump.equalsIgnoreCase("J")) {
myMap.jumpOverPit(move);
} else {
massage = "Pitted";
}else if (myMap.canIMoveUp()) {
myMap.moveUp();
massage = "Moved";
}
else {
} else if (move.equalsIgnoreCase("S")) {
if (myMap.isThereAPit(move)){
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
if (jump.equalsIgnoreCase("J")) {
myMap.jumpOverPit(move);
} else {
massage = "Pitted";
}else if (myMap.canIMoveDown()) {
myMap.moveDown();
massage = "Moved";
} else {
} else if (move.equalsIgnoreCase("A")) {
if (myMap.isThereAPit(move)){
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
if (jump.equalsIgnoreCase("J")) {
myMap.jumpOverPit(move);
} else {
massage = "Pitted";
}else if (myMap.canIMoveLeft()) {
myMap.moveLeft();
massage = "Moved";
} else {
} else if (move.equalsIgnoreCase("D")) {
if (myMap.isThereAPit(move)){
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
String jump = input.next();
if (jump.equalsIgnoreCase("J")) {
myMap.jumpOverPit(move);
} else {
massage = "Pitted";
}else if (myMap.canIMoveRight()) {
myMap.moveRight();
massage = "Moved";
} else {
} else {
moveleft++;
moveleft--;
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
System.out.println("\n\t\tSorry, You are out of move. And, you couldn't escaped! Better luck next time.");
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
System.out.println("\n\t\tGame Over. You have fall down throw the pit. Be careful next time.");
clrscr();
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~");
System.out.println("\t\t| W = Up \t\tS = Down\t\tA = Left\t\tD = Right\t\tJ = Jump |\t\t\t| Moves Left: " +
moveleft+" |");
System.out.println("\t\t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~\n\n\t"+massage);
myMap.printMap();
System.out.println("\n\t\tWow! You just escaped at the last move!");
try {
System.in.read();
catch (IOException e) {
e.printStackTrace();
System.out.println("");