Skip to content
Snippets Groups Projects
Commit 9ba7b382 authored by Siyu Lin's avatar Siyu Lin
Browse files

Modified AbstractEvaluator Class and canSatisfy method in OnePairEvaluator

parent abb75435
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
package hw3;
import api.Card;
import api.Hand;
import api.IEvaluator;
/**
......@@ -9,5 +11,16 @@ import api.IEvaluator;
*/
public abstract class AbstractEvaluator implements IEvaluator
{
protected String name;
protected int rank;
//Abstract Methods
public abstract String getName();
public abstract int getRanking();
public abstract int cardsRequired();
public abstract int handSize();
public abstract boolean canSatisfy();
public abstract boolean canSubsetSatisfy(Card[] allCards);
public abstract Hand createHand(Card[] allCards, int[] subset);;
public abstract Hand getBestHand(Card[] allCards);
}
......@@ -73,5 +73,11 @@ public Hand getBestHand(Card[] allCards) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean canSatisfy() {
// TODO Auto-generated method stub
return false;
}
}
......@@ -72,6 +72,12 @@ public Hand getBestHand(Card[] allCards) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean canSatisfy() {
// TODO Auto-generated method stub
return false;
}
}
......@@ -3,6 +3,7 @@ package hw3;
import api.Card;
import api.Hand;
import api.IEvaluator;
import util.SubsetFinder;
/**
* Evaluator for a hand containing (at least) two cards of the same rank.
......@@ -47,7 +48,7 @@ public int getRanking() {
@Override
public int cardsRequired() {
// TODO Auto-generated method stub
return 0;
return 2;
}
@Override
......@@ -58,13 +59,24 @@ public int handSize() {
@Override
public boolean canSatisfy(Card[] mainCards) {
// TODO Auto-generated method stub
if (mainCards.length < this.cardsRequired()){
return false;
}
else{
if (mainCards[0].equals(mainCards[1]))
{
return true;
}
}
return false;
}
@Override
public boolean canSubsetSatisfy(Card[] allCards) {
// TODO Auto-generated method stub
//Find All the Subsets of allCards
//
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment