Add a goal function to the world

This commit is contained in:
Emi Simpson 2023-02-11 12:20:53 -05:00
parent c8080e8bc2
commit 873d622d25
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847

View file

@ -306,6 +306,12 @@ class World:
return estimated_speed * total_flat_distance
def goal(self, p: Point) -> bool:
"""
Equivalent to `p == world.finish`
"""
return p == self.finish
if __name__ == '__main__':
import doctest
doctest.testmod()