แสดงผลลัพธ์ของการทำไพ่ 8 สับที่สมบูรณ์แบบของไพ่


17

คำอธิบาย

การสลับที่สมบูรณ์แบบคือที่ไพ่มีการแบ่งครึ่งและไพ่จากแต่ละกองสลับกัน บัตรด้านล่างเดิมและบัตรบนสุดจะต้องเก็บรักษาไว้หลังจากการสับเปลี่ยนที่สมบูรณ์แบบ

หลังจากการสับไพ่ 8 ครั้งที่สมบูรณ์แบบสำรับไพ่มาตรฐาน 52 ใบกลับสู่การสั่งซื้อเดิม

ท้าทาย

เขียนโปรแกรมที่แสดงสถานะของสำรับไพ่ที่ผ่านการสับไพ่ที่สมบูรณ์แบบติดต่อกัน 8 ครั้ง คุณสามารถใช้สำรับที่เป็นมนุษย์ที่สามารถอ่านได้โดยมีเงื่อนไขว่าจะแสดงหมายเลขและชุดของไพ่แต่ละใบในสำรับตามลำดับ จะต้องแสดงการเป็นตัวแทนของการ์ดทั้งหมดสำหรับทั้งเก้ารัฐ

นี่คือรหัสกอล์ฟดังนั้นทางออกที่สั้นที่สุดชนะ

ตัวอย่างผลลัพธ์

นี่คือตัวอย่างเอาต์พุตที่สร้างโดยการนำตัวอย่างนี้ไปใช้ใน Javascript

AS,AC,AD,AH,2S,2C,2D,2H,3S,3C,3D,3H,4S,4C,4D,4H,5S,5C,5D,5H,6S,6C,6D,6H,7S,7C,7D,7H,8S,8C,8D,8H,9S,9C,9D,9H,10S,10C,10D,10H,JS,JC,JD,JH,QS,QC,QD,QH,KS,KC,KD,KH
AS,7D,AC,7H,AD,8S,AH,8C,2S,8D,2C,8H,2D,9S,2H,9C,3S,9D,3C,9H,3D,10S,3H,10C,4S,10D,4C,10H,4D,JS,4H,JC,5S,JD,5C,JH,5D,QS,5H,QC,6S,QD,6C,QH,6D,KS,6H,KC,7S,KD,7C,KH
AS,4C,7D,10H,AC,4D,7H,JS,AD,4H,8S,JC,AH,5S,8C,JD,2S,5C,8D,JH,2C,5D,8H,QS,2D,5H,9S,QC,2H,6S,9C,QD,3S,6C,9D,QH,3C,6D,9H,KS,3D,6H,10S,KC,3H,7S,10C,KD,4S,7C,10D,KH
AS,9S,4C,QC,7D,2H,10H,6S,AC,9C,4D,QD,7H,3S,JS,6C,AD,9D,4H,QH,8S,3C,JC,6D,AH,9H,5S,KS,8C,3D,JD,6H,2S,10S,5C,KC,8D,3H,JH,7S,2C,10C,5D,KD,8H,4S,QS,7C,2D,10D,5H,KH 
AS,5S,9S,KS,4C,8C,QC,3D,7D,JD,2H,6H,10H,2S,6S,10S,AC,5C,9C,KC,4D,8D,QD,3H,7H,JH,3S,7S,JS,2C,6C,10C,AD,5D,9D,KD,4H,8H,QH,4S,8S,QS,3C,7C,JC,2D,6D,10D,AH,5H,9H,KH 
AS,3S,5S,7S,9S,JS,KS,2C,4C,6C,8C,10C,QC,AD,3D,5D,7D,9D,JD,KD,2H,4H,6H,8H,10H,QH,2S,4S,6S,8S,10S,QS,AC,3C,5C,7C,9C,JC,KC,2D,4D,6D,8D,10D,QD,AH,3H,5H,7H,9H,JH,KH 
AS,2S,3S,4S,5S,6S,7S,8S,9S,10S,JS,QS,KS,AC,2C,3C,4C,5C,6C,7C,8C,9C,10C,JC,QC,KC,AD,2D,3D,4D,5D,6D,7D,8D,9D,10D,JD,QD,KD,AH,2H,3H,4H,5H,6H,7H,8H,9H,10H,JH,QH,KH 
AS,AD,2S,2D,3S,3D,4S,4D,5S,5D,6S,6D,7S,7D,8S,8D,9S,9D,10S,10D,JS,JD,QS,QD,KS,KD,AC,AH,2C,2H,3C,3H,4C,4H,5C,5H,6C,6H,7C,7H,8C,8H,9C,9H,10C,10H,JC,JH,QC,QH,KC,KH 
AS,AC,AD,AH,2S,2C,2D,2H,3S,3C,3D,3H,4S,4C,4D,4H,5S,5C,5D,5H,6S,6C,6D,6H,7S,7C,7D,7H,8S,8C,8D,8H,9S,9C,9D,9H,10S,10C,10D,10H,JS,JC,JD,JH,QS,QC,QD,QH,KS,KC,KD,KH 

ในขณะที่ไม่ได้ซ้ำกันที่แน่นอนนี้เป็นหลักประมาณครึ่งหนึ่งของงานจากการผสมถั่ว (อย่างน้อยดำเนินการตามคำตอบปัจจุบัน)
Peter Taylor

1
ลำดับการเริ่มต้นของการ์ดมีความสำคัญหรือไม่
Paul Prestidge

@ ประสานไม่บัตรสามารถเริ่มต้นในลำดับใดก็ได้
ปีเตอร์โอลสัน

คำตอบ:


15

J, 66 65 54 52 50 47 43 ตัวอักษร

