MCPcopy Create free account
hub / github.com/JoshuaPostel/texaform / forward

Method forward

python/utils.py:51–60  ·  view source on GitHub ↗
(self, direction: Direction, distance: int = 1)

Source from the content-addressed store, hash-verified

49 return abs(self.x - other.x) + abs(self.y - other.y)
50
51 def forward(self, direction: Direction, distance: int = 1) -> Self:
52 match direction:
53 case "N":
54 return Point(self.x, self.y - distance) # ty: ignore[invalid-return-type]
55 case "S":
56 return Point(self.x, self.y + distance) # ty: ignore[invalid-return-type]
57 case "E":
58 return Point(self.x + distance, self.y) # ty: ignore[invalid-return-type]
59 case "W":
60 return Point(self.x - distance, self.y) # ty: ignore[invalid-return-type]
61
62@dataclass
63class Rect:

Callers 5

pickMethod · 0.80
scanMethod · 0.80
moveMethod · 0.80
approachMethod · 0.80
build_atMethod · 0.80

Calls 1

PointClass · 0.85

Tested by

no test coverage detected