diff --git a/Cribbage/out/production/Cribbage/cribbage/Cribbage$Segment.class b/Cribbage/out/production/Cribbage/cribbage/Cribbage$Segment.class index f41e54cfa506cd10ebc9ff5f807d5070ec43c975..5a2965ca812f41e99eec7ce96155f3c1d34ce74b 100644 Binary files a/Cribbage/out/production/Cribbage/cribbage/Cribbage$Segment.class and b/Cribbage/out/production/Cribbage/cribbage/Cribbage$Segment.class differ diff --git a/Cribbage/out/production/Cribbage/cribbage/Cribbage.class b/Cribbage/out/production/Cribbage/cribbage/Cribbage.class index 6c70f9e298f56a3fb038383ee51473a682db7d22..78be1a1aaea6ed10f031399e606d4aa7fe4353c4 100644 Binary files a/Cribbage/out/production/Cribbage/cribbage/Cribbage.class and b/Cribbage/out/production/Cribbage/cribbage/Cribbage.class differ diff --git a/Cribbage/out/production/Cribbage/cribbage/starterJack.class b/Cribbage/out/production/Cribbage/cribbage/starterJack.class new file mode 100644 index 0000000000000000000000000000000000000000..6d92ac50eb8715b0ff53708c2924e561d172e0c7 Binary files /dev/null and b/Cribbage/out/production/Cribbage/cribbage/starterJack.class differ diff --git a/Cribbage/src/cribbage/Cribbage.java b/Cribbage/src/cribbage/Cribbage.java index d65dd4bb11077d083e6034948edb80ab3525cb59..d395e1c83ebcac3dcc012725f7ec8fb11ca4330d 100644 --- a/Cribbage/src/cribbage/Cribbage.java +++ b/Cribbage/src/cribbage/Cribbage.java @@ -225,6 +225,14 @@ private void starter(Hand pack) { dealt.setVerso(false); log.writeLog("starter," + canonical(dealt)); transfer(dealt, starter); + + HandCards starterCard = new CribbageHandCards(); + modifyStarter(starterCard); + starterCard.setPlayer(1); + starterCard.setScore(scores[1]); + starterCard.sendHandCards(starter, starter, deck); + scores[1] = starterCard.scoreHandCards(); + updateScore(1); } int total(Hand hand) { @@ -358,13 +366,15 @@ void modifyShow(HandCards playersHandCards){ } void modifyPlay(HandCards playersHandCards){ - Rule playsss = new playTotal(); - playersHandCards.addRule(new playTotal()); playersHandCards.addRule(new playRuns()); playersHandCards.addRule(new playPairs()); } +void modifyStarter(HandCards playersHandCards){ + playersHandCards.addRule(new starterJack()); +} + public Cribbage() { super(850, 700, 30); diff --git a/Cribbage/src/cribbage/starterJack.java b/Cribbage/src/cribbage/starterJack.java new file mode 100644 index 0000000000000000000000000000000000000000..7402433dac68f95b68615d73bcc6305f5f88dee9 --- /dev/null +++ b/Cribbage/src/cribbage/starterJack.java @@ -0,0 +1,26 @@ +package cribbage; + +import ch.aplu.jcardgame.Card; +import ch.aplu.jcardgame.Deck; +import ch.aplu.jcardgame.Hand; + +public class starterJack implements Rule{ + + Card starter; + + public starterJack(){} + + @Override + public void receiveHandCards(Hand hand, Hand starter, Deck deck){ + this.starter = starter.get(0); + } + + @Override + public int calculateScore(int playerId, int currentScore){ + int score = 0; + if (((Cribbage.Rank) starter.getRank()).order == 11){ + score += 2; + } + return score; + } +}