package gp;

public class DummyGPIndividual extends GPTree implements InterfaceIndividual {
	static int maxHeight = 5;
	// dont start with full height to allow for smaller trees. theyll grow by
	// themselves.
	static int initHeight = 3;
	static int modeCreate = MODE_GROW;
	static int modeMutate = MODE_GROW;

	// /// The constructors will just call GPTree
	public DummyGPIndividual(int h, int mode) {
		super(null, h, mode);
	}

	public DummyGPIndividual(DummyGPIndividual y) {
		super(y);
	}

	public DummyGPIndividual(DummyGPIndividual parent, int h, int mode) {
		super(parent, h, mode);
	}

	// /// The following methods might look very similar in any implementation
	@Override
	public DummyGPIndividual clone() {
		return new DummyGPIndividual(this);
	}

	@Override
	public DummyGPIndividual makeRandomSubtree(int h, int mode) {
		// ja da habt ihr ne nette endlosschleife programmiert

		return new DummyGPIndividual(this, h - 1, mode);

	}

	@Override
	public DummyGPIndividual copyTree(GPTree tree) {
		return new DummyGPIndividual((DummyGPIndividual) tree);
	}

	@Override
	public void crossover(InterfaceIndividual y) {
		super.crossover((DummyGPIndividual) y, maxHeight);
	}

	@Override
	public void mutate(double pMut) {
		super.mutate(pMut, maxHeight, modeMutate);
	}

	public double distanceTo(InterfaceIndividual b) {
		// not implemented
		return 0;
	}

	@Override
	public String getStringRepresentation() {
		return super.toString();
	}

	@Override
	public void defaultInit() {
		initRandomTree(null, initHeight, modeCreate);
	}

	// ///// the following methods are problem specific, just dummies here
	@Override
	public int getBinaryCount() {
		return 1;
	}

	@Override
	public String getBinarySymbol(int i) {
		return "o";
	}

	@Override
	public int getTermCount() {
		return 1;
	}

	@Override
	public String getTermSymbol(int i) {
		return ".";
	}

	@Override
	public int getUnaryCount() {
		return 1;
	}

	@Override
	public String getUnarySymbol(int i) {
		return "-";
	}

	@Override
	public double evaluate() {
		// what should a fit dummy look like?
		return Math.pow(2, 1 + maxHeight) - nodeCount;
	}

	@Override
	public double evalTreeAt(Object o) {
		// TODO Auto-generated method stub
		return 0;
	}

}
