Newer
Older
Algolike / src / main / java / resources / ResultByDrawingA.java
Shinji on 9 Aug 2022 866 bytes リソース名の変更
package resources;


import java.util.AbstractMap;
import java.util.List;
import java.util.Map;

public class ResultByDrawingA {
    private HandsB handsB;
    private Deck deck;
    private HandsA handsA;
    private Map.Entry<Boolean, Integer> value;

    public ResultByDrawingA(HandsB handsB, Deck deck, HandsA handsA) {
        this.handsB = handsB;
        this.deck = deck;
        this.handsA = handsA;
    }

    public void drawAndAttackA(int target, int guess) {
        this.value = new AbstractMap.SimpleEntry<>((handsB.getValue().get(target).getKey() == guess), target);
        List deck = this.deck.getValue();
        this.handsA.updateSucceedDrawA(value, deck);
        this.handsB.updateSucceedDrawA(value, deck);
        this.deck.updateSucceedDrawA(value);
    }

    public Map.Entry<Boolean, Integer> getValue() {
        return value;
    }
}