Fix various bugs involving plans and hypotheses

When getting a command and sensor value from a plan, the agent
was using the same episode when it should have been using
different ones. When adding episodes to a plan, 0 would be used
when the goal state was reached, but because of the magic reset
this should have been 1. These and other issues were fixed and now
the agent is actually attempting to merge states.