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

import jp.ac.nii.icpc2010.playfield.FieldDirection;
import jp.ac.nii.icpc2010.playfield.IPlayField;
import jp.ac.nii.icpc2010.playfield.RefPlayField;

public class RandomPlayer extends BasePlayer
{
	public RandomPlayer(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;
		}

		int dir = (int) (Math.random() * safeDirs.size());

		prev_dir = safeDirs.get(dir);
		return prev_dir;	  
    }
}