נוספו מצגות מערכת השידורים נוסח מלא
פיתוח קוד שיכול להשתלב במשחקים רבים. הגרלת קובייה - אך הפעם הקובייה גרפית. במצגת תיאור של תהליך בחירת התמונות ובניית הקוד.
import turtle
import random
import time
screen = turtle.Screen()
screen.setup(700,700)
screen.addshape("one.gif")
screen.addshape("two.gif")
screen.addshape("three.gif")
screen.addshape("four.gif")
screen.addshape("five.gif")
screen.addshape("six.gif")
screen.addshape("bg.gif")
screen.addshape("click.gif")
cube1=turtle.Turtle()
cube1.goto(-70,0)
screen.bgpic("bg.gif")
cube1.shape("click.gif")
def cube11():
cube1.shape("one.gif")
def cube12():
cube1.shape("two.gif")
def cube13():
cube1.shape("three.gif")
def cube14():
cube1.shape("four.gif")
def cube15():
cube1.shape("five.gif")
def cube16():
cube1.shape("six.gif")
def shuffle1(ans):
if ans==1:
cube11()
if ans==2:
cube12()
if ans==3:
cube13()
if ans==4:
cube14()
if ans==5:
cube15()
if ans==6:
cube16()
def click(x,y):
comp_ans1=int(random.randint(1,6))
comp_ans2=int(random.randint(1,6))
shuffle1(comp_ans1)
shuffle2(comp_ans2)
screen.onclick(click)
import turtle
import random
import time
screen = turtle.Screen()
screen.setup(700,700)
screen.addshape("one.gif")
screen.addshape("two.gif")
screen.addshape("three.gif")
screen.addshape("four.gif")
screen.addshape("five.gif")
screen.addshape("six.gif")
screen.addshape("bg.gif")
screen.addshape("click.gif")
cube1=turtle.Turtle()
cube1.goto(-70,0)
cube2=turtle.Turtle()
cube2.goto(70,0)
screen.bgpic("bg.gif")
cube1.shape("click.gif")
cube2.shape("click.gif")
def cube11():
cube1.shape("one.gif")
def cube12():
cube1.shape("two.gif")
def cube13():
cube1.shape("three.gif")
def cube14():
cube1.shape("four.gif")
def cube15():
cube1.shape("five.gif")
def cube16():
cube1.shape("six.gif")
def cube21():
cube2.shape("one.gif")
def cube22():
cube2.shape("two.gif")
def cube23():
cube2.shape("three.gif")
def cube24():
cube2.shape("four.gif")
def cube25():
cube1.shape("five.gif")
def cube26():
cube2.shape("six.gif")
def shuffle1(ans):
if ans==1:
cube11()
if ans==2:
cube12()
if ans==3:
cube13()
if ans==4:
cube14()
if ans==5:
cube15()
if ans==6:
cube16()
def shuffle2(ans):
if ans==1:
cube21()
if ans==2:
cube22()
if ans==3:
cube23()
if ans==4:
cube24()
if ans==5:
cube25()
if ans==6:
cube26()
def click(x,y):
comp_ans1=int(random.randint(1,6))
comp_ans2=int(random.randint(1,6))
shuffle1(comp_ans1)
shuffle2(comp_ans2)
screen.onclick(click)