-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.java
40 lines (31 loc) · 1.37 KB
/
player.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 student_player;
import hus.HusBoardState;
import hus.HusPlayer;
import student_player.mytools.MyTools;
import hus.HusMove;
import java.util.ArrayList;
//import student_player.mytools.MyTools;
/** A Hus player submitted by a student. */
public class StudentPlayer extends HusPlayer {
/** You must modify this constructor to return your student number.
* This is important, because this is what the code that runs the
* competition uses to associate you with your agent.
* The constructor should do nothing else. */
public StudentPlayer() { super("260588566"); }
/** This is the primary method that you need to implement.
* The ``board_state`` object contains the current state of the game,
* which your agent can use to make decisions. See the class hus.RandomHusPlayer
* for another example agent. */
public HusMove chooseMove(HusBoardState board_state)
{
//an odd level seems to work in my favor
int level = 7;
int alpha = Integer.MIN_VALUE;
int beta = Integer.MAX_VALUE;
// Get the legal moves for the current board state.
ArrayList<HusMove> moves = board_state.getLegalMoves();
//get the index of the best legal move
HusMove bestMove = moves.get(MyTools.search(level,player_id,opponent_id,alpha,beta,board_state)[1]);
return bestMove;
}
}