Commit 2f9e6c00 authored by Stefano Cobelli's avatar Stefano Cobelli

Blocker Player update. Mark now includes getOppositeMark()

parent 797aa64c
......@@ -34,4 +34,19 @@ public enum Mark {
public String getSign() {
return this.sign;
}
/**
* gets the opposite mark of the current one. None's opposite is none
*
* @return Mark
*/
public Mark getOppositeMark() {
if (this.sign.equals("X"))
return O;
else if (this.sign.equals("O"))
return X;
else
return NONE;
}
}
......@@ -18,5 +18,4 @@ public interface AutoPlayable {
public int getDecidedRow();
public int getDecidedCol();
}
......@@ -7,10 +7,107 @@
*/
package model.player;
import model.Board;
import model.Mark;
/**
* @author mjt023
*
*/
public class BlockerPlayer {
public class BlockerPlayer extends Player implements AutoPlayable {
/**
* @param theBoard
* @param myMark
*/
public BlockerPlayer(Board theBoard, Mark myMark) {
super(theBoard, myMark);
}
/*
* (non-Javadoc)
*
* @see model.player.AutoPlayable#decideMove()
*/
@Override
public boolean decideMove() {
return false;
}
/*
* (non-Javadoc)
*
* @see model.player.AutoPlayable#getDecidedRow()
*/
@Override
public int getDecidedRow() {
// TODO Auto-generated method stub
return 0;
}
/*
* (non-Javadoc)
*
* @see model.player.AutoPlayable#getDecidedCol()
*/
@Override
public int getDecidedCol() {
// TODO Auto-generated method stub
return 0;
}
/**
* Looks to see if two of the other players marks are in a specified row and
* the spot to block is not taken
*
* @param row
* @return col in spot to block. -1 if can't block
*/
public int findTwoInRow(int row) {
if
}
/**
* Looks to see if two of the other players marks are in a specified col and
* the spot to block is not taken
*
* @param col
* @return row in spot to block. -1 if can't block
*/
public int findTwoInCol(int col) {
}
/**
* Looks to see if two of the other players marks are in the NorthEast
* diagnal. returns the row if there's a spot to block
*
* @return row in spot to block. -1 if can't block
*/
public int findTwoInDiagNE() {
}
/**
* Looks to see if two of the other players marks are in the NorthWest
* diagnal. returns the row if there's a spot to block
*
* @return row in spot to block. -1 if can't block
*/
public int findTwoInDiagNW() {
}
/**
* Checks three marks to see if there's a blocking opertunity
*
* @param mark0
* @param mark1
* @param mark2
* @return the index of the spot to block
*/
public int checkThreeSpots(Mark mark0, Mark mark1, Mark mark2) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment