Newer
Older
Algolike / src / main / java / controls / StepScheduler.java
Shinji on 15 Jun 2022 1 KB ・GUIを設置
package controls;

import interfaces.IAttack;
import models.Algo;
import views.Constants;

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

public class StepScheduler implements IAttack {
    Algo algo;
    int turnCount=0;
    boolean isATurn;
    public StepScheduler(){
        algo = new Algo();
        isATurn=true;
    }

    public Constants.Step getStep(){
        return null;
    }

    @Override
    public void Attack(int guess, int attacker, int target) {
        if(isATurn){
            if(isDeckLess()){
                algo.selectA(guess, attacker, target);
            }else{
                algo.drawA(guess, target);
            }
        }else {
            if(isDeckLess()){
                algo.selectB(guess, attacker, target);
            }else{
                algo.drawB(guess, target);
            }
        }
        turnCount++;
    }

    @Override
    public List<Map.Entry<Integer, Boolean>> getMyHands() {
        return isATurn?algo.getHandsA():algo.getHandsB();
    }

    @Override
    public List<Map.Entry<Integer, Boolean>> getOpponentHands() {
        return isATurn?algo.getHandsB():algo.getHandsA();
    }

    @Override
    public Map.Entry<Integer, Boolean> getTopCard() {
        return null;
    }

    public boolean isDeckLess(){
        return algo.getDeck().size()==0;
    }
    public boolean getIsATurn(){
        return isATurn;
    }
}