[Question]
  [
# Challenge
Bar Dice is a simple game played in a Bar with Dice (hence the name). You roll 5 six-sided dice and attempt to make the best hand. 
> 
> Scoring is based on amassing the largest number of dice with the same digits. Each hand must include at least a single "Ace", or one, in order to be a valid hand; Aces act as "wilds", and can be paired with any other digit. The strength of a player's hand depends first on the number of digits and then value of those digits. As an example, a hand (counting wilds) with four 3's is better than a hand with three 5's, but not better than a hand with five 2's.  
> 
> Taken from [the Wikipedia article](https://en.wikipedia.org/wiki/Bar_dice)
> 
> 
> 
This means the highest ranked hand is made entirely of 6's and 1's, and the lowest ranked is any hand without a 1. 
Your challenge is to take two hands and return which player won, or if they tied.
# Input
Two unsorted lists of 5 numbers, ranging from 1 to 6. Each list represents a player's hand. The input format is flexible.
# Output
Any three distinct but consistent, static values (ranges are not allowed) signifying whether player 1 or player 2 won, or if it was a tie. Please state in your answer what values you are using for what. For example, you can return `-1` if P1 wins, `0` if it's a tie, and `1` if P2 wins.
# Rules
* Input will always be valid
* Only the best possible score of each hand is used to determine a winner. There are no tie-breakers. E.g., `[1,4,4,3,3]` will tie `[1,4,4,2,2]` instead of using the 3's and 2's as a tie-breaker.
* Output must be one of the 3 chosen values every time. Simply mapping all negative numbers to `P1 Wins` is not allowed and must be normalized.
* Invalid hands, i.e. those with no 1's, lose to all valid hands but tie with all other invalid hands. E.g., `[2,2,2,2,2]` ties `[3,3,3,3,3]`.
* A hand of `[1,1,1,1,1]` counts as a valid set of 6's for ranking purposes.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest byte count wins.
# Examples
```
#You guys are pretty good at finding edge-cases that break things. Good job!
Input:  [2,1,5,6,6], [6,2,6,6,6]
Output: P1 Wins
Input:  [2,4,5,6,6], [6,2,6,6,6]
Output: Tie
Input:  [1,2,3,4,5], [5,4,3,2,1]
Output: Tie
Input:  [1,5,5,3,2], [5,4,1,6,6]
Output: P2 Wins
Input:  [3,2,2,2,1], [4,1,3,6,6]
Output: P1 Wins
Input:  [1,1,1,1,1], [6,1,1,6,6]
Output: Tie
Input:  [1,3,3,4,4], [1,2,2,5,5]
Output: P2 Wins
Input:  [1,3,3,5,5], [1,3,3,2,2]
Output: P1 Wins
Input:  [1,3,3,3,4], [1,1,3,3,3]
Output: P2 Wins
Input:  [2,2,2,6,1], [5,3,3,1,2]
Output: P1 Wins
Input:  [5,5,5,1,5], [1,1,1,1,1]
Output: P2 Wins
Input:  [1,1,1,1,1], [1,1,5,1,1]
Output: P1 Wins
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~17~~ 14 bytes
```
ċⱮ6Ḣ©+$®aĖUṀ)M
```
[Try it online!](https://tio.run/##TY89DsIwDIX3noKBBeHFSZNbMDJVGRhYUC/AhlgY2BgQMxsSqtSNrqUcJL1IsJNajbzY/t7zz2Ff18cQhuvYNtZ/nv1rveyb3XDf@u602oTvZTy/fzffPUKoiqpSgGDAgnWwoEJDyaVzEFk5MwuKU2EIk5iZoURTA4UZCmoIw9nHMhWlxJjofOYUaR/mPhbyvpIZxhG0JGcm3ZIK4jnT4ptK@U/FpzDdyQTFZ@IPKDPlMFe4Pw "Jelly – Try It Online")
A monadic link that takes a list of the two lists as its argument and returns `[1]` for player 1 wins, `[2]` for player 2 wins and `[1, 2]` for a tie. TIO link tidies this up for display. 
Thanks to @JonathanAllan for saving 3 bytes!
### Explanation
```
            )   | For each input list (e.g. of one list 1,1,3,3,4)
