Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added dog and triangle features
  • Loading branch information
Elaine Tsun authored and Elaine Tsun committed Apr 26, 2017
1 parent a5dd019 commit 85d62db
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/CheckersGameState3.java
Expand Up @@ -537,11 +537,32 @@ public class CheckersGameState3 implements CheckersGameState{
}
/* feature: triangle patter*/
public boolean isTriangle(int player){
if(player==2){
if((this.board[33]==2 || this.board[33]==4)
&&(this.board[34]==2 || this.board[34]==4)
&&(this.board[24]==2 || this.board[24]==4))
return true;
}
if(player==1){
if((this.board[0]==1 || this.board[0]==3)
&&(this.board[1]==1 || this.board[1]==3)
&&(this.board[5]==1 || this.board[5]==3))
return true;
}
return false;
}
/* feature: Dog pattern*/
public boolean isDog(int player){

if(player==1){
if((this.board[0]==1 || this.board[0]==3) && (this.board[4]==2||this.board[4]==2)){
return true;
}
}
else if(player==2){
if((this.board[30]==1 || this.board[30]==3) && (this.board[34]==2||this.board[34]==2)){
return true;
}
}
return false;
}
public boolean isTerminal(){
Expand Down

0 comments on commit 85d62db

Please sign in to comment.