Add a goal function to the world
This commit is contained in:
parent
c8080e8bc2
commit
873d622d25
6
world.py
6
world.py
|
@ -306,6 +306,12 @@ class World:
|
||||||
|
|
||||||
return estimated_speed * total_flat_distance
|
return estimated_speed * total_flat_distance
|
||||||
|
|
||||||
|
def goal(self, p: Point) -> bool:
|
||||||
|
"""
|
||||||
|
Equivalent to `p == world.finish`
|
||||||
|
"""
|
||||||
|
return p == self.finish
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
Loading…
Reference in New Issue