Java Algorithms-Poker arrangement

Source: Internet
Author: User

/** * The following code simulates a set of poker (initial sort a~k, total of 13) of the operation process. * * Operation process is: holding this set of cards in hand, from the front to take a piece to put in the back, and then take one from the front on the table, and then from the front of a piece put in the back, .... * This cycle is done until the last card is left on the table. The purpose of the code below is to find out the order of the cards on the last table. Initial arrangement if it is A,2,3...K, then the order on the last table is: * [2, 4, 6, 8, ten, Q, A, 5, 9, K, 7, 3, J] Please parse the code logic and speculate on the code at the line. *  */ Public  class poker arrangement {     Public StaticListMovecard(List src) {if(src = =NULL) {return NULL; } List DST =NewVector (); for(;;) {if(src.size () = =0) { Break; } Src.add (Src.remove (0)); Dst.add (Src.remove (0)); }returnDst } Public Static void Main(string[] args) {List A =NewVector ();//arrays.aslist (): Returns a list of fixed sizes supported by the specified array. (Changes to the returned list are "directly written" to the array.) )A.addall (Arrays.aslist ("A","2","3","4","5","6","7","8","9","Ten","J","Q","K"));    System.out.println (Movecard (a)); }}

Java Algorithms-Poker arrangement

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.