This environment is part of the classic environments. Please read that page first for general information.
|Observation Shape||(7, 4, 15)|
|Observation Values||[0, 1]|
Uno is shedding game involving 2 players. At the beginning, each player receives 7 cards and the winner is the first player with no cards left. In order to discard a card from their hand, a player must match either the color or number of the card on top of the discard pile. If the player does not have a card to discard, then they will take a card from the draw pile. The deck of cards include 4 colors (blue, green, yellow, and red), 10 numbers (0 to 9), and special cards (Wild, Wild Draw Four, Draw Two, Skip, and Reverse).
Our implementation wraps RLCard and you can refer to its documentation for additional details. Please cite their work if you use this game in research.
opponents_hand_visible: Set to
True to observe the entire observation space as described in
Observation Space below. Setting it to
False will remove any observation of the opponent’ hands and the observation space will only include planes 0 to 3.
The observation is a dictionary which contains an
'obs' element which is the usual RL observation described below, and an
'action_mask' which holds the legal moves, described in the Legal Actions Mask section.
The main observation space has a shape of (7, 4, 15). Planes 0-2 represent the current player’s hand, while planes 4-6 represent the opponent’s hand. For these sets of planes, the first index indicates the number of copies of a card, the second index the color, and the last index the card number (including any special cards). Uno is played with 2 identical decks, so a player can have 0, 1, or 2 copies of a given card, which is why each player has 3 planes to represent their hand.
|0||Cards that the current player has 0 copies of in their hand|
|1||Cards that the current player has 1 copy of in their hand|
|2||Cards that the current player has 2 copies of in their hand|
|3||Target card (top of the Discard pile)|
|4||Cards that the opponent has 0 copies of in their hand|
|5||Cards that the opponent has 1 copy of in their hand|
|6||Cards that the opponent has 2 copies of in their hand|
|Plane Row Index||Description|
|Plane Column Index||Description|
|11||Wild Draw Four|
The legal moves available to the current agent are found in the
action_mask element of the dictionary observation. The
action_mask is a binary vector where each index of the vector represents whether the action is legal or not. The
action_mask will be all zeros for any agent except the one whose turn it is. Taking an illegal move ends the game with a reward of -1 for the illegally moving agent and a reward of 0 for all other agents.
The action space is as described by RLCards.
|0 - 9||Red number cards
|10 - 12||Red action cards
|13||Red “Wild” card|
|14||Red “Wild and Draw 4” card|
|15 - 24||Green number cards
|25 - 27||Green action cards
|28||Green “Wild” card|
|29||Green “Wild and draw 4” card|
|30 - 39||Blue number cards
|40 - 42||Blue action cards
|43||Blue “Wild” card|
|44||Blue “Wild and Draw 4” card|
|45 - 54||Yellow number cards
|55 - 57||Yellow action cards
|58||Yellow “Wild” card|
|59||Yellow “Wild and Draw 4” card|
For example, you would use action
6 to put down a red “6” card or action
60 to draw a card.