A common algorithm for landlords in the course of development of chess and board platform

Source: Internet
Author: User

first of all , to find out what the card type of the landlord. can refer to the introduction of the QQ game, as follows:

Rockets: The Double King (King and Xiao Wang), the biggest card.

Bombs: four cards of the same value (e.g. four 7).

Single card: a single card (such as a red Peach 5).

Pair: Two cards of the same value (e.g. Plum 4+ block 4).

Three cards: three cards of the same value (e.g. three J).

Three with one: three cards of the same value + a single card or a pair of cards. Example: 333+6 or 444+99

Tanshun: Five or more consecutive single cards (e.g., 45678 or 78910JQK). Not including 2 points and double kings.

Double shun: Three pairs or more consecutive cards (e.g. 334455, 7788991010JJ). Not including 2 points and double kings.

Three-shun: two or more consecutive three cards (for example: 333444, 555666777888). Not including 2 points and double kings.

Aircraft with wings: three Shun + the same number of single cards (or the same number of cards).

such as: 444555+79 or 333444555+7799JJ

Four with 2:4 cards + hands. (Note: Quad band Two is not a bomb).

such as: 5555 + 3 + 8 or 4444 + 55 + 77.

second , design the Crobot class.

Properties include: the original card (number), the current card (number), the previous round of Cards (number), the current card (number), the current score, whether pass, wait time.

Methods include: Getting the original card (number), the card type function, the sorting function, the sort function by the board type, the cards function.

finally , the split-card algorithm. How to simulate the manual shuffle, this is a difficult problem. But this is hard for me.

First, 54 cards are divided into 6 * 9 matrix.

(1) Swap adjacent two lines, 1 and 2,3 and 4,5 and 6 exchanges.

(2) Exchange adjacent two columns, 1 and 2,3 and 4,5 and 6,7 and 8.

(3) Two rows of two columns are selected for Exchange.

The above steps repeat 50~100 times. Then take the first 17 cards for Player 1, the second 17 for players 2 cards, the third 17 for players 3 cards, the remaining 3 cards for the card. Ok!

Specific details can go here chess source set up www.yasewl.com

A common algorithm for landlords in the course of development of chess and board platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.