package jp.ac.nii.icpc2010.players;
import java.util.ArrayList;
import java.util.List;

import jp.ac.nii.icpc2010.players.BasePlayer;
import jp.ac.nii.icpc2010.playfield.FieldDirection;
import jp.ac.nii.icpc2010.playfield.IPlayField;

/**
 * Template for your player
 * 
 * @author yukino
 *
 */

public class YourOwnPlayer extends BasePlayer
{
	public YourOwnPlayer(int id, IPlayField playField) {
		super(id, playField);
		// TODO Auto-generated constructor stub
	}

	FieldDirection prev_dir;

	public FieldDirection getInput()
	{
		int curx = getX();
		int cury = getY();
		
		List<FieldDirection> safeDirs = getSafeDirs(curx, cury);
		
		if (safeDirs.isEmpty())
		{
			//give up
			return prev_dir;
		}
		
		// Fill in your code here
		// For now, choose a one of the legal directions
		FieldDirection decision = safeDirs.get(0);
		
		prev_dir = decision;
		return decision;
	}
}