diff --git a/src/main/java/resources/Algo.java b/src/main/java/resources/Algo.java index 96012b4..8d371e0 100644 --- a/src/main/java/resources/Algo.java +++ b/src/main/java/resources/Algo.java @@ -5,6 +5,7 @@ import java.util.Map; import static views.Constants.DECK_COUNT; +import static views.Constants.HAND_COUNT; public class Algo { private LoseB loseB; @@ -32,13 +33,8 @@ succeedSelectB = new SucceedSelectB(handsA, handsB); //追加分 isATurn = true; - deck.reset(DECK_COUNT); - for (int i = 0; i < 2; i++) { - handsA.getValue().add(deck.head()); - handsB.getValue().add(deck.head()); - } - getHandsA().sort(Comparator.comparing(Map.Entry::getKey)); - getHandsB().sort(Comparator.comparing(Map.Entry::getKey)); + deck.init(DECK_COUNT); + } public void inputSelectA(int guess, int attacker, int target) { @@ -94,11 +90,25 @@ } //追加分 + /** + * 各プレイヤーに手札を配るメソッド + */ + public void distributeHands(){ + for (int i = 0; i < HAND_COUNT; i++) { + handsA.getValue().add(deck.head()); + handsB.getValue().add(deck.head()); + } + getHandsA().sort(Comparator.comparing(Map.Entry::getKey)); + getHandsB().sort(Comparator.comparing(Map.Entry::getKey)); + } + public void setDeck(int... param){ + deck.setValue(param); + } public boolean isATurn() { return isATurn; } public void updateTurn() { - isATurn = isATurn ? false : true; + isATurn = !isATurn; } } \ No newline at end of file