ċⱮ6             | - Count each of 1..6 (e.g. 2,0,2,1,0,0)
      $         | - Following as a monad:
   Ḣ            |   - Head (number of 1s)
    ©︎           |   - Copy to register
     +          |   - Add (e.g. 2,4,3,0,0)
       ®a       | - Register logical and with this
         Ė      | - Enumerate (e.g. [1,2],[2,4],[3,3],[4,0],[5,0])
          U     | - Reverse each (e.g. [2,1],[4,2],[3,3],[0,4],[0,5])
            Ṁ   | - Max (e.g. 4,2)
              M | Index/indices of maximal score
```
[Answer]
# [R](https://www.r-project.org/), ~~115~~ 96 bytes
-6 bytes thanks to Giuseppe.
-6 bytes thanks to Aaron Hayman.
-2 bytes thanks to Arnauld, following the output format in his [JavaScript answer](https://codegolf.stackexchange.com/a/186462/86301).
```
function(i,j)(f(i)-f(j))/0
f=function(x,s=tabulate(x,6),l=s[1]+s[-1]*!!s[1])max(l)*6+order(l)[5]
```
[Try it online!](https://tio.run/##dY7NDkRAEITvnoLbNC27jXGQ9STiYC1CLImfxNvbnjERDpu5dM3XVV3T3tgv397rdSiXdhxEix2IWrTg16IDeDytOj3hhnO6FO@1L5aKRQzYp3NGuTdnPuWu4ygB32ITPbixN06fauIxk/neiFIESCgxVj67FDEGamYF1kGjv5QSibZM6NhUKRJDDPSmZB9dcvhfP9JUsfBCCc0zV@jmVbsh50Waks7hWzcantTos3@gO5NppRgnGCp1Z25@eo8WsP8A "R – Try It Online")
Returns `Inf` for P1, `NaN` for a tie, `-Inf` for P2.
Uses the helper function `f` which computes a score for each hand. The score is defined as follows: let `d` be the digit which is repeated the most, and `n` the number of times it is repeated. Then the score is `6*n+d` if there is at least one ace, and `0` if there are no aces. We then just need to find the player with the highest score.
Ungolfed: 
```
f = function(x) {
  s = tabulate(x, 6)         # number of occurrences of each integer
  l = s[1] + s[-1] * !!s[1]  # add the number of wild aces to all values; set to 0 if s[1] == 0
  max(l) * 6 +               # highest number of repetitions (apart from aces)
    order(l)[5]              # most repeated integer (take largest in case of tie)
}
function(i, j){
  sign(f(i) - f(j))
}
```
[Answer]
# JavaScript (ES6), ~~97~~ 90 bytes
Takes input as `(a)(b)`. Returns `+Infinity` for P1, `-Infinity` for P2 or `NaN` for a tie.
```
a=>b=>((g=(x,m)=>x>6?m*/1/.test(a):g(-~x,a.map(k=>n+=k<2|k==x,n=x/6)|m>n?m:n))()-g(a=b))/0
```
[Try it online!](https://tio.run/##hY/BTsMwEETvfEWOa3Bi7NQ@VKz7CxyQOEQc3JJGIY1TNVHlQ8WvBzsuEpSSai@71oxn3oc5mn5zqPdDarv3ctziaFCvUQNUCI62BLXTatXeM86yoewHMGRZQfrpqMlas4cGtX3A5kmcGkRHLTqmyKnVdtUuLSFA0goMrglhj@Oms323K7NdV8EWCkE5lVRR9UagUFSENRwkYSx55slrbfu7P57F/56XurzUcy/JgyfopV9y/8Dn9NKPF33r@c9O4mqn8KWI30IRHPltDk7PEzn4r5yrvfKJYxH0fIqTAWquV/TIyB4PEcDme@UxKXrO53xOpFeRRU4OfpkzfgE "JavaScript (Node.js) – Try It Online")
### Commented
```
a => b => (                 // a[] = dice of P1; b[] = dice of P2
  ( g = (                   // g is a recursive function taking:
      x,                    //   x = dice value to test; initially, it is either undefined
                            //       or set to a non-numeric value
      m                     //   m = maximum score so far, initially undefined
    ) =>                    //
      x > 6 ?               // if x is greater than 6:
        m * /1/.test(a)     //   return m, or 0 if a[] does not contain any 1 
      :                     // else:
        g(                  //   do a recursive call:
          -~x,              //     increment x (or set it to 1 if it's non-numeric)
          a.map(k =>        //     for each dice value k in a[]:
            n +=            //       add 1 to n if:
              k < 2 |       //         k is equal to 1
              k == x,       //         or k is equal to x
            n = x / 6       //       start with n = x / 6
          ) |               //     end of map()
          m > n ?           //     if m is defined and greater than n:
            m               //       pass m unchanged
          :                 //     else:
            n               //       update m to n
        )                   //   end of recursive call
  )()                       // first call to g, using a[]
  - g(a = b)                // subtract the result of a 2nd call, using b[]
) / 0                       // divide by 0 to force one of the 3 consistent output values
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~16~~ 15 bytes
*-1 byte thanks to JonathanAllan*
```
εWΘ*6L¢ć+°ƶà}ZQ
```
[Try it online!](https://tio.run/##yy9OTMpM/W/u9v/c1vBzM7TMfA4tOtKufWjDsW2HF9RGBf7X@R8dbaRjqGOqY6ZjFqujEG2mYwRiAjmxXCApE1xShkCeMUgaJGUKZBgDBQyhUqZACOTDpAzhukCKjMAKgVIgCWMkA6EQYpchki6QMpBdJiApQ7ABQBtiYwE "05AB1E – Try It Online")
Returns [1, 0] for P1 wins, [1, 1] for ties, [0, 1] for P2 wins.
Rather than using lexicographic order on a 2-tuple (dice count, dice value), this computes the score as 10\*\*dice count \* dice value. Hands without a 1 score 5.
```
ε           }           # map each hand to its computed score
 WΘ                     # minimum == 1 (1 if the hand contains a 1, 0 otherwise)
   *                    # multiply (sets hands without 1 to [0, 0, 0, 0, 0])
    6L                  # range [1..6]
      ¢                 # count occurences of each in the hand
       ć                # head extract (stack is now [2-count, ..., 6-count], 1-count)
        +               # add the 1-count to all the other counts
         °              # 10**x
          ƶ             # multiply each element by its 1-based index
           à            # take the maximum
Z                       # maximum
 Q                      # equality test (vectorizes)
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~85~~ ~~81~~ 80 bytes
```
lambda p:cmp(*[max((h.count(i)+h.count(i>1),i)*(1in h)for i in[6]+h)for h in p])
```
[Try it online!](https://tio.run/##bY3NDoMgEITvPsUeQUkTQG1iYl@Ekob@WEkqEoNJ@/R2Qeup2TnMzLcL/hP60Ymla8/LywzXuwHf3AZPcjWYNyH94TbOLhBLi92eOGWW5oRbBz3txgksWKdqXaypxwRe0yWGSwyTcc8HOdImA9Na5@dAaAZ@si5ARwxdlGCcVaxmtWagaiaixZAhKP8Djl5GGEGFRmLBE6hwMP0A3y7igkhLCGIt96e2Wf/g@wVnIJNKVIRYiKQKpb8 "Python 2 – Try It Online")
Returns `1` for P1, `0` for tie, and `-1` for P2.
-1 byte, thanks to squid
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~60~~ 49 bytes
```
&[cmp]o*.map:{.{1}&&max (.{2..6}X+.{1})Z ^5}o&bag
```
[Try it online!](https://tio.run/##hZJNa4NAEIbP8VcMIfiRyIbVrAdDDz30UCg0lNKWGlts0SL4RYzQIP52O7urJQa6ZWGd3X3emXcGq/iQeX1@Aj2Bq14PPvMqLJckjyq/JS3tdD2PvsEkrUOI172s@J31Cm@sK/WP6Kvfakl5ADNLi7i2oNVmdXQC4yGum@zog2GDaewceE6LGmPjMY35Z0fljRUk5mJNbp6u76wVDbXZLE1gfVtUDWr39RLrLq31ViadL973xRyAI/fNERl86fqBhoDawwptCDzbwxD3UJOsD1hb035pB5@ZAATt8PCcHixOFBulYpqfIuByBacZBi5e0L9phguRkb7wPozwTMHTOSIlKjjv/uf/Yj5UPR@ekPvfcJqKUmhR5UgqmOxYHlClduTKKlIxHFU1ZM@e7IEJnqprMDFZOroaR6Ds42xOVPwmU4Ws8QM "Perl 6 – Try It Online")
Returns `More`, `Same`, `Less` for `P1 Wins`, `Tie`, `P2 Wins`.
### Explanation
```
       *.map:  # Map input lists
                                             &bag  # Convert to Bag
             {                             }o  # Pass to block
              .{1}&&  # Return 0 if no 1s
                    max  # Maximum of
                         .{2..6}  # number of 2s,3s,4s,5s,6s
                                X+.{1}  # plus number of 1s
                        (             )Z     # zipped with
                                         ^5  # secondary key 0,1,2,3,4
&[cmp]o  # Compare mapped values
```
[Answer]
# T-SQL query, 147 bytes
Using table variable as input
> 
> p: player
> 
> 
> v: value for roll
> 
> 
> 
```
DECLARE @ table(p int,v int)
INSERT @ values(1,5),(1,5),(1,5),(1,5),(1,5)
INSERT @ values(2,4),(2,3),(2,3),(2,1),(2,4)
SELECT sign(min(u)+max(u))FROM(SELECT(p*2-3)*(s+sum(1+1/~s-1/v))*(s/5*5+v+30)u
FROM(SELECT*,sum(1/v)over(partition by p)s FROM @)c GROUP BY v,s,p)x
```
**[Try it online](https://data.stackexchange.com/stackoverflow/query/1205977/who-won-a-game-of-bar-dice)**
```
Player 1 wins returns -1
Tie returns 0 
Player 2 wins returns 1
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 21 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
crushed before I even posted it by Nick Kennedy :)
```
’-oÆṃṀ$$Ạ?fÆṃ$L;$o5)M
```
A monadic Link accepting a list of players which outputs a list of (1-indexed) winners. 
So P1 is `[1]`, P2 is `[2]` and a tie is `[1,2]`.
**[Try it online!](https://tio.run/##y0rNyan8//9Rw0zd/MNtD3c2P9zZoKLycNcC@zQwV8XHWiXfVNP3/@H2o5Me7pzx/390tKGOMRCa6JjE6igAOUZAaKpjGhsLAA "Jelly – Try It Online")**
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~112~~ ~~126~~ ~~123~~ 121 bytes
Takes input as `(a)(b)`. Returns `-1` for P1 win, `1` for P2 or `0` for a tie.
```
$args|%{$d=$($_-ne1|group|sort c*,n*|%{$m=$_};(7*(($o=($_-eq1).Count)+$m.Count)+$m.Name+6*!$m)[!$o])-$d}
[math]::Sign($d)
```
[Try it online!](https://tio.run/##dZJda8IwFIbv@ysyOY6kpmOnNR04CoXd72aXIiI204H9WFvZwPa3d0katepsKOTkPOfNm@QU@Y8sq63c7Tr4JBE5dLAqN1UzPkASAYWll0lsNmW@L5oqL2uydnnm6nQawbJ9pS8upZBHmpTfyJ7e8n1Wswmkg9n7KpWT0H2AlM0fIF8wD5LWmaereruYzT6@NhmFhHWt48TUIerjNKY@Ry54yEPGSUxD7uu5iTxkA2p6hyLPZwrVeqBJQwk1C9QK3lBCDZU5UXjUGuyoK31bHVPNBP/4Qm6H9YVnrYsdA@Nraig0usK4JHhNCeu@j3zj0ruhgpOWja@0eu@h9SUMgzdawtwEnnY8n4XcPSOa9@qj65sQF9RQi5GGjMnB0FAgh8LnIH8Lua5lojtD9SQs@3Qpq/2uVguPqlUVrH7fZEaqUYc1qhMtzGbHspHTdn8 "PowerShell – Try It Online")
Test case `@( @(1,1,5,1,1), @(1,1,1,1,1), 1)` added.
Unrolled:
```
$args|%{
    $score=$(                                            # powershell creates a new scope inside expression $(...)
        $_-ne1|group|sort count,name|%{$max=$_}          # $max is an element with the widest group and the maximum digit except 1
        $ones=($_-eq1).Count                             # number of 1s in a player's hand
        $scoreRaw=7*($ones+$max.Count)+$max.Name+6*!$max # where $max.Name is digit of the widest group
        $scoreRaw[!$ones]                                # output $scoreRaw if the array contains 1, otherwise output $null 
    )                                                    # powershell deletes all variables created inside the scope on exit
    $diff=$score-$diff
}
[math]::Sign($diff)                                     # output the score difference
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~78~~ ~~75~~ 74 bytes
*-1 byte by Greg Martin*
```
Order@@(#~FreeQ~1||Last@Sort[Reverse/@Tally@Flatten[#/. 1->Range@6]]&)/@#&
```
[Try it online!](https://tio.run/##dVHBaoQwFLz7FamCtBBrn268ueQkFArdbnsTD6GNreBaSEKhuLu/bpOnrbpQcshLZjIz7@UgzIc8CNO8iqHOh0f1JhXn18G5UFI@neF4fBDa8OdPZcq9/JJKy5i/iLb95kUrjJFdGcS3BKLtXnTvkmdVFd7EPAgHI7XRJCd93ycUKKMZzU60z2jiKlufSLQlEVDPETb/Ee4cDvYudRyLM7un9gwrnNllbycc5veo7/gJvqG9Q9PLAECnhQFgKTAZpBhgY3FAKWu4MBhxhgHH2nLWBukogYTptBAY82UYgCEKawGGLcLk8Jt2mWDuAHDef/iyxQRnNM5rbsE7ed5ONZ0p7@uy5gHJ85wECSX@Tmjt270QTXvlV6QKCeec4Od6ww8 "Wolfram Language (Mathematica) – Try It Online")
Outputs -1 when player 1 wins, 1 when player 2 wins, and 0 for a tie.
```
                                    Helper function to score a list:
FreeQ[#,1] ||                       If there are 0 1s, score is True
Last@Sort[                          Otherwise, take the largest element of
    Reverse/@Tally@                 the {frequency, number} pairs in the flat list
       Flatten[ #/. 1->Range@6]     where each 1 is replaced by {1,2,3,4,5,6}.
]&                              e.g. {1,3,3,5,5} -> {1,2,3,4,5,6,3,3,5,5} -> {3,5}
Order @@ (...) /@ #&                Apply this function to both lists,
                                    then find the ordering of the result.
```
[Answer]
# Java 8, ~~244~~ ~~240~~ ~~236~~ ~~215~~ 199 bytes
```
a->b->{int c[][]=new int[2][7],m[]=new int[2],p,i=5;for(;i-->0;c[1][b[i]]++)c[0][a[i]]++;for(i=14;i-->4;)m[p=i%2]=Math.max(m[p],c[p][1]>0?i/2+9*(c[p][i/2]+c[p][1]):0);return Long.compare(m[0],m[1]);}
```
-4 bytes thanks to *@someone*.  
-21 bytes thanks to *@Neil*.  
Returns `1` if P1 wins; `-1` if P2 wins; `0` if it's a tie.
[Try it online.](https://tio.run/##rZNda9swFIbv8ysOhYG9yJ6/x@rauxsMVhjkUuhCcZRUqS0bW24XQn57JsleS6lT5lIERtZ7zquj50h7@kCd/eb@XJS06@CWcnFcAHSSSl7AXqluL3npbntRSF4L98c4ueFCYoL@J@SnkGzH2jyHLWRwpk6@dvKjEqHABJNMsEfQoQHBXwmqXqygBvEsTrd1a6XccXIvLbBP8BpzQpZLu8AewXT4MUE88yMTGKV2hZuMfwpIdkvlnVvRP5ZaIahQH@WRe9/5l2D57bNlFtScLEfJvvbstGWybwX8qsXOLeqqoS1T@Z4uUEWkp3O6UKCafl0qUCOvh5pvoFIMrZVsudhhAtTWPAFWh06yyq176TZKkqWwrn6X9MBa8KG7q/tyA49cXF/Z6aX4rUubpjxY/@iQY4B8FKMEJSf7lZagQCtam2MZqjQ9/AnLSG0XzrfUSaGqM56wHDS14TzLocZkssrYWPpzLX00jskqNWej2abtb/YzeHc/9S66/GDyWBr/O@FHKJo8lqZoGjPfMrxgOarzLGNzcP/CFXlqzFvwVwPzNQMKkrO5Dyn66Iek4Wrw8YVehsMj@6grmhjlucrT4nT@Cw)
**Explanation:**
```
a->b->{                        // Method with 2 integer-array parameters & integer return
  int c[][]=new int[2][7],     //  Create a count-array for each value of both players,
                               //  initially filled with 0s
      m[]=new int[2],          //  The maximum per player, initially 0
      p,                       //  Temp-value for the player
  i=5;for(;i-->0;              //  Loop `i` in the range (5, 0]:
    c[1]                       //   For player 2:
        [b[i]                  //    Get the value of the `i`'th die,
             ]++)              //    and increase that score-count by 1
    c[0][a[i]]++;              //   Do the same for player 1
  for(i=14;i-->4;)             //  Then loop `i` in the range (14, 4]:
    m[p=i%2]=                  //   Set the score of a player to:
                               //   (even `i` = player 1; odd `i` = player 2)
      Math.max(                //    The max between:
        m[p],                  //     The current value,
                               //     And the value we calculate as follows:
        c[p][1]>0?             //     If this player rolled at least one 1:
          i/2                  //      Use the current value `i` integer-divided by 2
          +9*                  //      With 9 times the following added:
             (c[p][i/2]        //       The amount of dice for value `i//2`
              +c[p][1])        //       Add the amount of dice for value 1
        :                      //     Else (no 1s were rolled):
         0);                   //      Use 0
  return Long.compare(m[0],m[1]);}
                               //  Finally compare the maximum scores of the players,
                               //  resulting in -1 if a<b; 0 if a==b; 1 if a>b
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 27 bytes
```
’o5Rṗ5¤ṢŒr$€UẎṀ1e⁸¤×µ€_/Ṡo/
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw8x806CHO6ebHlrycOeio5OKVB41rQl9uKvv4c4Gw9RHjTsOLTk8/dBWoGC8/sOdC/L1////H22kY6JjqmOmYxaroxBtpmMEYgI5AA "Jelly – Try It Online")
1 for P1, -1 for P2, 0 for tie
# Explanation
```
’o5Rṗ5¤ṢŒr$€UẎṀ1e⁸¤×µ€_/Ṡo/  Main link
                    µ€       For each list
’                            Decrement each value (so 1s become falsy)
 o                           Vectorized logical or (this replaces previous 1s (now 0s) with the test values)
  5Rṗ5¤                      1..5 cartesian-power 5 (1,1,1,1,1; 1,1,1,1,2; 1,1,1,1,3; ...)
          $€                 For each test list
       ṢŒr                   Sort and run-length encode (gives [digit, #digit])
            U                Reverse each list (gives [#digit, digit])
             Ẏ               Tighten by one (gives a list containing each possible hand for each possible wildcard)
              Ṁ              Take the maximum
               1e⁸¤×         Multiply the list values by (whether or not the original contained a 1) - becomes [0, 0] if not
                      _/Ṡ    Take the sign of the difference between the #digits and the digits
                         o/  If the number of digits differs, then 1/-1 is returned; otherwise, check the value of the digit (could still be 0)
```
[Answer]
# [Sledgehammer 0.4](https://github.com/tkwa/Sledgehammer/commit/e5213349bfb06086de2100e3b05ce7cc1747c95d), 27 bytes
```
⢱⢙⢂⠠⡾⢃⠐⢈⠸⣞⠴⠻⠎⡥⡳⡐⢒⠘⢛⣩⡓⣮⡕⡠⣢⣡⠿
```
Decompresses into this Wolfram Language function: 
```
Order @@ (FreeQ[#1, 1] || Last[Sort[Reverse[Tally[Flatten[#1 /. 1 -> Range[6]]], 2]]] & ) /@ #1 & 
```
which turns out to be exactly the same as my [Mathematica answer](https://codegolf.stackexchange.com/a/186484/39328).
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~48~~ 45 bytes
```
ＵＭθ⮌Ｅ⁷№ι∨λ¹ＵＭθ×¬¬⊟ι⁺⊟ιιＵＭθ⟦⌈ι±⌕ι⌈ι⟧Ｉ⁻⌕θ⌈θ⌕θ⌊θ
```
[Try it online!](https://tio.run/##bY4/C8IwEMV3P0XGK8ShKjg4Ftxai7iFDKEGPWiSNk2L3z5e458ieNwN@d17edfclW@camMsVVc4Y5S9Qs/ZWU/aDxqIwp6zwo02AHJ28tBylmdzHVa/ngsaPUDlQpradYCk4qxux@H95Az/GEWpHmhGkwSVvqmg4Yi0o8BllWWSnLVHuqRQQ4ASLX2chP0i7OfIL0T7geniGIUQOWeb1DtqSfEEXmw7Aynjemqf "Charcoal – Try It Online") Link is to verbose version of code. Takes input as an array of arrays and outputs `-1` if player 1 wins, `0` for a tie, and `1` if player 2 wins. Explanation:
```
ＵＭθ⮌Ｅ⁷№ι∨λ¹
```
Replace each hand with the count of how many times the values `6..1` appear in the hand. The list is reversed because a) it makes it easier to find the highest value with the highest count and b) it makes it easier to remove the count of `1`s. The count of `1`s is doubled because it needs to be removed twice, once to check that it is nonzero and once to add it to the other counts.
```
ＵＭθ×¬¬⊟ι⁺⊟ιι
```
Add the count of `1`s to the counts for `6..2`, but set all of the counts to zero if the count of `1`s was zero.
```
ＵＭθ⟦⌈ι±⌕ι⌈ι⟧
```
For each hand find the highest count and the highest value with that count. (Actually we find value minus `6` as that's golfier.)
```
Ｉ⁻⌕θ⌈θ⌕θ⌊θ
```
Determine which hand won by subtracting the positions of the winning and losing hands. (If the hands are tied then the first hand is both winning and losing so the result is `0` as desired.)
[Answer]
# [C (gcc)](https://gcc.gnu.org/) / 32 bit, 117 bytes
```
t;m;s(int*r){int c[6]={};for(m=0;t=*r++;m=t>m?t:m)c[--t]+=5,t=t?c[t]+t:5;t=*c?*c+m:0;}f(a,b){t=s(a)-s(b);t=(t>0)-!t;}
```
[Try it online!](https://tio.run/##fVJBboMwEDzDK1yqSjaYFkPIAcfJF3qo1APlQJyQWgqkwu6liK@X2qZAIlWVD96d2R2PtcvDE@fDoGhNJRSN8lvU6QvwfF2wrqfVpYU1i6hifhsEtGZqW@9UViOeh6EqApZixdSO5zpWWWrq@M7nQZ1FtK9gifeoU0zCEoUS7pHmodpGKLxTtB/uRcPPn4cj2Eh1EJfH963rmsfrUjQQgc51TKbyQpsBzOROF2OCU7zWJ@ox6NY4tolNR371L080kNgay6c6TLARnflUHwPNPLnuN0w8NYDOsMmt/nR@3ye3/abcvL8aeWLF0tHOwqeTvzGNRzsLnyz9EzD/P7ZfJpN/w5GlP7XaZNG/svuHf2JLx9R1euo6eiOA2RQg9FoAsZHi63ipoEJPv5GvkMYDFtsJ2hG2enq6JBcF1uMUASmQVnI@Wk1W0HuQb42HTRUDBOyA90zAq2ikB7IRjCwYz6D3Io6ekejdfvjm1bk8ySGsk/gH "C (gcc) – Try It Online")
Takes two zero-terminated integer arrays. Returns `1`, `0`, `-1` for `P1 Wins`, `P2 Wins`, `Tie`.
[Answer]
# [J](http://jsoftware.com/), ~~47~~ 44 bytes
```
*@-&([:({.([:>./#\@]+9^*@[*+)}.)1#.i.@6=/<:)
```
[Try it online!](https://tio.run/##fZBNC8IwDIbv@xXBgVs31y37AouTgeDJk9f5cRCHevEHiL@9pmllU0FeUtI@yZtsNz2RQQ@NggBmkIGiSCSstpu1jtpkGnYqfEg6lzL1d@0@nh@itoti8ZQCfXmVbd2kCyW08Lzz6XIHhAZyOiuoST1Fzlltcca4/IeRngou6SlKysnP4iMyr0jm1XIc2g02IOcVeobFt/tbZjiOu517wdNL4shGNG1wt7ji5WxOJT/thWt3t/GfyfmDkXc3ED/aKxY6e6fx9GF55DKD9Qs "J – Try It Online")
Inspired by Nick Kennedy's idea.
## ungolfed
```
*@-&([: ({. ([: >./ #\@] + 9 ^ *@[ * +) }.) 1 #. i.@6 =/ <:)
```
[Answer]
# [Perl 5](https://www.perl.org/) `-MList::Util=max -pl`, 80 bytes
```
sub t{$t=pop;$_=max map$_ x$t=~s/$_//g,2..6;/./;$t&&$_.$t*($&||6)}$_=t($_)<=>t<>
```
[Try it online!](https://tio.run/##FY3BCoMwEAXv/YoclqClJkYwB2P8gvbYc7BQSkDN0mxBqO2nN43vMjAwPLw/pzal@LoxegNZDGjA2Xlc2TwiOLZm@Y0SnJSPUyOENlJIA8Q5OAF0LIBvmy4/OaICXNnbgfohJdUorQ9q3y8g@bDEVF1aUas68@wjdd2V/LRfpQqnPw "Perl 5 – Try It Online")
**Input:**
Each player on a separate line, no spaces
**Output:**
`1` Line one wins
`0` Tie
`-1` Line two wins
]