completed initial implementation of value iteration. still buggy due to errors with Rational