Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rect ( 0 , 0 , 4 0 0 , 4 0 0 , fill = gradient ( ' steelBlue ' , 'lightSteelBlue', start =

Rect(0,0,400,400, fill=gradient('steelBlue', 'lightSteelBlue', start='top')) Press 's','d', and 'f'. Notice how they change the left hand to rock, paper, and
# Rock against scissors.
scissors. Press 'I','k', and 'j' and notice how the right hand changes in a similar way.
onKeyPress(s')
onKeyPress('j')
This is the console. Error messages output here.
leftThrow = Label('Rock',100,275, size=25)
rightThrow = Label('Rock',300,275, size=25)
leftInstructions = Label('Use s, d, f key to control left', 200,375, size=14)
rightInstructions = Label('Use j, k, l key to control right', 200,390, size=14)
def drawFinger(x1, y1, x2, y2):
Line(x1, y1, x2, y2, fill='gold', lineWidth=20)
Circle(x1, y1,10, fill='gold')
def drawLeftHand():
Circle(100,200,50, fill='gold')
if (leftThrow.value != 'Rock'):
drawFinger(85,90,85,200)
drawFinger(60,100,60,200)
if (leftThrow.value == 'Paper'):
drawFinger(110,90,110,200)
drawFinger(135,100,135,200)
drawFinger(160,170,125,230)
leftThrow.toFront()
def drawRightHand():
Circle(300,200,50, fill='gold')
if (rightThrow.value != 'Rock'):
drawFinger(285,90,285,200)
drawFinger(260,100,260,200)
if (rightThrow.value == 'Paper'):
drawFinger(310,90,310,200)
drawFinger(335,100,335,200)
drawFinger(360,170,325,230)
rightThrow.toFront()
def drawWinner(leftMove, rightMove):
# Check leftMove and rightMove and draw ==,>, accordingly.
### (HINT: It matters if we use uppercase or lowercase here!)
### Place Your Code Here ###
pass
def throwdown():
# Draw over the old hand and redraw the hands.
Rect(0,0,400,400, fill=gradient('steelBlue', 'lightSteelBlue', start='top'))
drawLeftHand()
drawRightHand()
drawWinner(leftThrow.value, rightThrow.value)
leftInstructions.toFront()
rightInstructions.toFront()
def onKeyPress(key):
if (key =='s'):
leftThrow.value = 'Rock'
elif (key =='d'):
leftThrow.value = 'Paper'
elif (key =='f'):
leftThrow.value = 'Scissors'
elif (key =='l'):
rightThrow.value = 'Rock'
elif (key =='k'):
rightThrow.value = 'Paper'
elif (key =='j'):
rightThrow.value = 'Scissors'
throwdown()
drawLeftHand()
drawRightHand()5.1.3 Rock paper scissors
Press 's','d', and 'f'. Notice how they change the left hand to rock, paper, and
scissors. Press 'I','k', and 'j' and notice how the right hand changes in a similar way.
Also notice how the comparison symbol between the hands changes based on
the rules of rock-paper-scissors.
Miscellaneous
# Rock against scissors.
onKeyPress(2')
onKeyPress(2')
# Paper against scissors.
onKeyPress('d')
onKeyPress(2')
# Paper against rocks.
onKeyPress('d')
onKeyPress('1')
This is the console. Error messages output here.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

=+What is the brand's character or personality?

Answered: 1 week ago