package resources;
import java.util.*;
public class Deck {
private Map.Entry<Boolean, Integer> succeedDrawB;
private Map.Entry<Boolean, Integer> succeedDrawA;
private List<Map.Entry<Integer, Boolean>> value = new ArrayList<>();
//added
public void init(int num) {
for (int i = 0; i < num; i++) {
this.value.add(new AbstractMap.SimpleEntry<>(i, false));
}
Collections.shuffle(this.value);
}
public void setValue(int... params){
this.value.clear();
for (int i = 0; i < params.length; i++){
this.value.add(new AbstractMap.SimpleEntry<>(i, false));
}
}
//added
public Map.Entry<Integer, Boolean> head() {
Map.Entry<Integer, Boolean> card = getValue().get(0);
getValue().remove(getValue().get(0));
return card;
}
public List<Map.Entry<Integer, Boolean>> getValue() {
return value;
}
public void updateSucceedDrawB(Map.Entry<Boolean, Integer> succeedDrawB) {
this.succeedDrawB = succeedDrawB;
value = this.value.subList(1, this.value.size());
}
public void updateSucceedDrawA(Map.Entry<Boolean, Integer> succeedDrawA) {
this.succeedDrawA = succeedDrawA;
value = this.value.subList(1, this.value.size());
}
}