Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
app.background = gradient ( ' mediumSeaGreen ' , 'seaGreen' ) # variables representing the card's suit app.diamonds = 0 app.hearts = 1 app.clubs = 2
app.background gradientmediumSeaGreen 'seaGreen' # variables representing the card's suit app.diamonds app.hearts app.clubs app.spades # variables for the red suit color and black suit color app.redColor 'tomato' app.blackColor 'dimGrey' def drawHeartsx y color: # draws a heart Polygonx y x y x y fillcolor Polygonx y x y x y fillcolor Polygonx y x y x y fillcolor def drawDiamondsx y color: # draws a diamond Rectx y fillcolor, rotateAngle align'center' def drawClubsx y color: # draws a clover clubs Rectx y fillcolor, rotateAngle align'center' Rectx y fillcolor, rotateAngle align'center' Rectx y fillcolor, rotateAngle align'center' def drawSpadesx y color: # draws a spade Polygonx y x y x y fillcolor Polygonx y x y x y fillcolor def drawCardx y rank, suit: # draws the base of the card and its shadow Rectx y opacity Rectx y fill'white', border'darkGrey' # Depending on the card's suit, set the helper variable, suitColor, accordingly. # Then draw the correct symbol for the suit at the middle of the card. ### HINT: Hearts and diamonds are red cards, clubs and spades are black cards. ### HINT: There are some helpful functions written for you above. ### Fix Your Code Here ### suitColor 'black' drawHeartsx y suitColor # draws the card using the determined suit color Rectx y fillNone, bordersuitColor, dashesTrue Polygonx y x y x y fillsuitColor Polygonx y x y x y fillsuitColor Polygonx y x y x y fillsuitColor Polygonx y x y x y fillsuitColor Labelrank x y fillsuitColor Labelrank x y fillsuitColor ##### Place your code above this line, code below is for testing purposes ##### # test case: drawCardA app.diamonds drawCardK app.diamonds drawCardQ app.diamonds drawCardJ app.diamonds drawCard app.diamonds
app.background gradientmediumSeaGreen 'seaGreen'
# variables representing the card's suit
app.diamonds
app.hearts
app.clubs
app.spades
# variables for the red suit color and black suit color
app.redColor 'tomato'
app.blackColor 'dimGrey'
def drawHeartsx y color:
# draws a heart
Polygonx y x y x y fillcolor
Polygonx y x y x y fillcolor
Polygonx y x y x y fillcolor
def drawDiamondsx y color:
# draws a diamond
Rectx y fillcolor, rotateAngle align'center'
def drawClubsx y color:
# draws a clover clubs
Rectx y fillcolor, rotateAngle align'center'
Rectx y fillcolor, rotateAngle align'center'
Rectx y fillcolor, rotateAngle align'center'
def drawSpadesx y color:
# draws a spade
Polygonx y x y x y fillcolor
Polygonx y x y x y fillcolor
def drawCardx y rank, suit:
# draws the base of the card and its shadow
Rectx y opacity
Rectx y fill'white', border'darkGrey'
# Depending on the card's suit, set the helper variable, suitColor, accordingly.
# Then draw the correct symbol for the suit at the middle of the card.
### HINT: Hearts and diamonds are red cards, clubs and spades are black cards.
### HINT: There are some helpful functions written for you above.
### Fix Your Code Here ###
suitColor 'black'
drawHeartsx y suitColor
# draws the card using the determined suit color
Rectx y fillNone, bordersuitColor, dashesTrue
Polygonx y x y x y fillsuitColor
Polygonx y x y x y fillsuitColor
Polygonx y x y x y fillsuitColor
Polygonx y x y x y fillsuitColor
Labelrank x y fillsuitColor
Labelrank x y fillsuitColor
##### Place your code above this line, code below is for testing purposes #####
# test case:
drawCardA app.diamonds
drawCardK app.diamonds
drawCardQ app.diamonds
drawCardJ app.diamonds
drawCard app.diamonds
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started