26({.,@,.}.)^:(i.9),{'A23456789TJQK';'SCDH'

เอาท์พุท:

┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│AS│AC│AD│AH│2S│2C│2D│2H│3S│3C│3D│3H│4S│4C│4D│4H│5S│5C│5D│5H│6S│6C│6D│6H│7S│7C│7D│7H│8S│8C│8D│8H│9S│9C│9D│9H│TS│TC│TD│TH│JS│JC│JD│JH│QS│QC│QD│QH│KS│KC│KD│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│7D│AC│7H│AD│8S│AH│8C│2S│8D│2C│8H│2D│9S│2H│9C│3S│9D│3C│9H│3D│TS│3H│TC│4S│TD│4C│TH│4D│JS│4H│JC│5S│JD│5C│JH│5D│QS│5H│QC│6S│QD│6C│QH│6D│KS│6H│KC│7S│KD│7C│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│4C│7D│TH│AC│4D│7H│JS│AD│4H│8S│JC│AH│5S│8C│JD│2S│5C│8D│JH│2C│5D│8H│QS│2D│5H│9S│QC│2H│6S│9C│QD│3S│6C│9D│QH│3C│6D│9H│KS│3D│6H│TS│KC│3H│7S│TC│KD│4S│7C│TD│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│9S│4C│QC│7D│2H│TH│6S│AC│9C│4D│QD│7H│3S│JS│6C│AD│9D│4H│QH│8S│3C│JC│6D│AH│9H│5S│KS│8C│3D│JD│6H│2S│TS│5C│KC│8D│3H│JH│7S│2C│TC│5D│KD│8H│4S│QS│7C│2D│TD│5H│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│5S│9S│KS│4C│8C│QC│3D│7D│JD│2H│6H│TH│2S│6S│TS│AC│5C│9C│KC│4D│8D│QD│3H│7H│JH│3S│7S│JS│2C│6C│TC│AD│5D│9D│KD│4H│8H│QH│4S│8S│QS│3C│7C│JC│2D│6D│TD│AH│5H│9H│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│3S│5S│7S│9S│JS│KS│2C│4C│6C│8C│TC│QC│AD│3D│5D│7D│9D│JD│KD│2H│4H│6H│8H│TH│QH│2S│4S│6S│8S│TS│QS│AC│3C│5C│7C│9C│JC│KC│2D│4D│6D│8D│TD│QD│AH│3H│5H│7H│9H│JH│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│2S│3S│4S│5S│6S│7S│8S│9S│TS│JS│QS│KS│AC│2C│3C│4C│5C│6C│7C│8C│9C│TC│JC│QC│KC│AD│2D│3D│4D│5D│6D│7D│8D│9D│TD│JD│QD│KD│AH│2H│3H│4H│5H│6H│7H│8H│9H│TH│JH│QH│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│AD│2S│2D│3S│3D│4S│4D│5S│5D│6S│6D│7S│7D│8S│8D│9S│9D│TS│TD│JS│JD│QS│QD│KS│KD│AC│AH│2C│2H│3C│3H│4C│4H│5C│5H│6C│6H│7C│7H│8C│8H│9C│9H│TC│TH│JC│JH│QC│QH│KC│KH│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│AS│AC│AD│AH│2S│2C│2D│2H│3S│3C│3D│3H│4S│4C│4D│4H│5S│5C│5D│5H│6S│6C│6D│6H│7S│7C│7D│7H│8S│8C│8D│8H│9S│9C│9D│9H│TS│TC│TD│TH│JS│JC│JD│JH│QS│QC│QD│QH│KS│KC│KD│KH│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘

ฉันถูกบังคับให้ทำตามบทแนะนำและคู่มืออ้างอิงของเจเพื่อให้อยู่ข้างหน้าต่อไป : -S


อาร์เรย์ที่ 1 และสุดท้ายของคุณเหมือนกัน นอกจากนี้บัตรที่ 1 ของคุณอยู่เสมอและสุดท้ายคือตลอดเวลาAS KH
defhlt

1
@ArtemIce พวกเขาควรจะเป็น มันจำเป็นในคำถาม อ่านย่อหน้าแรกอีกครั้ง
Gareth

@Gareth โอเคขอโทษ
defhlt

9

Haskell, 103

m(a:s,b:t)=a:b:m(s,t);m _=[]
main=mapM_ putStrLn.take 9.iterate(m.splitAt 26)$take 13.enumFrom=<<"🂡🃑🃁🂱"

เอาท์พุท:

🂡🂢🂣🂤🂥🂦🂧🂨🂩🂪🂫🂬🂭🃑🃒🃓🃔🃕🃖🃗🃘🃙🃚🃛🃜🃝🃁🃂🃃🃄🃅🃆🃇🃈🃉🃊🃋🃌🃍🂱🂲🂳🂴🂵🂶🂷🂸🂹🂺🂻🂼🂽
🂡🃁🂢🃂🂣🃃🂤🃄🂥🃅🂦🃆🂧🃇🂨🃈🂩🃉🂪🃊🂫🃋🂬🃌🂭🃍🃑🂱🃒🂲🃓🂳🃔🂴🃕🂵🃖🂶🃗🂷🃘🂸🃙🂹🃚🂺🃛🂻🃜🂼🃝🂽
🂡🃑🃁🂱🂢🃒🃂🂲🂣🃓🃃🂳🂤🃔🃄🂴🂥🃕🃅🂵🂦🃖🃆🂶🂧🃗🃇🂷🂨🃘🃈🂸🂩🃙🃉🂹🂪🃚🃊🂺🂫🃛🃋🂻🂬🃜🃌🂼🂭🃝🃍🂽
🂡🃇🃑🂷🃁🂨🂱🃘🂢🃈🃒🂸🃂🂩🂲🃙🂣🃉🃓🂹🃃🂪🂳🃚🂤🃊🃔🂺🃄🂫🂴🃛🂥🃋🃕🂻🃅🂬🂵🃜🂦🃌🃖🂼🃆🂭🂶🃝🂧🃍🃗🂽
🂡🃔🃇🂺🃑🃄🂷🂫🃁🂴🂨🃛🂱🂥🃘🃋🂢🃕🃈🂻🃒🃅🂸🂬🃂🂵🂩🃜🂲🂦🃙🃌🂣🃖🃉🂼🃓🃆🂹🂭🃃🂶🂪🃝🂳🂧🃚🃍🂤🃗🃊🂽
🂡🂩🃔🃜🃇🂲🂺🂦🃑🃙🃄🃌🂷🂣🂫🃖🃁🃉🂴🂼🂨🃓🃛🃆🂱🂹🂥🂭🃘🃃🃋🂶🂢🂪🃕🃝🃈🂳🂻🂧🃒🃚🃅🃍🂸🂤🂬🃗🃂🃊🂵🂽
🂡🂥🂩🂭🃔🃘🃜🃃🃇🃋🂲🂶🂺🂢🂦🂪🃑🃕🃙🃝🃄🃈🃌🂳🂷🂻🂣🂧🂫🃒🃖🃚🃁🃅🃉🃍🂴🂸🂼🂤🂨🂬🃓🃗🃛🃂🃆🃊🂱🂵🂹🂽
🂡🂣🂥🂧🂩🂫🂭🃒🃔🃖🃘🃚🃜🃁🃃🃅🃇🃉🃋🃍🂲🂴🂶🂸🂺🂼🂢🂤🂦🂨🂪🂬🃑🃓🃕🃗🃙🃛🃝🃂🃄🃆🃈🃊🃌🂱🂳🂵🂷🂹🂻🂽
🂡🂢🂣🂤🂥🂦🂧🂨🂩🂪🂫🂬🂭🃑🃒🃓🃔🃕🃖🃗🃘🃙🃚🃛🃜🃝🃁🃂🃃🃄🃅🃆🃇🃈🃉🃊🃋🃌🃍🂱🂲🂳🂴🂵🂶🂷🂸🂹🂺🂻🂼🂽


ไม่ทราบว่ามีปัญหา UTF-8 ที่นี่หรือไม่ไม่ควร ... นี่คือการถ่ายโอนข้อมูลฐานสิบหกของโปรแกรม

0000000 286d 3a61 2c73 3a62 2974 613d 623a 6d3a
0000010 7328 742c 3b29 206d 3d5f 5d5b 6d0a 6961
0000020 3d6e 616d 4d70 205f 7570 5374 7274 6e4c
0000030 742e 6b61 2065 2e39 7469 7265 7461 2865
0000040 2e6d 7073 696c 4174 2074 3632 2429 6174
0000050 656b 3120 2e33 6e65 6d75 7246 6d6f 3c3d
0000060 223c 9ff0 a182 9ff0 9183 9ff0 8183 9ff0
0000070 b182 0a22                              
0000074

และของบรรทัดเอาต์พุตแรก

0000000 9ff0 a182 9ff0 a282 9ff0 a382 9ff0 a482
0000010 9ff0 a582 9ff0 a682 9ff0 a782 9ff0 a882
0000020 9ff0 a982 9ff0 aa82 9ff0 ab82 9ff0 ac82
0000030 9ff0 ad82 9ff0 9183 9ff0 9283 9ff0 9383
0000040 9ff0 9483 9ff0 9583 9ff0 9683 9ff0 9783
0000050 9ff0 9883 9ff0 9983 9ff0 9a83 9ff0 9b83
0000060 9ff0 9c83 9ff0 9d83 9ff0 8183 9ff0 8283
0000070 9ff0 8383 9ff0 8483 9ff0 8583 9ff0 8683
0000080 9ff0 8783 9ff0 8883 9ff0 8983 9ff0 8a83
0000090 9ff0 8b83 9ff0 8c83 9ff0 8d83 9ff0 b182
00000a0 9ff0 b282 9ff0 b382 9ff0 b482 9ff0 b582
00000b0 9ff0 b682 9ff0 b782 9ff0 b882 9ff0 b982
00000c0 9ff0 ba82 9ff0 bb82 9ff0 bc82 9ff0 bd82
00000d0 000a                                   
00000d1

( ไพ่ยูนิโคดที่เล่น )


2
เอาท์พุทเป็นช่องว่าง ...
ปีเตอร์โอลสัน

1
เอ่อมันไม่ใช่! คุณหมายถึงอะไร
หยุดหมุนทวนเข็มนาฬิกาเมื่อ

ตกลงนี่เป็นสิ่งที่น่าสนใจหลังจากแก้ไข Stack Exchange ยังแสดงช่องว่างให้ฉันด้วย แปลก ... หลังจากโพสต์ความคิดเห็นนี้มันใช้งานได้อีกครั้งแม้ว่า
หยุดหมุนทวนเข็มนาฬิกาเมื่อ

3
คุณจะขาดตัวอักษรเพื่อดู codepoints น่ารักเช่น'บัตรเล่น JACK ของสโมสร' (U + 1F0DB)
Lars Viklund

8

Python 2, 79 ตัวอักษร

d=zip("23456789TJQKA"*4,"CDHS"*13)
exec'print d;d[::2],d[1::2]=d[:26],d[26:];'*9

ผลผลิตค่อนข้างน่าเกลียด แต่ฉันเชื่อว่ามันควรจะนับ

[('2', 'C'), ('3', 'D'), ('4', 'H'), ('5', 'S'), ('6', 'C'), ('7', 'D'), ('8', 'H'), ('9', 'S'), ('T', 'C'), ('J', 'D'), ('Q', 'H'), ('K', 'S'), ('A', 'C'), ('2', 'D'), ('3', 'H'), ('4', 'S'), ('5', 'C'), ('6', 'D'), ('7', 'H'), ('8', 'S'), ('9', 'C'), ('T', 'D'), ('J', 'H'), ('Q', 'S'), ('K', 'C'), ('A', 'D'), ('2', 'H'), ('3', 'S'), ('4', 'C'), ('5', 'D'), ('6', 'H'), ('7', 'S'), ('8', 'C'), ('9', 'D'), ('T', 'H'), ('J', 'S'), ('Q', 'C'), ('K', 'D'), ('A', 'H'), ('2', 'S'), ('3', 'C'), ('4', 'D'), ('5', 'H'), ('6', 'S'), ('7', 'C'), ('8', 'D'), ('9', 'H'), ('T', 'S'), ('J', 'C'), ('Q', 'D'), ('K', 'H'), ('A', 'S')]
[('2', 'C'), ('2', 'H'), ('3', 'D'), ('3', 'S'), ('4', 'H'), ('4', 'C'), ('5', 'S'), ('5', 'D'), ('6', 'C'), ('6', 'H'), ('7', 'D'), ('7', 'S'), ('8', 'H'), ('8', 'C'), ('9', 'S'), ('9', 'D'), ('T', 'C'), ('T', 'H'), ('J', 'D'), ('J', 'S'), ('Q', 'H'), ('Q', 'C'), ('K', 'S'), ('K', 'D'), ('A', 'C'), ('A', 'H'), ('2', 'D'), ('2', 'S'), ('3', 'H'), ('3', 'C'), ('4', 'S'), ('4', 'D'), ('5', 'C'), ('5', 'H'), ('6', 'D'), ('6', 'S'), ('7', 'H'), ('7', 'C'), ('8', 'S'), ('8', 'D'), ('9', 'C'), ('9', 'H'), ('T', 'D'), ('T', 'S'), ('J', 'H'), ('J', 'C'), ('Q', 'S'), ('Q', 'D'), ('K', 'C'), ('K', 'H'), ('A', 'D'), ('A', 'S')]
[('2', 'C'), ('2', 'D'), ('2', 'H'), ('2', 'S'), ('3', 'D'), ('3', 'H'), ('3', 'S'), ('3', 'C'), ('4', 'H'), ('4', 'S'), ('4', 'C'), ('4', 'D'), ('5', 'S'), ('5', 'C'), ('5', 'D'), ('5', 'H'), ('6', 'C'), ('6', 'D'), ('6', 'H'), ('6', 'S'), ('7', 'D'), ('7', 'H'), ('7', 'S'), ('7', 'C'), ('8', 'H'), ('8', 'S'), ('8', 'C'), ('8', 'D'), ('9', 'S'), ('9', 'C'), ('9', 'D'), ('9', 'H'), ('T', 'C'), ('T', 'D'), ('T', 'H'), ('T', 'S'), ('J', 'D'), ('J', 'H'), ('J', 'S'), ('J', 'C'), ('Q', 'H'), ('Q', 'S'), ('Q', 'C'), ('Q', 'D'), ('K', 'S'), ('K', 'C'), ('K', 'D'), ('K', 'H'), ('A', 'C'), ('A', 'D'), ('A', 'H'), ('A', 'S')]
[('2', 'C'), ('8', 'C'), ('2', 'D'), ('8', 'D'), ('2', 'H'), ('9', 'S'), ('2', 'S'), ('9', 'C'), ('3', 'D'), ('9', 'D'), ('3', 'H'), ('9', 'H'), ('3', 'S'), ('T', 'C'), ('3', 'C'), ('T', 'D'), ('4', 'H'), ('T', 'H'), ('4', 'S'), ('T', 'S'), ('4', 'C'), ('J', 'D'), ('4', 'D'), ('J', 'H'), ('5', 'S'), ('J', 'S'), ('5', 'C'), ('J', 'C'), ('5', 'D'), ('Q', 'H'), ('5', 'H'), ('Q', 'S'), ('6', 'C'), ('Q', 'C'), ('6', 'D'), ('Q', 'D'), ('6', 'H'), ('K', 'S'), ('6', 'S'), ('K', 'C'), ('7', 'D'), ('K', 'D'), ('7', 'H'), ('K', 'H'), ('7', 'S'), ('A', 'C'), ('7', 'C'), ('A', 'D'), ('8', 'H'), ('A', 'H'), ('8', 'S'), ('A', 'S')]
[('2', 'C'), ('5', 'C'), ('8', 'C'), ('J', 'C'), ('2', 'D'), ('5', 'D'), ('8', 'D'), ('Q', 'H'), ('2', 'H'), ('5', 'H'), ('9', 'S'), ('Q', 'S'), ('2', 'S'), ('6', 'C'), ('9', 'C'), ('Q', 'C'), ('3', 'D'), ('6', 'D'), ('9', 'D'), ('Q', 'D'), ('3', 'H'), ('6', 'H'), ('9', 'H'), ('K', 'S'), ('3', 'S'), ('6', 'S'), ('T', 'C'), ('K', 'C'), ('3', 'C'), ('7', 'D'), ('T', 'D'), ('K', 'D'), ('4', 'H'), ('7', 'H'), ('T', 'H'), ('K', 'H'), ('4', 'S'), ('7', 'S'), ('T', 'S'), ('A', 'C'), ('4', 'C'), ('7', 'C'), ('J', 'D'), ('A', 'D'), ('4', 'D'), ('8', 'H'), ('J', 'H'), ('A', 'H'), ('5', 'S'), ('8', 'S'), ('J', 'S'), ('A', 'S')]
[('2', 'C'), ('T', 'C'), ('5', 'C'), ('K', 'C'), ('8', 'C'), ('3', 'C'), ('J', 'C'), ('7', 'D'), ('2', 'D'), ('T', 'D'), ('5', 'D'), ('K', 'D'), ('8', 'D'), ('4', 'H'), ('Q', 'H'), ('7', 'H'), ('2', 'H'), ('T', 'H'), ('5', 'H'), ('K', 'H'), ('9', 'S'), ('4', 'S'), ('Q', 'S'), ('7', 'S'), ('2', 'S'), ('T', 'S'), ('6', 'C'), ('A', 'C'), ('9', 'C'), ('4', 'C'), ('Q', 'C'), ('7', 'C'), ('3', 'D'), ('J', 'D'), ('6', 'D'), ('A', 'D'), ('9', 'D'), ('4', 'D'), ('Q', 'D'), ('8', 'H'), ('3', 'H'), ('J', 'H'), ('6', 'H'), ('A', 'H'), ('9', 'H'), ('5', 'S'), ('K', 'S'), ('8', 'S'), ('3', 'S'), ('J', 'S'), ('6', 'S'), ('A', 'S')]
[('2', 'C'), ('6', 'C'), ('T', 'C'), ('A', 'C'), ('5', 'C'), ('9', 'C'), ('K', 'C'), ('4', 'C'), ('8', 'C'), ('Q', 'C'), ('3', 'C'), ('7', 'C'), ('J', 'C'), ('3', 'D'), ('7', 'D'), ('J', 'D'), ('2', 'D'), ('6', 'D'), ('T', 'D'), ('A', 'D'), ('5', 'D'), ('9', 'D'), ('K', 'D'), ('4', 'D'), ('8', 'D'), ('Q', 'D'), ('4', 'H'), ('8', 'H'), ('Q', 'H'), ('3', 'H'), ('7', 'H'), ('J', 'H'), ('2', 'H'), ('6', 'H'), ('T', 'H'), ('A', 'H'), ('5', 'H'), ('9', 'H'), ('K', 'H'), ('5', 'S'), ('9', 'S'), ('K', 'S'), ('4', 'S'), ('8', 'S'), ('Q', 'S'), ('3', 'S'), ('7', 'S'), ('J', 'S'), ('2', 'S'), ('6', 'S'), ('T', 'S'), ('A', 'S')]
[('2', 'C'), ('4', 'H'), ('6', 'C'), ('8', 'H'), ('T', 'C'), ('Q', 'H'), ('A', 'C'), ('3', 'H'), ('5', 'C'), ('7', 'H'), ('9', 'C'), ('J', 'H'), ('K', 'C'), ('2', 'H'), ('4', 'C'), ('6', 'H'), ('8', 'C'), ('T', 'H'), ('Q', 'C'), ('A', 'H'), ('3', 'C'), ('5', 'H'), ('7', 'C'), ('9', 'H'), ('J', 'C'), ('K', 'H'), ('3', 'D'), ('5', 'S'), ('7', 'D'), ('9', 'S'), ('J', 'D'), ('K', 'S'), ('2', 'D'), ('4', 'S'), ('6', 'D'), ('8', 'S'), ('T', 'D'), ('Q', 'S'), ('A', 'D'), ('3', 'S'), ('5', 'D'), ('7', 'S'), ('9', 'D'), ('J', 'S'), ('K', 'D'), ('2', 'S'), ('4', 'D'), ('6', 'S'), ('8', 'D'), ('T', 'S'), ('Q', 'D'), ('A', 'S')]
[('2', 'C'), ('3', 'D'), ('4', 'H'), ('5', 'S'), ('6', 'C'), ('7', 'D'), ('8', 'H'), ('9', 'S'), ('T', 'C'), ('J', 'D'), ('Q', 'H'), ('K', 'S'), ('A', 'C'), ('2', 'D'), ('3', 'H'), ('4', 'S'), ('5', 'C'), ('6', 'D'), ('7', 'H'), ('8', 'S'), ('9', 'C'), ('T', 'D'), ('J', 'H'), ('Q', 'S'), ('K', 'C'), ('A', 'D'), ('2', 'H'), ('3', 'S'), ('4', 'C'), ('5', 'D'), ('6', 'H'), ('7', 'S'), ('8', 'C'), ('9', 'D'), ('T', 'H'), ('J', 'S'), ('Q', 'C'), ('K', 'D'), ('A', 'H'), ('2', 'S'), ('3', 'C'), ('4', 'D'), ('5', 'H'), ('6', 'S'), ('7', 'C'), ('8', 'D'), ('9', 'H'), ('T', 'S'), ('J', 'C'), ('Q', 'D'), ('K', 'H'), ('A', 'S')]

1
ดีมากproduct!
บูธ

6

Python2, 104

สิ่งนี้คล้ายกับโซลูชันของ Ev_Genus ฉันใส่สูทก่อนอันดับเพราะมันช่วยให้ฉันบันทึกตัวละคร

d=[s+[r,`10`][r>"Q"]for r in'A23456789ZJQK'for s in"SCDH"]
exec'print d;d=sum(zip(d[:26],d[26:]),());'*9

เอาท์พุต

['SA', 'CA', 'DA', 'HA', 'S2', 'C2', 'D2', 'H2', 'S3', 'C3', 'D3', 'H3', 'S4', 'C4', 'D4', 'H4', 'S5', 'C5', 'D5', 'H5', 'S6', 'C6', 'D6', 'H6', 'S7', 'C7', 'D7', 'H7', 'S8', 'C8', 'D8', 'H8', 'S9', 'C9', 'D9', 'H9', 'S10', 'C10', 'D10', 'H10', 'SJ', 'CJ', 'DJ', 'HJ', 'SQ', 'CQ', 'DQ', 'HQ', 'SK', 'CK', 'DK', 'HK']
('SA', 'D7', 'CA', 'H7', 'DA', 'S8', 'HA', 'C8', 'S2', 'D8', 'C2', 'H8', 'D2', 'S9', 'H2', 'C9', 'S3', 'D9', 'C3', 'H9', 'D3', 'S10', 'H3', 'C10', 'S4', 'D10', 'C4', 'H10', 'D4', 'SJ', 'H4', 'CJ', 'S5', 'DJ', 'C5', 'HJ', 'D5', 'SQ', 'H5', 'CQ', 'S6', 'DQ', 'C6', 'HQ', 'D6', 'SK', 'H6', 'CK', 'S7', 'DK', 'C7', 'HK')
('SA', 'C4', 'D7', 'H10', 'CA', 'D4', 'H7', 'SJ', 'DA', 'H4', 'S8', 'CJ', 'HA', 'S5', 'C8', 'DJ', 'S2', 'C5', 'D8', 'HJ', 'C2', 'D5', 'H8', 'SQ', 'D2', 'H5', 'S9', 'CQ', 'H2', 'S6', 'C9', 'DQ', 'S3', 'C6', 'D9', 'HQ', 'C3', 'D6', 'H9', 'SK', 'D3', 'H6', 'S10', 'CK', 'H3', 'S7', 'C10', 'DK', 'S4', 'C7', 'D10', 'HK')
('SA', 'S9', 'C4', 'CQ', 'D7', 'H2', 'H10', 'S6', 'CA', 'C9', 'D4', 'DQ', 'H7', 'S3', 'SJ', 'C6', 'DA', 'D9', 'H4', 'HQ', 'S8', 'C3', 'CJ', 'D6', 'HA', 'H9', 'S5', 'SK', 'C8', 'D3', 'DJ', 'H6', 'S2', 'S10', 'C5', 'CK', 'D8', 'H3', 'HJ', 'S7', 'C2', 'C10', 'D5', 'DK', 'H8', 'S4', 'SQ', 'C7', 'D2', 'D10', 'H5', 'HK')
('SA', 'S5', 'S9', 'SK', 'C4', 'C8', 'CQ', 'D3', 'D7', 'DJ', 'H2', 'H6', 'H10', 'S2', 'S6', 'S10', 'CA', 'C5', 'C9', 'CK', 'D4', 'D8', 'DQ', 'H3', 'H7', 'HJ', 'S3', 'S7', 'SJ', 'C2', 'C6', 'C10', 'DA', 'D5', 'D9', 'DK', 'H4', 'H8', 'HQ', 'S4', 'S8', 'SQ', 'C3', 'C7', 'CJ', 'D2', 'D6', 'D10', 'HA', 'H5', 'H9', 'HK')
('SA', 'S3', 'S5', 'S7', 'S9', 'SJ', 'SK', 'C2', 'C4', 'C6', 'C8', 'C10', 'CQ', 'DA', 'D3', 'D5', 'D7', 'D9', 'DJ', 'DK', 'H2', 'H4', 'H6', 'H8', 'H10', 'HQ', 'S2', 'S4', 'S6', 'S8', 'S10', 'SQ', 'CA', 'C3', 'C5', 'C7', 'C9', 'CJ', 'CK', 'D2', 'D4', 'D6', 'D8', 'D10', 'DQ', 'HA', 'H3', 'H5', 'H7', 'H9', 'HJ', 'HK')
('SA', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9', 'S10', 'SJ', 'SQ', 'SK', 'CA', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9', 'C10', 'CJ', 'CQ', 'CK', 'DA', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'D10', 'DJ', 'DQ', 'DK', 'HA', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8', 'H9', 'H10', 'HJ', 'HQ', 'HK')
('SA', 'DA', 'S2', 'D2', 'S3', 'D3', 'S4', 'D4', 'S5', 'D5', 'S6', 'D6', 'S7', 'D7', 'S8', 'D8', 'S9', 'D9', 'S10', 'D10', 'SJ', 'DJ', 'SQ', 'DQ', 'SK', 'DK', 'CA', 'HA', 'C2', 'H2', 'C3', 'H3', 'C4', 'H4', 'C5', 'H5', 'C6', 'H6', 'C7', 'H7', 'C8', 'H8', 'C9', 'H9', 'C10', 'H10', 'CJ', 'HJ', 'CQ', 'HQ', 'CK', 'HK')
('SA', 'CA', 'DA', 'HA', 'S2', 'C2', 'D2', 'H2', 'S3', 'C3', 'D3', 'H3', 'S4', 'C4', 'D4', 'H4', 'S5', 'C5', 'D5', 'H5', 'S6', 'C6', 'D6', 'H6', 'S7', 'C7', 'D7', 'H7', 'S8', 'C8', 'D8', 'H8', 'S9', 'C9', 'D9', 'H9', 'S10', 'C10', 'D10', 'H10', 'SJ', 'CJ', 'DJ', 'HJ', 'SQ', 'CQ', 'DQ', 'HQ', 'SK', 'CK', 'DK', 'HK')

+1 [r,'10'][r>"Q"]เป็นสิ่งที่ดี ผมไม่คิดว่าคุณต้อง backticks 10รอบ คำคมก็ทำได้ดี
Steven Rumbalski

@StevenRumbalski ฉันใช้ backticks สำหรับ lulz คำพูดใช้พื้นที่จำนวนเท่ากัน
บูธโดย

ถ้ามันเป็นที่อนุญาต (มันไม่ได้) exec'print d;d=d[::2]+d[1::2];'*9ที่จะมีผลในการสั่งซื้อย้อนกลับนี้จะทำงาน:
Steven Rumbalski

น่าละอายสำหรับฉัน ฉันลืมไปsumแล้ว
Ev_genus

6

APL (42)

{↑{⍉2 26⍴⍵}⍣⍵,'A23456789TJQK'∘.,'SCDH'}¨⍳9

เอาท์พุทเป็นแบบบนลงล่างแทนที่จะเป็นซ้ายขวา (แต่ก็ยังเป็นที่มนุษย์อ่านได้ดังนั้นฉันเดาว่ามันไม่ขัดกับกฎ)

เอาท์พุท:

 ตามที่เป็น 
 7D 4C 9S 5S 3S 2S โฆษณา AC 7D 

 AC 7D 4C 9S 5S 3S 2S AD AC 
 7H TH QC KS 7S 4S 2D AH 7H 

 โฆษณา AC 7D 4C 9 วินาที 5S 3S 2S โฆษณา 
 8S 4D 2H 8C JS 6S 3D 2C 8S 

 AH 7H TH QC KS 7S 4S 2D AH 
 8C JS 6S 3D 2C 8S 4D 2H 8C 

 2S AD AC 7D 4C 9S 5S 3S 2S 
 8D 4H 9C JD 6C TS 5D 3C 8D 

 2C 8S 4D 2H 8C JS 6S 3D 2C 
 8H JC QD 6H TC QS 6D 3H 8H 

 2D AH 7H TH QC KS 7S 4S 2D 
 9S 5S 3S 2S โฆษณา AC 7D 4C 9S 

 2H 8C JS 6S 3D 2C 8S 4D 2H 
 9C JD 6C TS 5D 3C 8D 4H 9C 

 โฆษณา 3S 2S AC 7D 4C 9S 5S 3S 
 9D 5C 9D 5C 9D 5C 9D 5C 9D 

 3C 8D 4H 9C JD 6C TS 5D 3C 
 9H JH QH KC KD 7C TD 5H 9H 

 3D 2C 8S 4D 2H 8C JS 6S 3D 
 TS 5D 3C 8D 4H 9C JD 6C TS 

 3H 8H JC QD 6H TC QS 6D 3H 
 TC QS 6D 3H 8H JC QD 6H TC 

 4S 2D AH 7H TH QC KS 7S 4S 
 TD 5H 9H JH QH KC KD 7C TD 

 4C 9S 5S 3S 2S โฆษณา AC 7D 4C 
 TH QC KS 7S 4S 2D AH 7H TH 

 4D 2H 8C JS 6S 3D 2C 8S 4D 
 JS 6S 3D 2C 8S 4D 2H 8C JS 

 4H 9C JD 6C TS 5D 3C 8D 4H 
 JC QD 6H TC QS 6D 3H 8H JC 

 5S 3S 2S AD AC 7D 4C 9S 5S 
 JD 6C TS 5D 3C 8D 4H 9C JD 

 5C 9D 5C 9D 5C 9D 5C 9D 5C 
 JH QH KC KD 7C TD 5H 9H JH 

 5D 3C 8D 4H 9C JD 6C TS 5D 
 QS 6D 3H 8H JC QD 6H TC QS 

 5H 9H JH QH KC KD 7C TD 5H 
 QC KS 7S 4S 2D AH 7H TH QC 

 6S 3D 2C 8S 4D 2H 8C JS 6S 
 QD 6H TC QS 6D 3H 8H JC QD 

 6C TS 5D 3C 8D 4H 9C JD 6C 
 QH KC KD 7C TD 5H 9H JH QH 

 6D 3H 8H JC QD 6H TC QS 6D 
 KS 7S 4S 2D AH 7H TH QC 

 6H TC QS 6D 3H 8H JC QD 6H 
 KC KD 7C TD 5H 9H JH QH KC 

 7S 4S 2D AH 7H TH QC KS 7S 
 KD 7C TD 5H 9H JH QH KC KD 

 7C TD 5H 9H JH QH KC KD 7C 
 KH KH KH KH KH KH KH KH KH 


5

K, 55 53 51

{$,/(,').`$2 26#x}\[8;,/"A23456789TJQK",/:\:"SCDH"]

โกน 2 ตัวอักษรโดยเปลี่ยนจากการแสดงสัญลักษณ์เป็นสตริง

เอาท์พุต

k){$,/(,').`$(2 26)#x}\[8;,/"A23456789TJQK",/:\:"SCDH"]
"AS" "AC" "AD" "AH" "2S" "2C" "2D" "2H" "3S" "3C" "3D" "3H" "4S" "4C" "4D" "4H" "5S" "5C" "5D" "5H" "6S" "6C" "6D" "6H" "7S" "7C" "7D" "7H" "8S" "8C" "8D" "8H" "9S" "9C" "9D" "9H" "TS" "TC" "TD" "TH" "JS" "JC" "JD" "JH" "QS" "QC" "QD" "QH" "KS" "KC" "KD" "KH"
"AS" "7D" "AC" "7H" "AD" "8S" "AH" "8C" "2S" "8D" "2C" "8H" "2D" "9S" "2H" "9C" "3S" "9D" "3C" "9H" "3D" "TS" "3H" "TC" "4S" "TD" "4C" "TH" "4D" "JS" "4H" "JC" "5S" "JD" "5C" "JH" "5D" "QS" "5H" "QC" "6S" "QD" "6C" "QH" "6D" "KS" "6H" "KC" "7S" "KD" "7C" "KH"
"AS" "4C" "7D" "TH" "AC" "4D" "7H" "JS" "AD" "4H" "8S" "JC" "AH" "5S" "8C" "JD" "2S" "5C" "8D" "JH" "2C" "5D" "8H" "QS" "2D" "5H" "9S" "QC" "2H" "6S" "9C" "QD" "3S" "6C" "9D" "QH" "3C" "6D" "9H" "KS" "3D" "6H" "TS" "KC" "3H" "7S" "TC" "KD" "4S" "7C" "TD" "KH"
"AS" "9S" "4C" "QC" "7D" "2H" "TH" "6S" "AC" "9C" "4D" "QD" "7H" "3S" "JS" "6C" "AD" "9D" "4H" "QH" "8S" "3C" "JC" "6D" "AH" "9H" "5S" "KS" "8C" "3D" "JD" "6H" "2S" "TS" "5C" "KC" "8D" "3H" "JH" "7S" "2C" "TC" "5D" "KD" "8H" "4S" "QS" "7C" "2D" "TD" "5H" "KH"
"AS" "5S" "9S" "KS" "4C" "8C" "QC" "3D" "7D" "JD" "2H" "6H" "TH" "2S" "6S" "TS" "AC" "5C" "9C" "KC" "4D" "8D" "QD" "3H" "7H" "JH" "3S" "7S" "JS" "2C" "6C" "TC" "AD" "5D" "9D" "KD" "4H" "8H" "QH" "4S" "8S" "QS" "3C" "7C" "JC" "2D" "6D" "TD" "AH" "5H" "9H" "KH"
"AS" "3S" "5S" "7S" "9S" "JS" "KS" "2C" "4C" "6C" "8C" "TC" "QC" "AD" "3D" "5D" "7D" "9D" "JD" "KD" "2H" "4H" "6H" "8H" "TH" "QH" "2S" "4S" "6S" "8S" "TS" "QS" "AC" "3C" "5C" "7C" "9C" "JC" "KC" "2D" "4D" "6D" "8D" "TD" "QD" "AH" "3H" "5H" "7H" "9H" "JH" "KH"
"AS" "2S" "3S" "4S" "5S" "6S" "7S" "8S" "9S" "TS" "JS" "QS" "KS" "AC" "2C" "3C" "4C" "5C" "6C" "7C" "8C" "9C" "TC" "JC" "QC" "KC" "AD" "2D" "3D" "4D" "5D" "6D" "7D" "8D" "9D" "TD" "JD" "QD" "KD" "AH" "2H" "3H" "4H" "5H" "6H" "7H" "8H" "9H" "TH" "JH" "QH" "KH"
"AS" "AD" "2S" "2D" "3S" "3D" "4S" "4D" "5S" "5D" "6S" "6D" "7S" "7D" "8S" "8D" "9S" "9D" "TS" "TD" "JS" "JD" "QS" "QD" "KS" "KD" "AC" "AH" "2C" "2H" "3C" "3H" "4C" "4H" "5C" "5H" "6C" "6H" "7C" "7H" "8C" "8H" "9C" "9H" "TC" "TH" "JC" "JH" "QC" "QH" "KC" "KH"
"AS" "AC" "AD" "AH" "2S" "2C" "2D" "2H" "3S" "3C" "3D" "3H" "4S" "4C" "4D" "4H" "5S" "5C" "5D" "5H" "6S" "6C" "6D" "6H" "7S" "7C" "7D" "7H" "8S" "8C" "8D" "8H" "9S" "9C" "9D" "9H" "TS" "TC" "TD" "TH" "JS" "JC" "JD" "JH" "QS" "QC" "QD" "QH" "KS" "KC" "KD" "KH"

k)@[a;0]~@[;8]a:{$,/(,').`$(2 26)#x}\[8;,/"A23456789TJQK",/:\:"SCDH"]  /8th iteration identical to the first?
1b

คุณสามารถตัดอีก 2 ตัวอักษร (และเอาชนะ J) ได้โดยเปลี่ยน(2;26)เป็น2 26
skeevey

ยอดเยี่ยม ฉันได้ต่อสู้อย่างต่อเนื่องกับโซลูชัน J แล้ว 65-55-54-53-52-51
tmartin

4

ทับทิม 1.9 (95 93 87)

a=(0..51).map{|i|:A23456789TJQK[i/4]+:SCDH[i%4]}
9.times{p a;a=a.zip(a.pop 26).flatten}

เอาท์พุท:

["AS", "AC", "AD", "AH", "2S", "2C", "2D", "2H", "3S", "3C", "3D", "3H", "4S", "4C", "4D", "4H", "5S", "5C", "5D", "5H", "6S", "6C", "6D", "6H", "7S", "7C", "7D", "7H", "8S", "8C", "8D", "8H", "9S", "9C", "9D", "9H", "TS", "TC", "TD", "TH", "JS", "JC", "JD", "JH", "QS", "QC", "QD", "QH", "KS", "KC", "KD", "KH"]
["AS", "7D", "AC", "7H", "AD", "8S", "AH", "8C", "2S", "8D", "2C", "8H", "2D", "9S", "2H", "9C", "3S", "9D", "3C", "9H", "3D", "TS", "3H", "TC", "4S", "TD", "4C", "TH", "4D", "JS", "4H", "JC", "5S", "JD", "5C", "JH", "5D", "QS", "5H", "QC", "6S", "QD", "6C", "QH", "6D", "KS", "6H", "KC", "7S", "KD", "7C", "KH"]
["AS", "4C", "7D", "TH", "AC", "4D", "7H", "JS", "AD", "4H", "8S", "JC", "AH", "5S", "8C", "JD", "2S", "5C", "8D", "JH", "2C", "5D", "8H", "QS", "2D", "5H", "9S", "QC", "2H", "6S", "9C", "QD", "3S", "6C", "9D", "QH", "3C", "6D", "9H", "KS", "3D", "6H", "TS", "KC", "3H", "7S", "TC", "KD", "4S", "7C", "TD", "KH"]
["AS", "9S", "4C", "QC", "7D", "2H", "TH", "6S", "AC", "9C", "4D", "QD", "7H", "3S", "JS", "6C", "AD", "9D", "4H", "QH", "8S", "3C", "JC", "6D", "AH", "9H", "5S", "KS", "8C", "3D", "JD", "6H", "2S", "TS", "5C", "KC", "8D", "3H", "JH", "7S", "2C", "TC", "5D", "KD", "8H", "4S", "QS", "7C", "2D", "TD", "5H", "KH"]
["AS", "5S", "9S", "KS", "4C", "8C", "QC", "3D", "7D", "JD", "2H", "6H", "TH", "2S", "6S", "TS", "AC", "5C", "9C", "KC", "4D", "8D", "QD", "3H", "7H", "JH", "3S", "7S", "JS", "2C", "6C", "TC", "AD", "5D", "9D", "KD", "4H", "8H", "QH", "4S", "8S", "QS", "3C", "7C", "JC", "2D", "6D", "TD", "AH", "5H", "9H", "KH"]
["AS", "3S", "5S", "7S", "9S", "JS", "KS", "2C", "4C", "6C", "8C", "TC", "QC", "AD", "3D", "5D", "7D", "9D", "JD", "KD", "2H", "4H", "6H", "8H", "TH", "QH", "2S", "4S", "6S", "8S", "TS", "QS", "AC", "3C", "5C", "7C", "9C", "JC", "KC", "2D", "4D", "6D", "8D", "TD", "QD", "AH", "3H", "5H", "7H", "9H", "JH", "KH"]
["AS", "2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "TS", "JS", "QS", "KS", "AC", "2C", "3C", "4C", "5C", "6C", "7C", "8C", "9C", "TC", "JC", "QC", "KC", "AD", "2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "TD", "JD", "QD", "KD", "AH", "2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", "TH", "JH", "QH", "KH"]
["AS", "AD", "2S", "2D", "3S", "3D", "4S", "4D", "5S", "5D", "6S", "6D", "7S", "7D", "8S", "8D", "9S", "9D", "TS", "TD", "JS", "JD", "QS", "QD", "KS", "KD", "AC", "AH", "2C", "2H", "3C", "3H", "4C", "4H", "5C", "5H", "6C", "6H", "7C", "7H", "8C", "8H", "9C", "9H", "TC", "TH", "JC", "JH", "QC", "QH", "KC", "KH"]
["AS", "AC", "AD", "AH", "2S", "2C", "2D", "2H", "3S", "3C", "3D", "3H", "4S", "4C", "4D", "4H", "5S", "5C", "5D", "5H", "6S", "6C", "6D", "6H", "7S", "7C", "7D", "7H", "8S", "8C", "8D", "8H", "9S", "9C", "9D", "9H", "TS", "TC", "TD", "TH", "JS", "JC", "JD", "JH", "QS", "QC", "QD", "QH", "KS", "KC", "KD", "KH"]

1
สัญลักษณ์แทนสตริงจะช่วยให้คุณประหยัด 2 ตัวอักษรa=(0..51).map{|i|:A23456789TJQK[i/4]+:SCDH[i%4]}
กำหนด

@ArtemIce โทรดีด้วยเหตุผลบางอย่างที่ฉันคิดว่าฉันได้ลองใช้แล้วไม่สำเร็จ ขอบคุณสำหรับทิป!
Paul Prestidge

1
ยินดี! อีกแนวคิดหนึ่งคือเราสามารถใช้popแทนslice!และบันทึกได้ 6 ตัวอักษร 9.times{p a;a=a.zip(a.pop 26).flatten}
defhlt

3

Python3, 180 179

from itertools import*;i=list(map("".join,product("A23456789XJQK","SCDH")));exec('print(",".join(i).replace("X","10"));i=list(chain(*zip(islice(i,0,26,1),islice(i,26,52,1))));'*8)

เอาต์พุตบรรทัดเหมือนในภารกิจ

รูปแบบดั้งเดิม 151

from itertools import*;i=list(map("".join,product("A23456789TJQK","SCDH")));exec('print(i);i=list(chain(*zip(islice(i,0,26,1),islice(i,26,52,1))));'*8)

เอาต์พุตเหมือนในเวอร์ชัน Ruby


1
ฉันคิดว่าคุณสามารถประหยัดถ่านได้โดยการเว้นช่องว่างระหว่างimportและ*: ideone.com/kQTbs
Cristian Lupascu

หากคุณใช้ 2.x คุณควรจะสามารถปล่อยรายการแรก () เนื่องจาก map () ส่งคืนรายการไม่ใช่ตัวสร้าง
Joel Cornett

3

GolfScript, 51 50 46 ตัวอักษร

"A23456789TJQK"4*"SCDH"13*]{zip""*2/.p 26/}9*;

รหัส GolfScript นี้ให้ผลลัพธ์ต่อไปนี้ (ดูที่นี่ ):

["AS" "2C" "3D" "4H" "5S" "6C" "7D" "8H" "9S" "TC" "JD" "QH" "KS" "AC" "2D" "3H" "4S" "5C" "6D" "7H" "8S" "9C" "TD" "JH" "QS" "KC" "AD" "2H" "3S" "4C" "5D" "6H" "7S" "8C" "9D" "TH" "JS" "QC" "KD" "AH" "2S" "3C" "4D" "5H" "6S" "7C" "8D" "9H" "TS" "JC" "QD" "KH"]
["AS" "AD" "2C" "2H" "3D" "3S" "4H" "4C" "5S" "5D" "6C" "6H" "7D" "7S" "8H" "8C" "9S" "9D" "TC" "TH" "JD" "JS" "QH" "QC" "KS" "KD" "AC" "AH" "2D" "2S" "3H" "3C" "4S" "4D" "5C" "5H" "6D" "6S" "7H" "7C" "8S" "8D" "9C" "9H" "TD" "TS" "JH" "JC" "QS" "QD" "KC" "KH"]
["AS" "AC" "AD" "AH" "2C" "2D" "2H" "2S" "3D" "3H" "3S" "3C" "4H" "4S" "4C" "4D" "5S" "5C" "5D" "5H" "6C" "6D" "6H" "6S" "7D" "7H" "7S" "7C" "8H" "8S" "8C" "8D" "9S" "9C" "9D" "9H" "TC" "TD" "TH" "TS" "JD" "JH" "JS" "JC" "QH" "QS" "QC" "QD" "KS" "KC" "KD" "KH"]
["AS" "7S" "AC" "7C" "AD" "8H" "AH" "8S" "2C" "8C" "2D" "8D" "2H" "9S" "2S" "9C" "3D" "9D" "3H" "9H" "3S" "TC" "3C" "TD" "4H" "TH" "4S" "TS" "4C" "JD" "4D" "JH" "5S" "JS" "5C" "JC" "5D" "QH" "5H" "QS" "6C" "QC" "6D" "QD" "6H" "KS" "6S" "KC" "7D" "KD" "7H" "KH"]
["AS" "4S" "7S" "TS" "AC" "4C" "7C" "JD" "AD" "4D" "8H" "JH" "AH" "5S" "8S" "JS" "2C" "5C" "8C" "JC" "2D" "5D" "8D" "QH" "2H" "5H" "9S" "QS" "2S" "6C" "9C" "QC" "3D" "6D" "9D" "QD" "3H" "6H" "9H" "KS" "3S" "6S" "TC" "KC" "3C" "7D" "TD" "KD" "4H" "7H" "TH" "KH"]
["AS" "9S" "4S" "QS" "7S" "2S" "TS" "6C" "AC" "9C" "4C" "QC" "7C" "3D" "JD" "6D" "AD" "9D" "4D" "QD" "8H" "3H" "JH" "6H" "AH" "9H" "5S" "KS" "8S" "3S" "JS" "6S" "2C" "TC" "5C" "KC" "8C" "3C" "JC" "7D" "2D" "TD" "5D" "KD" "8D" "4H" "QH" "7H" "2H" "TH" "5H" "KH"]
["AS" "5S" "9S" "KS" "4S" "8S" "QS" "3S" "7S" "JS" "2S" "6S" "TS" "2C" "6C" "TC" "AC" "5C" "9C" "KC" "4C" "8C" "QC" "3C" "7C" "JC" "3D" "7D" "JD" "2D" "6D" "TD" "AD" "5D" "9D" "KD" "4D" "8D" "QD" "4H" "8H" "QH" "3H" "7H" "JH" "2H" "6H" "TH" "AH" "5H" "9H" "KH"]
["AS" "3D" "5S" "7D" "9S" "JD" "KS" "2D" "4S" "6D" "8S" "TD" "QS" "AD" "3S" "5D" "7S" "9D" "JS" "KD" "2S" "4D" "6S" "8D" "TS" "QD" "2C" "4H" "6C" "8H" "TC" "QH" "AC" "3H" "5C" "7H" "9C" "JH" "KC" "2H" "4C" "6H" "8C" "TH" "QC" "AH" "3C" "5H" "7C" "9H" "JC" "KH"]
["AS" "2C" "3D" "4H" "5S" "6C" "7D" "8H" "9S" "TC" "JD" "QH" "KS" "AC" "2D" "3H" "4S" "5C" "6D" "7H" "8S" "9C" "TD" "JH" "QS" "KC" "AD" "2H" "3S" "4C" "5D" "6H" "7S" "8C" "9D" "TH" "JS" "QC" "KD" "AH" "2S" "3C" "4D" "5H" "6S" "7C" "8D" "9H" "TS" "JC" "QD" "KH"]

1
เนื่องจากบัตรที่สามารถเริ่มต้นในลำดับใด ๆ และตั้งแต่ GCD (13, 4) = 1 คุณสามารถแทนที่โดย{...}% 4*
Peter Taylor

@PeterTaylor ขอบคุณ ไม่ได้อ่านความคิดเห็น "ในลำดับใด ๆ "
Howard

3

Perl, 91 ตัวอักษร

ข้อเสนอแนะใด ๆ เกี่ยวกับวิธีการกระชับดาดฟ้าเริ่มต้นมากขึ้น? วิธีการของฉันใช้ 2 แทนการสร้างและจากนั้นการแข่งขันระดับโลกในบริบทรายการในการเริ่มต้น$_@_

สับจะทำแล้วด้วยซ้ำspliceไอเอ็นจี@_บน@aและ interleaving ทั้งสองรายการที่มีกลับเข้ามาmap@_

s//A23456789TJQK/,s/(.)/$1S$1C$1D$1H/g,@_=/../g;say@_=map{shift@_,$_}@a=splice@_,26for 0..8

3

Mathematica 131 129 120 114 100 86 ตัวอักษร

ด้วยความช่วยเหลือจาก Mr.Wizard:

NestList[Riffle @@ #~Partition~26 &, # <> "" & /@ Tuples@Characters@
{"A23456789TJQK", "HDCS"}, 8]

เอาท์พุท:

สับ


MrWizard แนะนำให้ลดสิ่งนี้ลงเป็น 86 ตัวอักษรNestList[Riffle@@#~Partition~26&,#<>""&/@Tuples@Characters@{"A23456789TJQK","HDCS"},8]
Peter Taylor

ฉันทำ. เพรียวลมสวยมาก StringJoinโดยเฉพาะอย่างยิ่งผมชอบเคล็ดลับในการลด
DavidC

2

CJam, 34 ไบต์

CJam ใหม่กว่าคำถามดังนั้นคำตอบนี้ไม่ได้แข่งขันกับเครื่องหมายถูกสีเขียว แต่ฉันคิดว่านี่เป็นปัญหาที่ดีในการลองใช้ CJam

A,2>s"TJQKA"+"SCDH"m*{_p26/z:~}8*p

ทดสอบที่นี่

มันพิมพ์ผลลัพธ์เช่น

["2S" "2C" "2D" "2H" "3S" "3C" "3D" "3H" "4S" "4C" "4D" "4H" "5S" "5C" "5D" "5H" "6S" "6C" "6D" "6H" "7S" "7C" "7D" "7H" "8S" "8C" "8D" "8H" "9S" "9C" "9D" "9H" "TS" "TC" "TD" "TH" "JS" "JC" "JD" "JH" "QS" "QC" "QD" "QH" "KS" "KC" "KD" "KH" "AS" "AC" "AD" "AH"]
["2S" "8D" "2C" "8H" "2D" "9S" "2H" "9C" "3S" "9D" "3C" "9H" "3D" "TS" "3H" "TC" "4S" "TD" "4C" "TH" "4D" "JS" "4H" "JC" "5S" "JD" "5C" "JH" "5D" "QS" "5H" "QC" "6S" "QD" "6C" "QH" "6D" "KS" "6H" "KC" "7S" "KD" "7C" "KH" "7D" "AS" "7H" "AC" "8S" "AD" "8C" "AH"]
["2S" "5C" "8D" "JH" "2C" "5D" "8H" "QS" "2D" "5H" "9S" "QC" "2H" "6S" "9C" "QD" "3S" "6C" "9D" "QH" "3C" "6D" "9H" "KS" "3D" "6H" "TS" "KC" "3H" "7S" "TC" "KD" "4S" "7C" "TD" "KH" "4C" "7D" "TH" "AS" "4D" "7H" "JS" "AC" "4H" "8S" "JC" "AD" "5S" "8C" "JD" "AH"]
["2S" "TS" "5C" "KC" "8D" "3H" "JH" "7S" "2C" "TC" "5D" "KD" "8H" "4S" "QS" "7C" "2D" "TD" "5H" "KH" "9S" "4C" "QC" "7D" "2H" "TH" "6S" "AS" "9C" "4D" "QD" "7H" "3S" "JS" "6C" "AC" "9D" "4H" "QH" "8S" "3C" "JC" "6D" "AD" "9H" "5S" "KS" "8C" "3D" "JD" "6H" "AH"]
["2S" "6S" "TS" "AS" "5C" "9C" "KC" "4D" "8D" "QD" "3H" "7H" "JH" "3S" "7S" "JS" "2C" "6C" "TC" "AC" "5D" "9D" "KD" "4H" "8H" "QH" "4S" "8S" "QS" "3C" "7C" "JC" "2D" "6D" "TD" "AD" "5H" "9H" "KH" "5S" "9S" "KS" "4C" "8C" "QC" "3D" "7D" "JD" "2H" "6H" "TH" "AH"]
["2S" "4S" "6S" "8S" "TS" "QS" "AS" "3C" "5C" "7C" "9C" "JC" "KC" "2D" "4D" "6D" "8D" "TD" "QD" "AD" "3H" "5H" "7H" "9H" "JH" "KH" "3S" "5S" "7S" "9S" "JS" "KS" "2C" "4C" "6C" "8C" "TC" "QC" "AC" "3D" "5D" "7D" "9D" "JD" "KD" "2H" "4H" "6H" "8H" "TH" "QH" "AH"]
["2S" "3S" "4S" "5S" "6S" "7S" "8S" "9S" "TS" "JS" "QS" "KS" "AS" "2C" "3C" "4C" "5C" "6C" "7C" "8C" "9C" "TC" "JC" "QC" "KC" "AC" "2D" "3D" "4D" "5D" "6D" "7D" "8D" "9D" "TD" "JD" "QD" "KD" "AD" "2H" "3H" "4H" "5H" "6H" "7H" "8H" "9H" "TH" "JH" "QH" "KH" "AH"]
["2S" "2D" "3S" "3D" "4S" "4D" "5S" "5D" "6S" "6D" "7S" "7D" "8S" "8D" "9S" "9D" "TS" "TD" "JS" "JD" "QS" "QD" "KS" "KD" "AS" "AD" "2C" "2H" "3C" "3H" "4C" "4H" "5C" "5H" "6C" "6H" "7C" "7H" "8C" "8H" "9C" "9H" "TC" "TH" "JC" "JH" "QC" "QH" "KC" "KH" "AC" "AH"]
["2S" "2C" "2D" "2H" "3S" "3C" "3D" "3H" "4S" "4C" "4D" "4H" "5S" "5C" "5D" "5H" "6S" "6C" "6D" "6H" "7S" "7C" "7D" "7H" "8S" "8C" "8D" "8H" "9S" "9C" "9D" "9H" "TS" "TC" "TD" "TH" "JS" "JC" "JD" "JH" "QS" "QC" "QD" "QH" "KS" "KC" "KD" "KH" "AS" "AC" "AD" "AH"]

คำอธิบาย

A,2>s"TJQKA"+"SCDH"m*{_p26/z:~}8*p
A,                                 "Get the range from 0 to 9.";
  2>                               "Slice off first two elements.";
    s                              "Convert to string '23456789'.";
     "TJQKA"+                      "Append this string.";
             "SCDH"                "Push the suits.";
                   m*              "Take the Cartesian product. This yields the first line.";
                     {        }8*  "Execute this block 8 times.";
                      _p           "Duplicate the last line and print it.";
                        26/        "Split the array into halves.";
                           z       "Zip, i.e. transpose the array.";
                            :~     "Flatten the array.";
                                 p "Print the final deck.";

คุณช่วยอธิบายรหัสของคุณได้ไหม ฉันอยากรู้.
Thrax

@Thrax เรียบร้อยแล้ว ลืมไปเลยอย่างสิ้นเชิง
Martin Ender

ขอบคุณมาก ทางออกที่ดีฉันชอบที่A,2>จะได้รับตัวเลขความคิดที่ดี!
Thrax


0

/// , 753 ไบต์

/*/\/\///}/S,*'/C,*"/D,*;/H,*b/A'*c/A"*d/A;*e/2}*f/2'*g/2"*h/2;*i/3}*j/3'*k/3"*l/3;*m/4}*n/4'*o/4"*p/4;*q/5}*r/5'*s/5"*t/5;*u/6}*v/6'*w/6"*x/6;*y/7}*z/7'*-/7"*B/7;*+/8}*!/8'*E/8"*F/8;*G/9}*@/9'*I/9"*_/9;*(/10}*L/10'*M/10"*N/10;*O/J}*P/J'*)/J"*R/J;*$/Q}*T/Q'*U/Q"*V/Q;*W/K}*X/K'*Y/K"*{/KH
A}/A}bcdefghijklmnopqrstuvwxyz-B+!EFG@I_(LMNOP)R$TUVWXY{-bBc+d!eEfFgGh@iIj_k(lLmMnNoOpPq)rRs$tTuUvVwWxXyYz{n-NboBOcp+Pdq!)erERfsF$gtGThu@UivIVjw_Wkx(XlyLYmzM{GnT-hNub@oUBiOvcIpV+jPwd_qW!k)xe(rXElRyfLsYFm$zgMt{qGWn!Tk-)hxNeu(br@XoEUlBRiyOfvLcsIYpFVm+$jzPgwMdt_{iqyGOWfnv!LTcks-I)YhpxFNVemu+($bjrz@PXgowEMUdltB_R{eimquy+G(O$Wbfjnrvz!@LPTXcgkosw-EIM)UYdhlptxBF_NRV{cegikmoqsuwy-+EGI(MO)$UWYbdfhjlnprtvxzB!F@_LNPRTVX{bcdefghijklmnopqrstuvwxyz-B+!EFG@I_(LMNOP)R$TUVWXYKH

ลองออนไลน์!

ใช้เอาต์พุตตัวอย่าง (เหมาะอย่างยิ่งสำหรับวัตถุประสงค์นี้) โดยไม่มีช่องว่างต่อท้าย


0

05AB1E , 24 ไบต์

2TŸ.•-Ÿ•S«.•ôì•âJ9F=2äζ˜

ใช้การ์ดตัวพิมพ์เล็กเพื่อบันทึก 2 ไบต์ด้วยการบีบอัดเนื่องจากเอาต์พุตใด ๆ ที่มนุษย์สามารถอ่านได้จะได้รับอนุญาต
เด็คเริ่มต้น / สิ้นสุดคือ:

['2c','2d','2h','2s','3c','3d','3h','3s','4c','4d','4h','4s','5c','5d','5h','5s','6c','6d','6h','6s','7c','7d','7h','7s','8c','8d','8h','8s','9c','9d','9h','9s','10c','10d','10h','10s','ac','ad','ah','as','jc','jd','jh','js','qc','qd','qh','qs','kc','kd','kh','ks']

ลองใช้ออนไลน์ (PS: ใช้ TIO รุ่นเก่าเพราะเร็วกว่า .. ตัวสร้างทั้งหมดที่ใช้ในคำตอบนี้จะเหมือนกันทั้งใน Python legacy และ Elixir เขียนใหม่รุ่น 05AB1E อย่างไรก็ตาม)

คำอธิบาย:

2TŸ           # List in the range [2,10]: [2,3,4,5,6,7,8,9,10]
   .•-Ÿ•      # Compressed string "ajqk"
        S     # As a list of characters: ["a","j","q","k"]
         «    # Merge the lists together: [2,3,4,5,6,7,8,9,10,"a","j","q","k"] 
.•ôì•         # Compressed string "cdhs"
     â        # Create each possible pair (cartesian product)
      J       # Join each pair together (now we have our deck of cards)
9F            # Loop 9 times:
  =           #  Print the deck with trailing newline, without popping the deck
   2ä         #  Split it in two equal parts
     ζ        #  Zip it (swap rows/columns)
      ˜       #  Flatten the list of lists

ดู 05AB1E นี้เคล็ดลับของฉัน (ส่วนวิธีการบีบอัดสตริงไม่ใช่ส่วนหนึ่งของพจนานุกรม? )จะเข้าใจว่าทำไม.•-Ÿ•เป็น"ajqk"และ.•ôì•เป็น"cdhs"เป็น


0

Japt , 31 ไบต์

9o åÈó c}"SCDH"ï"TJQKA"i2ò9 ¬¹w

ลองมัน!

ถึงแม้ว่า Japt จะมีฟังก์ชั่น "interleave two list" ที่สมเหตุสมผล แต่มันก็ไม่ได้มีตัวเลือก แต่ฉันเลือกที่จะยกเลิกการสลับไพ่และเพียงแค่แสดงขั้นตอนเหล่านั้นในสิ่งที่ตรงกันข้าม

คำอธิบาย:

9o                           ¹     Generate 9 rows, starting with...
         "SCDH"                      The suits
               ï                     Cartesian product with...
                "TJQKA"                The "special" card values
                       i               Concatenated with...
                        2ò9 ¬          Digits 2-9 as a string; i.e. "23456789"
   å    }                          And getting each subsequent row by "unshuffling":
    Èó                               Separate every-other card; e.g. [1,2,3,4,5,6] -> [[1,3,5],[2,4,6]]
       c                             and flatten the two lists; e.g. [[1,3,5],[2,4,6]] -> [1,3,5,2,4,6]
                              w    Display in reverse order

ฉันสามารถบันทึก 2 ไบต์ถ้าฉันสามารถใช้ 1 สำหรับเอซแทน A แต่ไม่มีคำตอบอื่นใดที่ทำ


0

Perl 6 , 69 ไบต์

([o] {.say;.[flat ^26 Z 26..*]}xx 9)(«A {2..10} J Q K»X~ <S C D H>)

ลองออนไลน์!

  • { .say; .[flat ^26 Z 26..*] } เป็นฟังก์ชั่นที่ไม่ระบุชื่อที่พิมพ์รายการอาร์กิวเมนต์แล้วส่งกลับการสลับที่สมบูรณ์แบบของรายการนั้น
  • xx 9 สร้างรายการที่มีเก้าสำเนาของฟังก์ชันที่ไม่ระบุชื่อนั้น
  • [o]ลดรายการนั้นด้วยโอเปอเรเตอร์การจัดองค์ประกอบฟังก์ชั่นการoผลิตฟังก์ชั่นที่เรียกฟังก์ชั่นนิรนามเดิมเก้าครั้งผ่านรายการแบบสับลงแต่ละระดับ
  • ในที่สุดเด็คที่ไม่มีการสับเดิมจะถูกส่งไปยังฟังก์ชันที่ประกอบ «A {2..10} J Q K»คือรายการของการจัดอันดับให้<S C D H>เป็นรายการของชุดและผลิตสินค้าข้ามของรายการเหล่านั้นกับผู้ประกอบการX~ concatenation สตริง~

โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.