Commit 5a06e374 authored by amir's avatar amir

Displaying in console and graphic version

parent 9e532c5f
This diff is collapsed.
...@@ -9,11 +9,17 @@ public class Main { ...@@ -9,11 +9,17 @@ public class Main {
System.out.println("What type of game do you want? 0)console 1)graphic"); System.out.println("What type of game do you want? 0)console 1)graphic");
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
byte displayType = scanner.nextByte(); byte displayType = scanner.nextByte();
Players players = new Players();
Player1 play1 = new Player1(); Player1 play1 = new Player1();
Player2 play2 = new Player2(); Player2 play2 = new Player2();
players.display(play1.getArr1(), play2.getArr2(), displayType); if (displayType == 0) {
while ((play1.getNumberOfDisks(play1.getArr1()) + play2.getNumberOfDisks(play2.getArr2()) < 64) && Console console = new Console(displayType);
console.display(play1.getArr1(), play2.getArr2());
}
else {
Graphic graphic = new Graphic(displayType);
graphic.display(play1.getArr1(), play2.getArr2());
}
/* while ((play1.getNumberOfDisks(play1.getArr1()) + play2.getNumberOfDisks(play2.getArr2()) < 64) &&
(play1.getNumberOfDisks(play1.getArr1()) != 0) && (play2.getNumberOfDisks(play2.getArr2()) != 0)) (play1.getNumberOfDisks(play1.getArr1()) != 0) && (play2.getNumberOfDisks(play2.getArr2()) != 0))
{ {
if ((play1.numberOfPlayerPossibleMoves(play2.getArr2(), play1.getArr1()) == 0) && if ((play1.numberOfPlayerPossibleMoves(play2.getArr2(), play1.getArr1()) == 0) &&
...@@ -54,13 +60,18 @@ public class Main { ...@@ -54,13 +60,18 @@ public class Main {
} }
} }
players.display(play1.getArr1(), play2.getArr2(), displayType); if (displayType == 0) {
console.display(play1.getArr1(), play2.getArr2());
}
else {
graphic.display(play1.getArr1(), play2.getArr2());
}
//System.out.println("player1: "+play1.getNumberOfDisks1()+" player2:"+play2.getNumberOfDisks2()); //System.out.println("player1: "+play1.getNumberOfDisks1()+" player2:"+play2.getNumberOfDisks2());
} }
if (play1.getNumberOfDisks(play1.getArr1()) > play2.getNumberOfDisks(play2.getArr2())) if (play1.getNumberOfDisks(play1.getArr1()) > play2.getNumberOfDisks(play2.getArr2()))
System.out.println("Player1 wins!"); System.out.println("Player1 wins!");
else else
System.out.println("Player2 wins!"); System.out.println("Player2 wins!");*/
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment