diff --git a/src/main/java/models/Algo.java b/src/main/java/models/Algo.java index 319ee10..ad3aac8 100644 --- a/src/main/java/models/Algo.java +++ b/src/main/java/models/Algo.java @@ -35,31 +35,6 @@ getHandsA().sort(Comparator.comparing(Map.Entry::getKey)); getHandsB().sort(Comparator.comparing(Map.Entry::getKey)); } - public void drawA(int guess, int target) { - var b=getHandsB(); - var d = getDeck(); - this.handsA.drawA(guess, b, d, target); - this.handsB.drawA(guess, b, d, target); - this.deck.drawA(guess, b, d, target); - } - public void selectA(int guess, int attacker, int target) { - var b=getHandsB(); - this.handsA.selectA(guess, attacker, b, target); - this.handsB.selectA(guess, attacker, b, target); - } - public void drawB(int guess, int target) { - var a=getHandsA(); - var d = getDeck(); - - this.handsB.drawB(guess, a, d, target); - this.handsA.drawB(guess, a, d, target); - this.deck.drawB(guess, a, d, target); - } - public void selectB(int guess, int attacker, int target) { - var a=getHandsA(); - this.handsB.selectB(guess, attacker, a, target); - this.handsA.selectB(guess, attacker, a, target); - } public void inputSelectA(int guess, int attacker, int target) { this.succeedSelectA.inputSelectA(guess, attacker, target); } diff --git a/src/main/java/models/Deck.java b/src/main/java/models/Deck.java index c61c677..ef2441e 100644 --- a/src/main/java/models/Deck.java +++ b/src/main/java/models/Deck.java @@ -6,13 +6,6 @@ private Map.Entry succeedDrawB; private Map.Entry succeedDrawA; private List> value = new ArrayList<>(); - public void drawB(int guess, List> a, List> d, int target) { - this.value = this.value.subList(1, this.value.size()); - } - - public void drawA(int guess, List> b, List> d, int target) { - this.value = this.value.subList(1, this.value.size()); - } //added public void reset(int num){ for(int i=0;i> b, int target) { - List> temp_if6; - if ((b.get(target).getKey()==guess)) { - temp_if6 = this.value; - } else { - this.value.set(attacker,new AbstractMap.SimpleEntry<>(this.value.get(attacker).getKey(), true)); - temp_if6 = this.value; - } - this.value = temp_if6; - this.loseA.updateHandsA(value); - } - public void drawB(int guess, List> a, List> d, int target) { - List> temp_if5; - if ((this.value.get(target).getKey()==guess)) { - this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); - temp_if5 = this.value; - } else { - temp_if5 = this.value; - } - this.value = temp_if5; - this.loseA.updateHandsA(value); - } - - public void drawA(int guess, List> b, List> d, int target) { - List> temp_if7; - if ((b.get(target).getKey()==guess)) { - this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), false)); - this.value.sort(Comparator.comparing(Map.Entry::getKey)); - temp_if7 = this.value; - } else { - this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), true)); - this.value.sort(Comparator.comparing(Map.Entry::getKey)); - temp_if7 = this.value; - } - this.value = temp_if7; - this.loseA.updateHandsA(value); - } - public void selectB(int guess, int attacker, List> a, int target) { - List> temp_if4; - if ((this.value.get(target).getKey()==guess)) { - this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); - temp_if4 = this.value; - } else { - temp_if4 = this.value; - } - this.value = temp_if4; - this.loseA.updateHandsA(value); - } public List> getValue() { return value; } diff --git a/src/main/java/models/HandsB.java b/src/main/java/models/HandsB.java index 71745ed..0593382 100644 --- a/src/main/java/models/HandsB.java +++ b/src/main/java/models/HandsB.java @@ -12,55 +12,6 @@ public HandsB(LoseB loseB) { this.loseB = loseB; } - public void selectA(int guess, int attacker, List> b, int target) { - List> temp_if2; - if ((this.value.get(target).getKey()==guess)) { - this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); - temp_if2 = this.value; - } else { - temp_if2 = this.value; - } - this.value = temp_if2; - this.loseB.updateHandsB(value); - } - - public void drawB(int guess, List> a, List> d, int target) { - List> temp_if1; - if ((a.get(target).getKey()==guess)) { - this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), false)); - this.value.sort(Comparator.comparing(Map.Entry::getKey)); - temp_if1 = this.value; - } else { - this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), true)); - this.value.sort(Comparator.comparing(Map.Entry::getKey)); - temp_if1 = this.value; - } - this.value = temp_if1; - this.loseB.updateHandsB(value); - } - public void drawA(int guess, List> b, List> d, int target) { - List> temp_if3; - if ((this.value.get(target).getKey()==guess)) { - this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true)); - temp_if3 = this.value; - } else { - temp_if3 = this.value; - } - this.value = temp_if3; - this.loseB.updateHandsB(value); - } - - public void selectB(int guess, int attacker, List> a, int target) { - List> temp_if0; - if ((a.get(target).getKey()==guess)) { - temp_if0 = this.value; - } else { - this.value.set(attacker,new AbstractMap.SimpleEntry<>(this.value.get(attacker).getKey(), true)); - temp_if0 = this.value; - } - this.value = temp_if0; - this.loseB.updateHandsB(value); - } public List> getValue() { return value; } diff --git a/src/test/java/AlgoTest.java b/src/test/java/AlgoTest.java index a24b052..7d6c2c2 100644 --- a/src/test/java/AlgoTest.java +++ b/src/test/java/AlgoTest.java @@ -130,12 +130,13 @@ printViewA(algo); //Aはカードを1枚引き,アタックを成功させる. //Bはアタックされたカードを表にする. - algo.drawA(guess, target); + + algo.inputDrawA(guess, target); printViewA(algo); //Bはカードを1枚引き,アタックが失敗する. //Bはアタックに使用したカードを表にする. - algo.drawB(guess,target); + algo.inputDrawB(guess,target); printViewA(algo); int tar=0, gue=0; @@ -148,7 +149,8 @@ } //Aはカードを1枚引き,アタックを成功させる. //Bは全てのカードが表になるので,ゲームが終了する - algo.drawA(gue, tar); + + algo.inputDrawA(gue, tar); printViewA(algo); }