Download paddle.py from Workfun/Pong: direct link, hf CLI and curl.
- Browser
- Download file 573 Bytes
-
https://huggingface.co/Workfun/Pong/resolve/main/paddle.py
- Command line
-
hf download hf://Workfun/Pong/paddle.py
-
curl -L -o paddle.py https://huggingface.co/Workfun/Pong/resolve/main/paddle.py
573 Bytes
| PADDLE_DISTANCE = 30 | |
| class Paddle(Turtle): | |
| def __init__(self, coordinates): | |
| super().__init__() | |
| self.shape("square") | |
| self.shapesize(stretch_len=PADDLE_SIZE) | |
| self.color("white") | |
| self.speed("fastest") | |
| self.setheading(90) | |
| self.penup() | |
| self.goto(coordinates) | |
| def up(self): | |
| if self.ycor() > 240: | |
| pass | |
| else: | |
| self.forward(PADDLE_DISTANCE) | |
| def down(self): | |
| if self.ycor() < -240: | |
| pass | |
| else: | |
| self.backward(PADDLE_DISTANCE) | |