Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MPlayer extends GomokuPlayer {
- public Color[][] board;
- public Color myPlayer;
- public Color enemyPlayer;
- public int row;
- public int col;
- public int moveRow = 1;
- public int moveCol = 1;
- public int previousRow;
- public int previousCol;
- public Move chooseMove(Color[][] board, Color me) {
- this.myPlayer = me;
- if (me == Color.WHITE){
- attackCont attack = new attackCont();
- attack.findEmptySlot();
- previousRow=attack.moveRow;
- previousCol=attack.moveCol;
- System.out.println(previousRow + " " + previousCol);
- return new Move(attack.moveRow,attack.moveCol);
- }
- else{
- attackCont attack3 = new attackCont();
- attack3.findEmptySlot();
- previousRow=attack3.moveRow;
- previousCol=attack3.moveCol;
- return new Move(attack3.moveRow,attack3.moveCol);
- }
- }
- public class attackCont{
- public int moveRow;
- public int moveCol;
- //attack cont attacks as many times as we pass value. How do I make this work? x.x
- public attackCont() {
- // if I wanna know the previous move it's previousCol peeviousRow
- moveRow=0;
- moveCol=0;
- }
- public void findEmptySlot(){
- for (moveRow = 0; moveRow < GomokuBoard.ROWS; moveRow++)
- for (moveCol = 0; moveCol < GomokuBoard.COLS; moveCol++)
- if (board[moveRow][moveCol] == null)
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement