-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove.java
More file actions
101 lines (85 loc) · 2.39 KB
/
Move.java
File metadata and controls
101 lines (85 loc) · 2.39 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package entity;
/**
* Created by amareelez on 23.12.16.
*/
public class Move {
private final int amazon_id;
private final int row;
private final int col;
private final int arrow_row;
private final int arrow_col;
public Move(int amazon, int row, int col, int arrow_row, int arrow_col) {
this.amazon_id = amazon;
this.row = row;
this.col = col;
this.arrow_row = arrow_row;
this.arrow_col = arrow_col;
}
/**
* Return an int array representing the amazon's move.
* //int[0] = amazon ID being moved;
* //int[1] = row to move amazon to;
* //int[2] = column to move amazon to;
*
* @return int[3]
*/
public int[] getAmazonMove() {
int[] thisMove = new int[3];
thisMove[0] = amazon_id;
thisMove[1] = row;
thisMove[2] = col;
return thisMove;
}
/**
* Return an int array representing where to shoot an arrow
* //int[0] = row of arrow
* //int[1] = column of arrow
*
* @return int[2]
*/
public int[] getArrowMove() {
int[] arrowShot = new int[2];
arrowShot[0] = arrow_row;
arrowShot[1] = arrow_col;
return arrowShot;
}
public int getAmazon_id() {
return amazon_id;
}
public int getRow() {
return row;
}
public int getCol() {
return col;
}
public int getArrow_row() {
return arrow_row;
}
public int getArrow_col() {
return arrow_col;
}
public static class MoveAndBoard {
private final GameBoard newBoard;
private final Move newMove;
public MoveAndBoard(GameBoard board, Move move) {
this.newBoard = board;
this.newMove = move;
}
public String toString() {
String toReturn = "";
toReturn +=
"TestClass2.AI.Move TestClass2.AI.AmazonUnit ID: " + newMove.amazon_id + " to ROW: "
+ newMove.row + "\tCOLUMN: " + newMove.col + "\n";
toReturn +=
"Shot Arrow to ROW: " + newMove.arrow_row + "\tCOLUMN: " + newMove.arrow_col + "\n";
toReturn += "New Board:\n" + newBoard;
return toReturn;
}
public GameBoard getNewBoard() {
return newBoard;
}
public Move getNewMove() {
return newMove;
}
}
}