-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTetrisAI.java
More file actions
30 lines (26 loc) · 828 Bytes
/
TetrisAI.java
File metadata and controls
30 lines (26 loc) · 828 Bytes
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
// Austin Trinh & Arjun Rao
// Mr. Randall
// 5.20.23
// TetrisAI.java
// AI is used to simulate all possible moves for one tetromino and return the moveset that has the highest score
public class TetrisAI {
// Fields
private Tetris board;
// Constructor
public TetrisAI(Tetris tetris) {
board = tetris;
}
public void tryMove(Tetromino tetromino) {
int block = tetromino.getBlock();
Tetris copy = board;
copy.printBoard();
Tetromino simTetromino = new Tetromino(copy, block);
simTetromino.simulateMove(16);
System.out.println();
copy.printBoard();
System.out.println();
for(int i=0; i<simTetromino.getMoveList().get(0).length; i++) {
System.out.print(simTetromino.getMoveList().get(0)[i]);
}
}
}