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 07:30
By refraining from constructing a building until they are certain that it will not cause harm to the environment, an organization is adhering to the
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
question
Computers and Technology, 24.06.2019 01:10
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates.json” file), in order of closest-to-farthest from the origin.
Answers: 1
You know the right answer?
Consider the playGame procedure below which calls on 3 other procedures: countFives, player1Move, an...
Questions
question
Mathematics, 15.03.2022 08:30
question
Mathematics, 15.03.2022 08:30
question
Mathematics, 15.03.2022 08:30
question
Mathematics, 15.03.2022 08:30
question
Mathematics, 15.03.2022 08:30
question
Medicine, 15.03.2022 08:30
Questions on the website: 13722359