Skip to main content
rewrite to be more Japt-y for same length
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76

Japt -g, 16 14 bytes

x_o *3x_Ì*3)nZonZg1)*Zo*ZÎ

Try it onlineTry it or verify all test casesverify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3x_Ì*3)nZonZg1)*Zo*ZÎ  implicit input array
x_              sum after mapping each to:
  o *3Ì*3)           pop hitsthe andlast multiplyitem by(hits) three
* 3
      nZonZg1)       subtractsubtracted from {popthe second item (time})
           *Zo*ZÎ    multiplymultiplied by {popfirst item
                  (A or B, -1 for A and 1 for B})
                end sum. -g flag:  output sign of the number 

Japt -g, 16 14 bytes

x_o *3)nZo)*Zo

Try it online or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3)nZo)*Zo  implicit input array
x_              sum after mapping each to:
  o *3)           pop hits and multiply by three
       nZo)       subtract from {pop time}
           *Zo    multiply by {pop A or B, -1 for A and 1 for B}
                end sum. -g: output sign of the number 

Japt -g, 14 bytes

x_Ì*3)nZg1)*ZÎ

Try it or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_Ì*3)nZg1)*ZÎ  implicit input array
x_              sum after mapping each to:
  Ì*3)            the last item (hits) * 3
      nZg1)       subtracted from the second item (time)
           *ZÎ    multiplied by first item
                  (A or B, -1 for A and 1 for B)
      -g flag:  output sign of the number 
improve formatting of explanation
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76

Japt -g, 16 14 bytes

x_o *3)nZo)*Zo

Try it online or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3)nZo)*Zo : implicit input array
x_             : map each elementsum toafter ...mapping andeach sumto:
  o *3)        :   pop hits and multiply by three
       nZo)    :   subtract from {pop time}
           *Zo :   multiply by {pop A or B, -1 for A and 1 for B}
               : end sum. -g: output sign of the number 

Japt -g, 16 14 bytes

x_o *3)nZo)*Zo

Try it online or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3)nZo)*Zo : implicit input array
x_             : map each element to ... and sum
  o *3)        : pop hits and multiply by three
       nZo)    : subtract from {pop time}
           *Zo : multiply by {pop A or B, -1 for A and 1 for B}
               : end sum. -g: output sign of the number 

Japt -g, 16 14 bytes

x_o *3)nZo)*Zo

Try it online or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3)nZo)*Zo  implicit input array
x_              sum after mapping each to:
  o *3)           pop hits and multiply by three
       nZo)       subtract from {pop time}
           *Zo    multiply by {pop A or B, -1 for A and 1 for B}
                end sum. -g: output sign of the number 
-2 + explanation + fix
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76

Japt -g, 1616 14 bytes

üÎmx_g1x_o -ZÌ*3Ãr-*3)nZo)*Zo

Try itTry it online or verify all test cases.

OutputsPort of @AndrovT's Vyxal answer. Takes -1 for A, and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw. Currently fails the empty array test case, I’ll fix that later

üÎmx_g1x_o -ZÌ*3Ãr-*3)nZo)*Zo : implicit input array
üÎ               : group by the first element (A or B)
 x_ mx_            : map to the sums of each element mapped to
  ... and sum
  g1o -*3)        : the secondpop elementhits (time),and minus
multiply by three
       ZÌ*3nZo)    : the last elementsubtract (hits)from times{pop 3time}
             Ã  *Zo : end map, [A score, B score]
        multiply by {pop A or B, r-1 :for A -and 1 for B}
               : end :sum. -g: output sign of the number 

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), minus
         ZÌ*3    : the last element (hits) times 3
             Ã   : end map, [A score, B score]
              r- : A - B
                 : -g: output sign of the number 

Japt -g, 16 14 bytes

x_o *3)nZo)*Zo

Try it online or verify all test cases.

Port of @AndrovT's Vyxal answer. Takes -1 for A and 1 for B. Outputs 1 for A, -1 for B, and 0 for draw.

x_o *3)nZo)*Zo : implicit input array
x_             : map each element to ... and sum
  o *3)        : pop hits and multiply by three
       nZo)    : subtract from {pop time}
           *Zo : multiply by {pop A or B, -1 for A and 1 for B}
               : end sum. -g: output sign of the number 
added 7 characters in body
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
Loading
explain
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
Loading
golfed
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
Loading
explanation
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
Loading
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
Loading