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

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

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

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

    public void selectAndAttackB(int attacker, int target, int guess) {
        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;
    }
}