Newer
Older
Algolike / src / main / java / models / HandsA.java
package models;

import java.util.*;

public class HandsA {
	private LoseA loseA;
	private List<Map.Entry<Integer, Boolean>> value = new ArrayList<Map.Entry<Integer, Boolean>>();
	public HandsA(LoseA loseA) {
		this.loseA = loseA;
	}
	public void selectA(int guess, int attacker, List<Map.Entry<Integer, Boolean>> b, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if6;
		if ((b.get(target).getKey()==guess)) {
			temp_if6 = this.value;
		} else {
			this.value.set(attacker,new AbstractMap.SimpleEntry<>(this.value.get(attacker).getKey(), true));
			temp_if6 = this.value;
		}
		this.value = temp_if6;
		this.loseA.updateHandsA(value);
	}
	public void drawB(int guess, List<Map.Entry<Integer, Boolean>> a, List<Map.Entry<Integer, Boolean>> d, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if5;
		if ((this.value.get(target).getKey()==guess)) {
			this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true));
			temp_if5 = this.value;
		} else {
			temp_if5 = this.value;
		}
		this.value = temp_if5;
		this.loseA.updateHandsA(value);
	}

	public void drawA(int guess, List<Map.Entry<Integer, Boolean>> b, List<Map.Entry<Integer, Boolean>> d, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if7;
		if ((b.get(target).getKey()==guess)) {
			this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), false));
			this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey));
			temp_if7 = this.value;
		} else {
			this.value.add(0, new AbstractMap.SimpleEntry<>(d.get(0).getKey(), true));
			this.value.sort(Comparator.comparing(Map.Entry<Integer, Boolean>::getKey));
			temp_if7 = this.value;
		}
		this.value = temp_if7;
		this.loseA.updateHandsA(value);
	}
	public void selectB(int guess, int attacker, List<Map.Entry<Integer, Boolean>> a, int target) {
		List<Map.Entry<Integer, Boolean>> temp_if4;
		if ((this.value.get(target).getKey()==guess)) {
			this.value.set(target,new AbstractMap.SimpleEntry<>(this.value.get(target).getKey(), true));
			temp_if4 = this.value;
		} else {
			temp_if4 = this.value;
		}
		this.value = temp_if4;
		this.loseA.updateHandsA(value);
	}
	public List<Map.Entry<Integer, Boolean>> getValue() {
		return value;
	}
}