Skip to main content
4 of 8
explain
noodle person
  • 10.3k
  • 1
  • 22
  • 76

Japt -g, 16 bytes

üÎmx_g1 -ZÌ*3Ãr-

Try it

Outputs -1 for A, 1 for B, and 0 for draw. Currently fails the empty array test case, I’ll fix that later

üÎmx_g1 -ZÌ*3Ãr- : implicit input array
üÎ               : group by the first element (A or B)
  mx_            : map to the sums of each element mapped to
     g1 -        : the second element (time)
         ZÌ*3    : the last element (hits) times 3
             Ã   : end map, [A score, B score]
              r- : A - B
                 : -g: output sign of the number 
noodle person
  • 10.3k
  • 1
  • 22
  • 76