//***********************************************************
//*
//* File:           DumbPlayer.java
//* Author:         Abhinav Kamra
//* Contact:        kamra-at-cs.columbia.edu
//* Update:         9.18.2003
//*
//* Description:    Sample implementation of a CookieCutter
//*                 player.  Purely didactic.
//*
//***********************************************************

package CookieCutter.g0;

import CookieCutter.*;
import java.io.Serializable;
import java.util.*;

public class DumbPlayer implements IFCPlayer {

    CookieCutter           _cookiecutter;
    Vertex[][]		   _cookies;
    int			   _copies;
    static Random       _random;
    static final String _CNAME = "Dumb Player";

    public void register(CookieCutter __cookiecutter) throws Exception {
        _cookiecutter = __cookiecutter;
	_cookies = _cookiecutter.cookieshapes();
	_copies = _cookiecutter.cookieCopies();
    }

    public String name() throws Exception {
        return _CNAME;
    }

    public boolean interactive() throws Exception {
        return false;
    }

    public Move[] moves() throws Exception {

	_random = new Random();
        Move[] RET = new Move[_cookies.length];
        for (int i=0; i < _cookies.length; i++) {
		RET[i] = new Move(_copies);
		for(int j=0;j < _copies;j++)
		{
			double angle = _random.nextDouble();
			double pos = _random.nextDouble();
			RET[i].setCookiePosition(j, new Vertex(j + pos, 0.5), angle);
		}
		RET[i].setRightBoundary(_copies);
        }
        return RET;
    }
}
