-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestPlayer.java
40 lines (30 loc) · 1.08 KB
/
TestPlayer.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
39
40
package tictactoe.game;
public class TestPlayer implements Testable {
public Player[] createInstances() {
Player firstX = new HumanPlayer(1,'X');
Player secondO = new HumanPlayer(false,'O');
Player anti_firstX = new HumanPlayer(firstX);
Player cpuFirstXeasy = new ComputerPlayer(1,'X',1);
Player cpuFirstXmed = new ComputerPlayer(1,'X',2);
Player cpuFirstXhard = new ComputerPlayer(1,'X',3);
Player[] instances = {firstX, secondO, anti_firstX, cpuFirstXeasy, cpuFirstXmed, cpuFirstXhard};
return instances;
}
public void checkFields(Player somePlayer) {
System.out.println("Priority:");
System.out.println(somePlayer.getTurn());
System.out.println("Mark:");
System.out.println(somePlayer.getPlayerMark());
}
public void testInstances(Player[] instances) {
for (Player p : instances) {
this.checkFields(p);
}
System.out.println("Instances tested.");
}
public void runTests() {
Player[] players = this.createInstances();
this.testInstances(players);
}
}
//TODO: write more/better player tests. wtf do these even do?