Add comments
Inline State::compute_hash()
Reorder definitions
Inherit from std::exception
Implement input validation
Update user output
Change word steps to cost

Cost is more generic term and makes sense for problems
whose cost is not an integer.
Update to match C++ impl