-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSokoban.java
38 lines (29 loc) · 900 Bytes
/
Sokoban.java
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
package Sokoban;
import java.util.Arrays;
import java.util.Scanner;
public class Sokoban {
Sokoban sokoban;
Board board;
public void init(){
board = new Board(8);
}
public void run() {
Scanner scanner = new Scanner(System.in);
System.out.println("Hvor stort brett (f. eks 8 for 8X8) ønsker du å spille med? ");
if (scanner.hasNextInt()){
int nextInt = scanner.nextInt();
if (nextInt>5 && nextInt<101)
board = new Board(nextInt);
else
throw new IllegalArgumentException("Du må skrive inn et heltall større enn 5, og mindre enn 101");
}else {
throw new IllegalArgumentException("Du må skrive inn et heltall større enn 5, og mindre enn 101");
}
System.out.println(board);
System.out.println(board.ledigeRuter());
}
public static void main(String[] args) {
Sokoban sokoban = new Sokoban();
sokoban.run();
}
}