1
0
forked from MDL29/JacoBot

Merge pull request 'Ajout du code source du Jacobot virtuel MDL29/Jacobot#7' (#9) from Bertrand-DUCON/JacoBot:main into main

Reviewed-on: MDL29/JacoBot#9
Reviewed-by: HS-157 <hs-157@noreply.localhost>
This commit is contained in:
HS-157 2024-04-13 15:31:59 +00:00
commit 20589e6b1e
7 changed files with 79 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

View File

@ -0,0 +1,76 @@
from turtle import *
"""host = "192.168.20.49"
channel = "LPH"
# Connexion à Redis
r = redis.Redis(host=host)
p = r.pubsub()
p.psubscribe(channel)
"""
def main():
angle = 0
def cubetto_init():
bgpic("fond.png")
register_shape("Cubetto_forme_haut.gif")
register_shape("Cubetto_forme_bas.gif")
register_shape("Cubetto_forme_gauche.gif")
register_shape("Cubetto_forme_droite.gif")
shape("Cubetto_forme_droite.gif")
shapesize(3,3,6)
penup()
goto(-210,194)
def cubetto_forme_init():
global angle
if angle == 360 or angle == -360:
angle=0
if angle == 0:
shape("Cubetto_forme_droite.gif")
if angle == 90 or angle == -270:
shape("Cubetto_forme_haut.gif")
if angle == 180 or angle == -180:
shape("Cubetto_forme_gauche.gif")
if angle == 270 or angle == -90:
shape("Cubetto_forme_bas.gif")
def cubetto_forward():
forward(84)
def cubetto_left():
global angle
left(90)
angle += 90
cubetto_forme_init()
def cubetto_right():
global angle
right(90)
angle -= 90
cubetto_forme_init()
def cubetto_backward():
right(180)
forward(84)
right(180)
cubetto_init()
while True:
message = []
if message == "FORDWARD":
cubetto_forward()
elif message == "LEFT":
cubetto_left()
elif message == "RIGHT":
cubetto_right()
elif message == "i":
cubetto_init()
elif message == "FUNCTION":
pass

View File

@ -13,4 +13,7 @@ python = "^3.11"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
jacovirt-bot = "jacovirt.jacobot:main"