Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added loner and safe features
  • Loading branch information
Elaine Tsun authored and Elaine Tsun committed Apr 19, 2017
1 parent 03cfde6 commit 143d934
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/CheckersGameState3.java
Expand Up @@ -292,7 +292,21 @@ public class CheckersGameState3 implements CheckersGameState{
//System.out.println("" + mypieces);
return mypieces/total;
}


//features
public boolean isLoner(int pos){
if(this.board[pos-5] == 0 && this.board[pos-4] ==0 && this.board[pos+4] ==0 && this.board[pos+5] ==0){
return true;
}
return false;
}
public boolean isSafe(int pos){
if(this.board[pos%9==4] || this.board[pos%9==3]){
return true;
}
return false;
}

public boolean isTerminal(){
double rat = pieceRatio(this.player);
return (rat == 0 || rat == 1);
Expand Down

0 comments on commit 143d934

Please sign in to comment.