Japt -g
, 16 bytes
üÎmx_g1 -ZÌ*3Ãr-
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