### 952 - Uno game

Posted:

**Sat May 22, 2010 1:24 pm**It seems, that I misunderstood the strategy of play. I understand it so, that player choose card from his pile when it match with top card of discard pile in color of value and it has best rank (blue card better than red, red better than yellow, yellow better than green, by equal color pass card better than change card, change card better than 0, 0 better than 1, etc).

For input
My output is
but it is wrong.

I have output status of the game (cards of players, draw pile and discard pile, orientation and player to move) after each step - according my understanding of play, from beginning to end of the game:
Can somebody help and tell me, where is mistake? Thanks very much in advance.

For input

Code: Select all

```
clockwise 1
3 RP GC Y2
2 Y4 YC
4 R3 R8 G9 R9
3 G8 YC B8
1 R2
20 R2 GP Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
```

Code: Select all

```
1 is the winner
1: 0
2: 3
3: 2
4: 2
```

I have output status of the game (cards of players, draw pile and discard pile, orientation and player to move) after each step - according my understanding of play, from beginning to end of the game:

Code: Select all

```
Orientation is clockwise and player 1 is to move
Player 1 has 3 cards, this one: RP GC Y2
Player 2 has 2 cards, this one: Y4 YC
Player 3 has 4 cards, this one: R3 R8 G9 R9
Player 4 has 3 cards, this one: G8 YC B8
Discard pile has 1 cards, this one: R2
Draw pile has 20 cards, this one: R2 GP Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: RP
Orientation is clockwise and player 3 is to move
Player 1 has 2 cards, this one: GC Y2
Player 2 has 2 cards, this one: Y4 YC
Player 3 has 4 cards, this one: R3 R8 G9 R9
Player 4 has 3 cards, this one: G8 YC B8
Discard pile has 2 cards, this one: RP R2
Draw pile has 20 cards, this one: R2 GP Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: R3
Orientation is clockwise and player 4 is to move
Player 1 has 2 cards, this one: GC Y2
Player 2 has 2 cards, this one: Y4 YC
Player 3 has 3 cards, this one: R8 G9 R9
Player 4 has 3 cards, this one: G8 YC B8
Discard pile has 3 cards, this one: R3 RP R2
Draw pile has 20 cards, this one: R2 GP Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 1 is to move
Player 1 has 2 cards, this one: GC Y2
Player 2 has 2 cards, this one: Y4 YC
Player 3 has 3 cards, this one: R8 G9 R9
Player 4 has 4 cards, this one: G8 YC B8 R2
Discard pile has 3 cards, this one: R3 RP R2
Draw pile has 19 cards, this one: GP Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 2 is to move
Player 1 has 3 cards, this one: GC Y2 GP
Player 2 has 2 cards, this one: Y4 YC
Player 3 has 3 cards, this one: R8 G9 R9
Player 4 has 4 cards, this one: G8 YC B8 R2
Discard pile has 3 cards, this one: R3 RP R2
Draw pile has 18 cards, this one: Y1 Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 3 is to move
Player 1 has 3 cards, this one: GC Y2 GP
Player 2 has 3 cards, this one: Y4 YC Y1
Player 3 has 3 cards, this one: R8 G9 R9
Player 4 has 4 cards, this one: G8 YC B8 R2
Discard pile has 3 cards, this one: R3 RP R2
Draw pile has 17 cards, this one: Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: R8
Orientation is clockwise and player 4 is to move
Player 1 has 3 cards, this one: GC Y2 GP
Player 2 has 3 cards, this one: Y4 YC Y1
Player 3 has 2 cards, this one: G9 R9
Player 4 has 4 cards, this one: G8 YC B8 R2
Discard pile has 4 cards, this one: R8 R3 RP R2
Draw pile has 17 cards, this one: Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: B8
Orientation is clockwise and player 1 is to move
Player 1 has 3 cards, this one: GC Y2 GP
Player 2 has 3 cards, this one: Y4 YC Y1
Player 3 has 2 cards, this one: G9 R9
Player 4 has 3 cards, this one: G8 YC R2
Discard pile has 5 cards, this one: B8 R8 R3 RP R2
Draw pile has 17 cards, this one: Y2 Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 2 is to move
Player 1 has 4 cards, this one: GC Y2 GP Y2
Player 2 has 3 cards, this one: Y4 YC Y1
Player 3 has 2 cards, this one: G9 R9
Player 4 has 3 cards, this one: G8 YC R2
Discard pile has 5 cards, this one: B8 R8 R3 RP R2
Draw pile has 16 cards, this one: Y3 Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 3 is to move
Player 1 has 4 cards, this one: GC Y2 GP Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: G9 R9
Player 4 has 3 cards, this one: G8 YC R2
Discard pile has 5 cards, this one: B8 R8 R3 RP R2
Draw pile has 15 cards, this one: Y4 Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 4 is to move
Player 1 has 4 cards, this one: GC Y2 GP Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 3 cards, this one: G9 R9 Y4
Player 4 has 3 cards, this one: G8 YC R2
Discard pile has 5 cards, this one: B8 R8 R3 RP R2
Draw pile has 14 cards, this one: Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: G8
Orientation is clockwise and player 1 is to move
Player 1 has 4 cards, this one: GC Y2 GP Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 3 cards, this one: G9 R9 Y4
Player 4 has 2 cards, this one: YC R2
Discard pile has 6 cards, this one: G8 B8 R8 R3 RP R2
Draw pile has 14 cards, this one: Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: GP
Orientation is clockwise and player 3 is to move
Player 1 has 3 cards, this one: GC Y2 Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 3 cards, this one: G9 R9 Y4
Player 4 has 2 cards, this one: YC R2
Discard pile has 7 cards, this one: GP G8 B8 R8 R3 RP R2
Draw pile has 14 cards, this one: Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: G9
Orientation is clockwise and player 4 is to move
Player 1 has 3 cards, this one: GC Y2 Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 2 cards, this one: YC R2
Discard pile has 8 cards, this one: G9 GP G8 B8 R8 R3 RP R2
Draw pile has 14 cards, this one: Y5 R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Got card form draw pile.
Orientation is clockwise and player 1 is to move
Player 1 has 3 cards, this one: GC Y2 Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 3 cards, this one: YC R2 Y5
Discard pile has 8 cards, this one: G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: GC
Orientation is counter-clockwise and player 4 is to move
Player 1 has 2 cards, this one: Y2 Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 3 cards, this one: YC R2 Y5
Discard pile has 9 cards, this one: GC G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: YC
Orientation is clockwise and player 1 is to move
Player 1 has 2 cards, this one: Y2 Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 2 cards, this one: R2 Y5
Discard pile has 10 cards, this one: YC GC G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: Y2
Orientation is clockwise and player 2 is to move
Player 1 has 1 cards, this one: Y2
Player 2 has 4 cards, this one: Y4 YC Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 2 cards, this one: R2 Y5
Discard pile has 11 cards, this one: Y2 YC GC G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: YC
Orientation is counter-clockwise and player 1 is to move
Player 1 has 1 cards, this one: Y2
Player 2 has 3 cards, this one: Y4 Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 2 cards, this one: R2 Y5
Discard pile has 12 cards, this one: YC Y2 YC GC G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
Was played: Y2
Orientation is counter-clockwise and player 4 is to move
Player 1 has 0 cards, this one:
Player 2 has 3 cards, this one: Y4 Y1 Y3
Player 3 has 2 cards, this one: R9 Y4
Player 4 has 2 cards, this one: R2 Y5
Discard pile has 13 cards, this one: Y2 YC Y2 YC GC G9 GP G8 B8 R8 R3 RP R2
Draw pile has 13 cards, this one: R5 Y0 R4 Y1 R3 Y2 R2 Y3 R1 Y4 R0 BC Y5
```