Newer
Older
Algolike / src / main / java / resources / SucceedSelectA.java
Shinji on 9 Aug 2022 776 bytes コードの整形
package resources;

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

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

    public SucceedSelectA(HandsB handsB, HandsA handsA) {
        this.handsB = handsB;
        this.handsA = handsA;
    }

    public void inputSelectA(int guess, int attacker, int target) {
        this.value = new AbstractMap.SimpleEntry<>((handsB.getValue().get(target).getKey() == guess), new AbstractMap.SimpleEntry<>(target, attacker));
        this.handsA.updateSucceedSelectA(value);
        this.handsB.updateSucceedSelectA(value);
    }

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