jeudi 4 décembre 2014

I'm not sure what the error is here


Vote count:

0




While working on my java card game, I'm not getting detections for "Flushes". The other detectors in the method work, but the flush one doesn't, even if I set the suit array to just one suit. I debugged it by printing out the values of the cs1, cs2, fs1, fs2 and fs3. When all the suits match, even character for character, it still doesn't detect a flush. I've tried .eqauls(), .contains(), and .matches(), and nothing is working. Here's the snippet.



if(cs1 == cs2 && cs2 == fs1 && fs1 == fs2 && fs2 == fs3) {
predictor = "Flush";
stop = true;


And here's the detector method (as you can see one of the if statements is still under construction)



public static void handclassifier() {
while(!stop) {
if(cs1 == cs2 && cs2 == fs1 && fs1 == fs2 && fs2 == fs3) {
predictor = "Flush";
stop = true;
}
if(cv1.equals(cv2) || cv1.equals(fv2) || cv1.equals(fv2) || cv1.equals(fv3) || cv2.equals(fv1) || cv2.equals(fv2) || cv2.equals(fv3) || fv1.equals(fv2)|| fv1.equals(fv3) || fv2.equals(fv3)) {
if(cv1.equals(cv2) && cv1.equals(fv1) || cv1.equals(cv2) && cv1.equals(fv2) || cv1.equals(cv2) && cv1.equals(fv3) || cv1.equals(fv1) && cv1.equals(fv2) || cv1.equals(fv2) && cv1.equals(fv3) || cv2.equals(fv1) && fv1.equals(fv2) || cv2.equals(fv2) && fv2.equals(fv3) || fv1.equals(fv2) && fv2.equals(fv3)) {
if(cv1.equals(cv2) && cv2.equals(fv1) && fv1.equals(fv2) || cv1.equals(cv2) && cv2.equals(fv1) && fv1.equals(fv3) || cv1.equals(cv2) && cv2.equals(fv2) && fv2.equals(fv3) || cv1.equals(fv1) && fv1.equals(fv2) && fv2.equals(fv3) || cv2.equals(fv1) && cv2.equals(fv2) && cv2.equals(fv3)) {
predictor = "Four of a Kind";
stop = true;
}
else if(cv1.equals(cv2) && fv1.equals(fv2) && fv2.equals(fv3) && cv1 != fv1 && cv1 != fv2 && cv1 != fv3 && cv2 != fv1 && cv2 != fv2 && cv2 != fv3 || cv1.equals(fv1)) {
predictor = "Full House";
stop = true;
}
predictor = "Three of a Kind";
stop = true;
}
predictor = "Pair";
stop = true;
}
else {
predictor = "High Card";
stop = true;
}
}
}


I'm sorry to be a bother if this has been answered before but I haven't seen anything relating to this, and seeing as the other detectors in the method are working, I find it odd.



asked 37 secs ago







I'm not sure what the error is here

Aucun commentaire:

Enregistrer un commentaire