package edu.calpoly.csc480.Wumpus.Agent;

import edu.calpoly.csc480.Wumpus.Tile.*;

public class Percept
{
	public static final int
	 bump = 0,  scream = 1, stench = 2, breeze = 3, glitter = 4,
	 numPercepts = 5;

	public Percept() {
		percepts = new boolean[numPercepts];

		clear();
	}

	public final String toString() {
		final String none = "None", hill = ",";

		String string = "[";

		string = string + (percepts[stench]  ? "Stench"  : none) + hill;
		string = string + (percepts[breeze]  ? "Breeze"  : none) + hill;
		string = string + (percepts[glitter] ? "Glitter" : none) + hill;
		string = string + (percepts[bump]    ? "Bump"    : none) + hill;
		string = string + (percepts[scream]  ? "Scream"  : none);

		return string + "]";
	}

	public final boolean is(int type)		{return percepts[type];}

	public void set(int type, boolean truth) {
		percepts[type] = truth;
	}

	public void clear() {
		for (int percept = 0; percept < percepts.length; percept++) {
			percepts[percept] = false;
		}
	}

	public void update(Tile tile) {
		percepts[glitter] = tile.has(Tile.gold);
		percepts[stench]  = tile.has(Tile.stench);
		percepts[breeze]  = tile.has(Tile.breeze);
	}
/*
	public void employ(Tile tile) {
		tile.set(Tile.gold, glitter);
		tile.set(Tile.stench, stench);
		tile.set(Tile.breeze, breeze);
	}
*/
	protected boolean percepts[];
}