Fix bugs with choosing actions and saving best path.

Fix bug where sensors were being compared to the wrong value, thus
causing the algorithm to never save the best path. Also change
method of choosing which action to take. Previously, the algorithm
would choose the first unknown action. This is a problem when
the algorithm gets into states in the state machine where a takes
them into the same state. The algorithm will repeatedly think it's
now in a new state and take action a, and it will get stuck there.
Now, the agent will choose a random unknown action instead of the
first unknown.