Ben Zhang has written another introduction here that might also be worth reading
升级 is a family of trick-taking card games popular in China. It's also known as tractor (拖拉机), 40 points (四十分), 80 points (八十分), playing for 100 points (打百分), finding friends (找朋友), among others. You can play online here.
This online 升级 and 找朋友 implementation uses a fairly standard rule set. There are a wide variety of house rules that aren't implemented; but could be -- feel free to propose new functionality on GitHub.
There are 54 cards per deck (13 cards per suit, plus a small joker and a big joker). Aces (A) are treated as higher-valued than Kings (K). Usually, a deck is added for every two players in the game (so 4 players and 5 players play with 2 decks, but 6 players play with 3).
Kings, tens, and fives are valuable cards and have point values. Kings and tens are worth ten points each. Fives are worth five points each.
The two jokers are ordered, with the uncolored joker having a lower value than the colored joker.
Scoring in each round of the game is determined by "point" cards. Only fives, tens, and kings have points— all other cards do not count for scoring. Point scores are pooled within a team.
|Card number||Point value|
Each deck has a total of 100 points (25 per suit). However, as cards of the trump rank are part of the trump suit, the trump suit will have a disproportionately large number of points when the trump rank is 5, 10, or K.
Each player in the game has a rank, starting at 2 and going to A. If they win rounds, their rank may increase. The rank of the leading player for a round determines the trump rank for that round.
The game ends when a player successfully defends a round at the A rank.
In each round, there is a trump specification which determines what cards are part of the trump suit. The trump specification always includes a trump rank, but doesn't necessarily include a specific suit. Jokers are always a part of the trump suit.
For example, if the trump rank is 4 and the specified suit is spades (♤), the trump suit consists of all 4s, all jokers, and all spades. A card can only be a part of one suit, so the 4♡ is no longer considered to be a members of the hearts (♡) suit.
In all suits, the 3 and the 5 are now considered to be adjacent.
The order of the trump suit is as follows (highest to lowest):
In the case of the trump specification of 4♤, the ordering from highest to lowest is big joker > small joker > 4♤ > [ 4♡ = 4♢ = 4♧ ] > A♤ > K♤ > Q♤ > J♤ > 10♤ > 9♤ > 8♤ > 7♤ > 6♤ > 5♤ > 3♤ > 2♤.
If only a trump rank is specified (and no suit), the only trumps are cards of the trump rank, and jokers. This is referred to as "no trump", and there are five distinct suits (as opposed to the usual four).
In all suits, the 3 and the 5 are now considered to be adjacent.
The order of the trump suit is as follows:
In the case of the trump specification of 4NT, the ordering from highest to lowest is big joker > small joker > [ 4♤ = 4♡ = 4♢ = 4♧ ].
There are two fundamental teams in the game: one team is trying to acquire points, while the other team is trying to discard them. Colloquially, the team trying to acquiring points is "attacking", and the other team is "defending".
The defending team is determined by a designated leader of the team (当庄). In 升级, the teams are fixed and the leader rotates among the winning team. In 找朋友, the leader rotates among the team that won the previous round, but the teams are fluid and change from round-to-round.
The leader (whomever is 当庄) of the team gets an additional advantage at the beginning of the game: they can see the extra "bottom cards" (底牌) and exchange them for cards in their hand. Otherwise, all players are the same, and teams only matter for scoring.
The game begins by players drawing cards one at a time. Like most Chinese card games, cards are drawn in counter-clockwise order.
At any point, a player may "bid" for the trump by showing valid bids out of their hand. The highest bid determines the trump specification for the game. However, once a player has made a bid, they can only "reinforce" it by adding more of the same card, or wait for another player to displace them as the highest bidder.
Valid bids must be made up of identical cards (i.e. same card-face). The bids can be either cards of the current trump rank or jokers. The current trump rank corresponds to the rank of the leader of the defending team. Each game starts with all players at rank 2. Joker bids represent "no trump" bids. A single joker cannot be used as a bid.
Each bid made must be greater than all of the previous bids. This is determined first by the number of cards (more is higher), and then by card values (following the "no trump" ordering of card values).
The final trump specification is determined by the winning bid. If the winning bid is made up of jokers, the trump specification is "no trump"; otherwise, it is the suit of the winning bid. All cards in this suit and jokers are considered trumps..
Example with trump rank of 2:
Result: 2NT trump specification, player 1 wins the bid.
If this is the first round being played, the winner of the bid is also the leader of the defending team (当庄). Otherwise, the only consequence of the bidding process is setting the trump specification.
After the drawing phase is completed, 4 to 8 cards are left in the bottom of the draw pile and become the 底牌. For example, in a four-player game, there will be 8 cards left; in a five-player game, there will be 6. These cards are made available for the leader of the defending team (当庄) to pick up.
The leader may choose to swap some, all, or none of the cards in the bottom for cards in their hand. The number of cards in the bottom must remain constant.
There is a potential penalty for hiding points in the bottom, since other players can't see them. This is surfaced as a multiplier on the number of points left in the bottom, which are treated as if they are attached to the last trick in the game.
|Length of the last trick-format||Point multiplier|
|2 (e.g. pair)||4|
|3 (e.g. triple)||6|
|4 (e.g. tractor)||8|
The multiplier can be generalized to arbitrarily large trick-formats. In the case of the last trick-format being a "throw", or a set of the highest possible individual trick-formats, the length of the longest trick-format within the group should be used for the multiplier.
In addition to exchanging cards with the bottom of the deck, in games of 找朋友, the leader also specifies which cards identify their "friends" (i.e. members of the defending team). These must be committed to at the beginning of the game, and the leader is allowed to become their own friend (intentionally or unintentionally).
The number of friends is determined by the number of players— the defending team should never be larger than the attacking team.
A friend is declared as a combination of a specific card (suit/number) and an ordinal. For example, one could declare that the "first person to play an A♤" is their friend. They could also declare that the third person to play the card is their friend.
Cards above the value of A cannot be declared as friends. That is, cards of the trump rank and jokers are not legal friend cards.
In many cases, this results in the leader and the other players not knowing who the friends are. Once a trick has been completed in which a person has played the friend card, they join the defending team and bring their points with them.
All cards in a trick format must be in the same suit. Any winning play (whether it is setting the format or not) must be made up of a single suit; that suit will match either the initial format or be made up of trumps.
There are three basic trick formats in the game: single cards, identical cards, and sequences of identical cards. A set of the highest possible plays in a single suit can be played simultaneously as a "throw", which makes it potentially harder to trump.
In general, players must attempt to match the format to the best of their ability using cards in the same suit. If the player has no remaining cards in the suit (i.e. they are void in the suit), there are no requirements on what cards they can play.
Any single card can always lead a trick. Other players are required to play a card in the same suit if they have one; otherwise, any card can be played.
If a trump card is played, the highest trump card wins the trick. Otherwise, the highest card in the original suit wins the trick. If the same card is played by multiple players, the first one to play has precedence.
Player 3 wins this trick, because they played the highest card in the same suit (A♤) first.
Player 2 wins this trick, because they played the highest trump card (big joker). Note that Player 3 is also void in spades (♤), but did not play a trump card and so cannot win the trick.
Sets of identical cards can always lead a trick. Other players are obligated to match the set as best they can within the suit.
Note: cards of equal value are not necessarily identical; they have to have the exact same card face.
For example, if the trick-format is triples, the ordering of required plays is:
Only plays which match the trick-format (either in the original suit, or in trump) are eligible to win the trick. As with the single-card format, the first player to play an identical play has precedence.
Player 4 wins this trick, because they played the highest pair in the same suit same suit (3♤3♤). Player 2 and Player 3 did not play a pair; therefore, they cannot win this trick, and (by inference) cannot have any spade pairs remaining in their hands.
Player 3 wins this trick, because they played a trump pair. Because both Player 2 and Player 3 played non-spade cards, they must be void in spades.
Consecutive sequences of at least two identical cards of the same size and in the same suit are called tractors, and are a special play-type in and of themselves. They are parameterized by their length and the number of identical cards, both of which are at required to be at least two (the smallest tractor is four cards).
Whether pairs are sequential depends on the current trump: since cards with the trump rank are some of the highest trumps, right below the jokers, their positioning in the overall order has changed.
Example of sequential pairs due to trump-number reordering:
Additionally, pairs of equal cards don't make tractors.
Tractors are relatively uncommon, and tend to win tricks. They are also strategically good, because matching the tractor format is at least as difficult as matching the equivalent number of identical cards.
For example, if the trick-format is tractors made up of three consecutive pairs, the ordering of required plays is:
Only plays which match the trick-format (either in the original suit, or in trump) are eligible to win the trick. As with the single-card and identical-card formats, the first player to play an identical play has precedence.
Player 1 wins this trick, because they are the only player to meet the format. Player 2 and Player 3 played non-consecutive pairs, while Player 4 played cards in a different suit. Since this trick is led with a tractor, all players had to play two pairs in spades if they had them.
Any set of the highest possible trick-formats in a given suit can be played simultaneously as a "throw". It is expected that the player initiating a throw believes that their play is valid, i.e. that no other player can defeat any component of the throw using cards in the same suit.
Once a throw has been played, each player should (in counter-clockwise order) affirm that the throw is valid and that it cannot be defeated within the same suit. If the throw is determined to be invalid, the player which initiated the throw is obligated to lead with the component that can be defeated. In this implementation, no additional penalties are imposed on incorrect throws.
Other players are not obligated to ensure that their plays are the highest possible plays within their own suits, though they still need to match each component's trick-format as best they can within the suit.
Examples for two decks:
In cases of ambiguity between components (e.g. five-of-a-kind vs. tractor), the interpretation with the longest single component is chosen. If there are multiple ambiguous components of the same length, tractors are preferred over identical cards.
Example of a throw ambiguity:
The above play can be interpreted as either a tractor and a single card ([2♤2♤3♤3♤] + 2♤), or as a triple and a pair ([2♤2♤2♤] + [3♤3♤]). Since the former interpretation has a maximum component length of 4 cards, greater than the latter's 3 cards, we interpret this as a tractor and a single card. The "full house" concept from poker does not exist in this game.
Only plays which match the trick-format (either in the original suit, or in trump) are eligible to win the trick. As with the other formats, the first player to play an identical play has precedence.
Note: in order to defeat a throw, every component of the throw must be individually defeated. Since a throw is only valid if it cannot be defeated within its own suit, this means that a throw can only be defeated by the same pattern of cards in the trump suit.
Player 1 wins this trick, because they are the only player to meet the format. Note: though there exists another pair of Q♤Q♤ played by Player 2, this is a valid throw because no player can show that they have K♤K♤ or A♤A♤, which are the only two higher pairs. Player 3 is particularly upset, here, because they had a tractor in spades, but it can't win in a trick with a two-pair-throw format. Since this trick is led with a throw of two pairs, all players had to play two pairs in spades if they had them.
Example 2: trump is 2♢
Player 2 wins this trick (admittedly contrived): both Player 2 and Player 3 played trump cards in the appropriate format. However, though Player 3's pair of 4♢4♢ is higher than Player 2's 3♢3♢, their 6♢ is not higher than Player 2's 8♢, so Player 2 takes precedence.
In each trick, the first cards (also known as the lead cards) denote the format of the trick. Only plays which match the trick's format are eligible to win the trick.
Every player contributes the same number of cards to each trick. Therefore, every player runs out of cards at the same time.
Players are also obligated to match the trick format to the fullest extent possible: if they are able to match the format within trick's suit, they must play those cards. If they can't match the format but can match a looser variant of the format (e.g. they have a pair in the suit, but the format requires a triple), they are also obligated to play those cards.
This implies that a player can only play cards of a different suit than the leading play in a trick if they have no cards in that suit (i.e. they are void in the suit).
The winner of the current trick will play the first cards (and set the trick format) for the next trick.
The winning team for each round is determined by the number of points the opposing team earned from tricks. If the opposing team won the last trick, the cards hidden in the bottom are revealed. The point value of any valuable cards at the bottom are multiplied by twice the number of cards in the largest component of the last trick's format and awarded to the opposing team.
There are five possible outcomes depending on the number of decks, as detailed in the following table:
|Opposing team's points||Result|
|0||Defending team wins and goes up three levels|
|5 to n-5||Defending team wins and goes up two levels|
|n to 2n-5||Defending team wins and goes up one level|
|2n to 3n-5||Opposing team wins, but keeps the same level|
|3n to 4n-5||Opposing team wins and goes up one level|
|4n to 5n-5||Opposing team wins and goes up two levels|
|5n and above||Opposing team wins and goes up three levels|
The winning team becomes the defending team in the next round, and the next person counter-clockwise from the current leader is the leader for the next round.
The winner of the game is the person who gets to the highest possible rank and successfully defends it first. In this implementation, this is A.