-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (37 loc) · 1.11 KB
/
Main.java
File metadata and controls
49 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
class Main
{
private static Screen screen;
private static Game game;
// IDEAS: auto-sort after win, only show possible row numbers for corresponding pile
public static void main(String[] args)
{
game = new Game();
game.prepare();
screen = new Screen(game);
Scanner scanner = new Scanner(System.in);
while(game.getStatus() == Status.PLAY)
{
screen.update();
if(game.getInput() == Input.PILE ||
game.getInput() == Input.ROW)
System.out.println("Select Card");
else if(game.getInput() == Input.DESTINATION_PILE)
System.out.println("Select Destination");
if(game.getInput() == Input.PILE ||
game.getInput() == Input.DESTINATION_PILE)
System.out.println("Enter Pile:");
else if(game.getInput() == Input.ROW)
System.out.println("Enter Row:");
String input = scanner.nextLine().toUpperCase();
game.action(input);
game.checkWon();
}
if(game.getStatus() == Status.WON)
{
screen.update();
System.out.println("You win");
}
scanner.close();
}
}