forked from MDL29/JacoBot
Ajout du code source du Jacobot virtuel MDL29/Jacobot#7
This commit is contained in:
parent
0f799f056d
commit
8bebe024b3
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_bas.gif
Normal file
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_bas.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_droite.gif
Normal file
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_droite.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_gauche.gif
Normal file
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_gauche.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_haut.gif
Normal file
BIN
jacovirt/jacovirt/jacovirt/Cubetto_forme_haut.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
jacovirt/jacovirt/jacovirt/fond.png
Normal file
BIN
jacovirt/jacovirt/jacovirt/fond.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 414 KiB |
76
jacovirt/jacovirt/jacovirt/jacobot.py
Normal file
76
jacovirt/jacovirt/jacovirt/jacobot.py
Normal 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
|
||||||
|
|
|
@ -13,4 +13,7 @@ python = "^3.11"
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
[tool.poetry.scripts]
|
||||||
|
jacovirt-bot = "jacovirt.jacobot:main"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user