程序代写代做 go PROBLEM 3: Going Wild! [10 points]

PROBLEM 3: Going Wild! [10 points]
Now that we have that sorted, we will really go “wild” and add in the crazy eights rule. If the last player plays any Loco Card, an “eight” card (R8, Y8, G8 or B8), they can choose the colour to be played next. The player that follows must then either play another Loco Card (R8, Y8, G8 or B8) of any colour, or a card of the new colour chosen.
The Loco Rule
If a player is allowed to play one of their Loco Cards (R8, Y8, G8 or B8), they will.
§ If they have more than one Loco Card, they will choose to play the eight card that comes earlier in rainbow order (red-yellow-green- blue).
When a Loco Card is played, they get to choose a colour to follow (i.e. it behaves as if they 8 was painted in the colour chosen).
§ The chosen colour will always be the first colour in rainbow order that will remain in their hand (if any) on their next turn (if no cards remain, they win).
Input
Same as in Problem 2.
Processing
Same as in Problem 2 with the addition of Loco Rule:
§ If a player has an “eight” card (R8, Y8, G8 or B8) in their hand, the Loco Rule (above) is applied.
Output format
Same as in Problem 2 with the following exception:
§ If a player lay’s down a card numbered 8, output the chosen colour as follows:
{N}: {colour of Loco Card}8 – {Colour chosen: R,Y,G, or B}
HINT: Start from Problem 2 and modify…
8

Sample input
Sample output
New hand after play
R1 R4 Y6 G8 B2
R2 R3 R6 Y4 G5
R5 R8 Y7 Y8 G2
B6
Y3 B7 Y1 G6 Y5 G7
… B3R7G1G4B5
… G3B1B8B4Y2
0: B6
1: B2
2: R2
3: G2
1: TAKE TWO
2: G5
3: R5
1: R1
2: R3
3: R8 LOCO Y
1: G8 LOCO R
2: R6
3: DRAW
1: R4
2: Y4 (WINNER)

1: R1 R4 Y6 G8 B2
2: R2 R3 R6 Y4 G5
3: R5 R8 Y7 Y8 G2
1: R1 R4 Y3 Y6 G8 B7 2: R3 R6 Y4 G5
3: R5 R8 Y7 Y8
1: R1 R4 Y3 Y6 G8 B7 2: R3 R6 Y4
3: R8 Y7 Y8
1: R4 Y3 Y6 G8 B7
2: R6 Y4
3: Y1 Y7 Y8
1: R4 Y3 Y6 B7
2: Y4
9