subject

Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, and player2Move.

PROCEDURE playGame()

{

cards = []

REPEAT_UNTIL ( countFives(cards) >= 5 )

{

card1 = player1Move()

APPEND (cards, card1)

card2 = player2Move()

APPEND (cards, card2)

}

}

The procedure above simulates a certain card game called "fives" - played with two decks of cards - in which each player takes a turn playing a card, until 5 fives have been played in total, at which point it's "Game Over." The procedure uses a list called cards which is initially empty. Each round of play, two cards are appended to the list.

Here is the countFives procedure.

PROCEDURE countFives(cards)

{

count = 0

FOR EACH card IN cards

{

IF( card = 5 )

{

count = count+1

}

}

}

Which of the following should replace the at line 12 to make the procedure work as designed?

A. DISPLAY (count)

B. DISPLAY ("game over")

C. RETURN (count)

D. RETURN ("game over")

E. Nothing. Procedure works as is.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
What kind of motivation is katrina showing? use the drop-down menu to complete the statement. katrina is using motivation because she is personally interested in learning more.
Answers: 2
question
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
question
Computers and Technology, 24.06.2019 05:00
Who is most likely be your target audience if you create a slide presentation that had yellow background and purple text
Answers: 2
question
Computers and Technology, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
You know the right answer?
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, an...
Questions
Questions on the website: 13722367