package teamXXX;

import battlecode.common.*;

public abstract class BasePlayer implements Runnable {

	protected final RobotController rc;
		
	protected final PriorityQueue<Goal> myGoals;
	
	public BasePlayer(RobotController rc) {
		this.rc = rc;
		myGoals = new PriorityQueue<Goal>();
	}

	public final void run() {
		
		initialize();
		addInitialGoals();
				
		while (true) {
			
			try{
				
				updateGoals(myGoals);
				Goal highestPriorityGoal = goals.peek();
				highestPriorityGoal.execute();
			
			}catch(Exception e) {
				System.out.println(e.getMessage());
			}
		}
	}
	
	protected abstract void initialize();
		
	protected abstract void addInitialGoals();

	public RobotController getRobotController() {
		return this.rc;
	}
	
}
