//***********************************************************
//*
//* File:           DumbPlayer.java
//* Author:         Abhinav Kamra
//* Contact:        kamra-at-cs.columbia.edu
//* Update:         10.16.2003
//*
//* Description:    DumbPlayer
//*
//***********************************************************

package Organisms2.g0;

import Organisms2.*;
import java.util.*;
import java.io.*;
import java.awt.Color;

public final class DumbPlayer implements IFCPlayer {

	Organisms2    _amoeba;
	static final String _CNAME = "I am Dumb !!";
	static final Color _CColor = new Color(1.0f, 0.67f, 0.67f);
	int state;
	Random rand;


	public void register(Organisms2 __amoeba, int key) throws Exception
	{
		rand = new Random();
		state = rand.nextInt(256);
	}

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

	public Color color() throws Exception {
		return _CColor;
	}

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

	public int externalState() throws Exception {
		return state;
	}

	public Move move(boolean[] foodpresent, int[] enemies, int foodleft, int energyleft) throws Exception {
		int type = rand.nextInt(_CDIRECTIONS.length + 1);
		if(type == _CREPRODUCE)
		{
			type = rand.nextInt(_CDIRECTIONS.length - 1);
			return new Move(_CREPRODUCE, 1 + type, state);
		}
		else
			return new Move(type);
	}

}
