public override Tuple<int, int> PerformAction(int action)
{
Debug.Assert(this.IsValidAction(action), "non-valid action used " + action);
this.Action = action;
this.Observation = ONull;
this.Reward = RInvalid;
if (action == AListen && this.sitting)
{
if (Utils.ProbabilisticDecision(this.listen_accuracy))
{
this.Observation = this.tiger;
}
else
{
this.Observation = this.gold;
}
this.Reward = RListen;
}
else if (action == ALeft && !this.sitting)
{
if (this.tiger == OLeft)
{
this.Reward = RTiger;
}
else
{
this.Reward = RGold;
}
this.reset();
}
else if (action == ARight && !this.sitting)
{
if (this.tiger == ORight)
{
this.Reward = RTiger;
}
else
{
this.Reward = RGold;
}
this.reset();
}
else if (action == AStand && this.sitting)
{
this.Reward = this.RStand;
this.sitting = false;
//observation stays null
}
return new Tuple<int, int>(this.Observation, this.Reward);
}