-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintBoard.java
More file actions
46 lines (39 loc) · 1.08 KB
/
PrintBoard.java
File metadata and controls
46 lines (39 loc) · 1.08 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
package cs3500.pa03.View;
import cs3500.pa03.Model.GameBoard;
/**
* Prints the board.
*/
public class PrintBoard {
/**
* @param board the GameBoard to be printed
* @param player the title to be printed
*/
public static void printBoard(GameBoard board, String player) {
int height = board.getHeight();
int width = board.getWidth();
System.out.println(player);
for (int x = 0; x < height; x++) {
for (int y = 0; y < width; y++) {
System.out.print(board.getBoard(x, y) + " ");
}
System.out.println();
}
System.out.println();
}
/**
* @param board the char Board to be printed
* @param player the title to be printed
*/
public static void printAiBoard(char[][] board, String player) {
int height = board.length;
int width = board[0].length;
System.out.println(player);
for (int x = 0; x < height; x++) {
for (int y = 0; y < width; y++) {
System.out.print(board[x][y] + " ");
}
System.out.println();
}
System.out.println();
}
}