Skip to main content
Commonmark migration
Source Link

#Japt, 37 bytes

Japt, 37 bytes

##Explanation "AJQKA" :String literal i1 :Insert at (0-based) index 1 Aò2 : Range [2,10] q : Join ) :End insert ø :Does that string contain any element in the following array? U :Input ñ :Sort Ì : By last element (grouping suits together) òÏ :Partition between X & Y where Ì : Last element of Y ¦ : Does not equal XÌ : Last element of X Ã :End partition Ë :Map m : Map Î : First elements (card values) ¬ : Join ú5 : Right pad with spaces to length 5 á5 : Permutations of length 5 Ã :End map c :Flatten

Explanation

"AJQKA"                                   :String literal
       i1                                 :Insert at (0-based) index 1
         Aò2                              :  Range [2,10]
             q                            :  Join
              )                           :End insert
               ø                          :Does that string contain any element in the following array?
                U                         :Input
                 ñ                        :Sort
                  Ì                       : By last element (grouping suits together)
                   òÏ                     :Partition between X & Y where
                     Ì                    :  Last element of Y
                      ¦                   :  Does not equal
                       XÌ                 :  Last element of X
                         Ã                :End partition
                          Ë               :Map
                           m              :  Map
                            Î             :   First elements (card values)
                             ¬            :  Join
                              ú5          :  Right pad with spaces to length 5
                                 á5       :  Permutations of length 5
                                   Ã      :End map
                                    c     :Flatten

#Japt, 37 bytes

##Explanation "AJQKA" :String literal i1 :Insert at (0-based) index 1 Aò2 : Range [2,10] q : Join ) :End insert ø :Does that string contain any element in the following array? U :Input ñ :Sort Ì : By last element (grouping suits together) òÏ :Partition between X & Y where Ì : Last element of Y ¦ : Does not equal XÌ : Last element of X Ã :End partition Ë :Map m : Map Î : First elements (card values) ¬ : Join ú5 : Right pad with spaces to length 5 á5 : Permutations of length 5 Ã :End map c :Flatten

Japt, 37 bytes

Explanation

"AJQKA"                                   :String literal
       i1                                 :Insert at (0-based) index 1
         Aò2                              :  Range [2,10]
             q                            :  Join
              )                           :End insert
               ø                          :Does that string contain any element in the following array?
                U                         :Input
                 ñ                        :Sort
                  Ì                       : By last element (grouping suits together)
                   òÏ                     :Partition between X & Y where
                     Ì                    :  Last element of Y
                      ¦                   :  Does not equal
                       XÌ                 :  Last element of X
                         Ã                :End partition
                          Ë               :Map
                           m              :  Map
                            Î             :   First elements (card values)
                             ¬            :  Join
                              ú5          :  Right pad with spaces to length 5
                                 á5       :  Permutations of length 5
                                   Ã      :End map
                                    c     :Flatten
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#Japt, 37 bytes

Takes input as a 2D array.

"AJQKA"i1Aò2 q)øUñÌòÏ̦XÌÃËmάú5 á5Ãc

Try it


##Explanation "AJQKA" :String literal i1 :Insert at (0-based) index 1 Aò2 : Range [2,10] q : Join ) :End insert ø :Does that string contain any element in the following array? U :Input ñ :Sort Ì : By last element (grouping suits together) òÏ :Partition between X & Y where Ì : Last element of Y ¦ : Does not equal XÌ : Last element of X Ã :End partition Ë :Map m : Map Î : First elements (card values) ¬ : Join ú5 : Right pad with spaces to length 5 á5 : Permutations of length 5 Ã :End map c :Flatten