3
def __init__(self, width: int, height: int):4
self.perimeter = 2*width + 2*(height - 2)8
self.bottomRight = width - 19
self.topRight = self.bottomRight + (height - 1)10
self.topLeft = self.topRight + (width - 1)12
def step(self, num: int) -> None:14
self.pos = (self.pos + num) % self.perimeter16
def getPos(self) -> List[int]:17
if 0 <= self.pos <= self.bottomRight:20
if self.bottomRight < self.pos <= self.topRight:21
return [self.bottomRight, self.pos - self.bottomRight]23
if self.topRight < self.pos <= self.topLeft:24
return [self.bottomRight - (self.pos - self.topRight), self.topRight - self.bottomRight]26
return [0, self.topRight - self.bottomRight - (self.pos - self.topLeft)]28
def getDir(self) -> str:29
if self.atStart or 0 < self.pos <= self.bottomRight:32
if self.bottomRight < self.pos <= self.topRight:35
if self.topRight < self.pos <= self.topLeft: