note
	description: "Summary description for {PERNASTY}."
	author: ""
	date: "$Date$"
	revision: "$Revision$"

class
	PERNASTY

inherit
	GAMEAGENT

create
	make_from_data

feature -- Properties

	agent_name: STRING
	other_decision: BOOLEAN
	total_sentence: INTEGER
	strategy_answers: ARRAY[BOOLEAN]
	current_answer: INTEGER

feature -- Constructors

	make_from_data(the_agent_name: STRING)
		do
			create strategy_answers.make_empty

			agent_name := the_agent_name
			current_answer := 1
			total_sentence := 0

			strategy_answers.force (false, strategy_answers.count + 1)
			strategy_answers.force (false, strategy_answers.count + 1)
			strategy_answers.force (true, strategy_answers.count + 1)
		end

feature -- Methods

	next: BOOLEAN
		local
			my_answer: BOOLEAN
		do
			my_answer := strategy_answers.item (current_answer)

			if current_answer > 2 then
				current_answer := 1
			else
				current_answer := current_answer + 1
			end

			Result := my_answer
		end

	answer_result(other: BOOLEAN)
		do
			other_decision := other
		end

	get_name: STRING
		do
			Result := agent_name
		end

	reset_strategy
		do
			current_answer := 1
		end

	add_to_total_sentence(sentence: INTEGER)
		do
			total_sentence := total_sentence + sentence
		end

	get_total_sentence: INTEGER
		do
			Result := total_sentence
		end

end