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 00:40
If you arrive at the same time as another user straight across from you yield if a. they flash your headlights at you b. you can’t see their turn signals c. you’re going street and they’re running d. you’re turning they’re going straight plz
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
question
Computers and Technology, 24.06.2019 15:50
Andy would like to create a bulleted list. how should he do this? andy should click on the bullet icon or select the bullet option from the menu and then type the list. andy should press the shift key and the 8 key at the beginning of each line of text. andy should type the text and then click on the bullet command. andy should press return and the bullets will automatically
Answers: 2
You know the right answer?
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, an...
Questions
question
Chemistry, 17.12.2019 08:31