From 9ba7b382f0771cbc9bd9f34dc3ac7a48a19564a4 Mon Sep 17 00:00:00 2001 From: Siyu Lin <siyul@iastate.edu> Date: Mon, 21 Apr 2014 19:47:37 -0500 Subject: [PATCH] Modified AbstractEvaluator Class and canSatisfy method in OnePairEvaluator --- homework/bin/hw3/AbstractEvaluator.class | Bin 306 -> 640 bytes homework/bin/hw3/AllPrimesEvaluator.class | Bin 1112 -> 1176 bytes homework/bin/hw3/CatchAllEvaluator.class | Bin 1109 -> 1173 bytes homework/bin/hw3/OnePairEvaluator.class | Bin 1198 -> 1332 bytes homework/src/hw3/AbstractEvaluator.java | 13 +++++++++++++ homework/src/hw3/AllPrimesEvaluator.java | 6 ++++++ homework/src/hw3/CatchAllEvaluator.java | 6 ++++++ homework/src/hw3/OnePairEvaluator.java | 16 ++++++++++++++-- 8 files changed, 39 insertions(+), 2 deletions(-) diff --git a/homework/bin/hw3/AbstractEvaluator.class b/homework/bin/hw3/AbstractEvaluator.class index c7426a8c1022d40612c253684dd2d163856d2000..e292ec7e11988b11ad7de8cf051df84fe42226ed 100644 GIT binary patch literal 640 zcmZvZyH3ME5Jm3>6N3pMJj454Bow%y1R((e5h((RAPT6)&XQ~h4y@N8_$w+T3O<03 zLX4M)hoJD>-I=57tJ$~rmsbEASap#R7;oNh_&Y&tG=*mWj@k*Cj&|V)6k2pgew(6( ze;l-AXk26k@^qv8$`>i%M070$MylU<&1e-hHhHEgx)Kl-f$Wxwl-U;ODV5K7ve&6g z4?P&lVE{RSp{k1HQF0wfeM&*wI(9;8pOIGSz1wt5Q^f+s>c6@9mu^FvBb#WfRQ@lM z$G{24;)FH~XB!Mj*W(j;n<y>o0)0)2>NWMqA-s^H8W|N|K3Mvk_mZ}fAeQE9kS|?S z)4lAm&t{n!FVvEZJY*k%sh`t}O4*|6h~o}$nq3*2PqO%v{Ka{-PNGA3pwi7u{CTkT zbotH_I3s_($iRV%K7MEi{qR`(xzCH{I><MlRj~H1JtP0bhYSi_v$mPTFrQPD0gPaj mT?EE3Zgm1htCL-w>gqIRY=0JWR_C!`brDPKBe2XhgOv}NV2-!| delta 131 zcmZo*-NeLo>ff$?3=9m$3_=sR+~wG8GV?M^>=+rCH8jH*8Cab2Q&PDYm>IZv7}yy& zCQkF3yq!_si-Ca=2!R4Xk`t&|AIxW9VAa~rz_k%5z{J1<B-wz%3=CWhyg-r%%w}ca QW8eq!7#ReBBol)m00UVM`~Uy| diff --git a/homework/bin/hw3/AllPrimesEvaluator.class b/homework/bin/hw3/AllPrimesEvaluator.class index 1643a26844226170b00b6fd2c88f8a89e61ce898..8d807dddf854dc56d3d4ed24e64033720172b5d5 100644 GIT binary patch delta 72 zcmcb?F@uxq)W2Q(7#J9g8Pqm%?O|kL*3gWae1y@6k!$mJ#waFcaR%i{%!;xB3_L(Z VJPeFLl8J$rfe%PCGN^!gssNiK49x%l delta 38 tcmbQid4q%N)W2Q(7#J9g8B{lN?O~jJhS7kLbMs%uC?<AgpfD4I3IP8W3X=c; diff --git a/homework/bin/hw3/CatchAllEvaluator.class b/homework/bin/hw3/CatchAllEvaluator.class index 98fed3450459990cd14a89ee4f64888264cf9cb4..037a308aee912faeef6747a9a0ebdae25c27bb22 100644 GIT binary patch delta 57 zcmcc0F_n|+)W2Q(7#J9g8Pqm%?P6qM*3gWae2CGIk!$l8#waFcaR%kdf0+~+{U;YP NiL$EzRWdQC0s!~J4vGK( delta 38 tcmbQrd6k3f)W2Q(7#J9g8B{lN?P8pKicz1DbMr68C?<AgpfD4I3IP4K3WWdw diff --git a/homework/bin/hw3/OnePairEvaluator.class b/homework/bin/hw3/OnePairEvaluator.class index 8df69c65286bea5f5d87a8652a893ec5f6d75567..22d73a645a06b178277d83bbfbfb2655b40e6201 100644 GIT binary patch delta 412 zcmZXPxl0345XQgRw;RpoD1td8Xbz9WtZ_AJKnyA>*m!}Wjm=Apk{BdvVryw-^(rgD zItYTKut;U)-(xM#ZV&{UnR#>kzVE$w-%RuK`@IKX9>rI4pVmwe(teC$#Kbrz2QWbx zl+BvGA+JyU$RJDbRIl2yaYG1ax9jp&+6{SmZts=r)k;epQz95RXvxaOj%*&va-*tR z^c9FhM*?0X5ky+GwOz`n53NLbMIswAI&4A15JwLiU^{AAlxT^EVf7%)yBY+~fw<Mn zb&-08Av%^QSbCw0u}2tsM>q)KA|f!jUSYLW_^^&BHZhDXgt;5(V>n0o#Xw9U$C4J; zIy7H^>uGjL@N=ig*^yOGBBbv1m@n@x6J}tmn4ZcXxzHpFJN|#68v1)qZx(YL2?hSs SnV!m={IT)>g0SF{7JmSBaX9(_ delta 184 zcmdnOwT_eP)W2Q(7#J9g8FV*t1u#yY%P2GXB;zMuDFzk>IR;J!c?LcP#mOg_{20|H zi!<9W>P!w{)(~P|1JuIAAOa-W7#M-1(d0g$q{ZaZ%<_{HS)>^4CiAh1b1E_@0c9B( zlqW~9C^Nc%#JE+UVyX;kljpH0GI~uuz#=XR5e1p4&Y%G#85uMgv?jk{QJh@OBEb*S JqYbuI2LO5|A4~uM diff --git a/homework/src/hw3/AbstractEvaluator.java b/homework/src/hw3/AbstractEvaluator.java index bbea238..7787c36 100644 --- a/homework/src/hw3/AbstractEvaluator.java +++ b/homework/src/hw3/AbstractEvaluator.java @@ -1,4 +1,6 @@ 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); + } diff --git a/homework/src/hw3/AllPrimesEvaluator.java b/homework/src/hw3/AllPrimesEvaluator.java index fa712c1..ed70ab4 100644 --- a/homework/src/hw3/AllPrimesEvaluator.java +++ b/homework/src/hw3/AllPrimesEvaluator.java @@ -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; +} } diff --git a/homework/src/hw3/CatchAllEvaluator.java b/homework/src/hw3/CatchAllEvaluator.java index 8394b5f..0551a95 100644 --- a/homework/src/hw3/CatchAllEvaluator.java +++ b/homework/src/hw3/CatchAllEvaluator.java @@ -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; +} } diff --git a/homework/src/hw3/OnePairEvaluator.java b/homework/src/hw3/OnePairEvaluator.java index c3cc621..8344c75 100644 --- a/homework/src/hw3/OnePairEvaluator.java +++ b/homework/src/hw3/OnePairEvaluator.java @@ -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; } -- GitLab