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
1 changed files with 6 additions and 0 deletions

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()