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

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

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

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

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

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