Skip to main content
Added explanation
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes

eAu3*-*ESza

Attempt This Online! or verify all test cases.

Port of AndrovT's Vyxal answer

Explanation

eAu3*-*ESza  # Implicit input
e      E     # Map over the input:
 Au          #  Dump the contents onto the stack
   3*        #  Triple (the hits)
     -       #  Subtract (from the time)
      *      #  Multiply (by the team)
        S    # Sum
         za  # Sign
             # Implicit output

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes

eAu3*-*ESza

Attempt This Online! or verify all test cases.

Port of AndrovT's Vyxal answer

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes

eAu3*-*ESza

Attempt This Online! or verify all test cases.

Port of AndrovT's Vyxal answer

Explanation

eAu3*-*ESza  # Implicit input
e      E     # Map over the input:
 Au          #  Dump the contents onto the stack
   3*        #  Triple (the hits)
     -       #  Subtract (from the time)
      *      #  Multiply (by the team)
        S    # Sum
         za  # Sign
             # Implicit output
Post Undeleted by The Thonnu
Better solution
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74

Thunno, \$ 26 \log_{256}(96) \approx \$ 21\$ 11 \log_{256}(96) \approx \$ 9.4005 bytes

{Au3*eAu3*-s?x+X(y+Y(}xy<?2(yx<*ESza

(No ATO link since this requires Thunno 1.2Attempt This Online! or verify all test cases.2+)

  • Input: 0 for 'A' and 1 for 'B'
  • Output: 2 for B wins; True for A wins; False for Draw

Explanation

{      # Loop over the input list:
 Au    #  Dump the inner list onto the stack
   3*  #  Multiply (the hits value) by 3
     - #  Subtract this (from the time value)
s      #  Swap (so the team value is on top)
 ?     #  If this is truthy (i.e. it is team B):
  x+X  #   Add (the score) to X
     ( #  Otherwise (i.e. it is team A):
y+Y    #   Add (the score) to Y
   (   #  End if
    }  # End for
xy<?   # If x is less than y (i.e. team B won):
    2  #  Push 2
     ( # Otherwise (i.e. team A won or it was a draw):
yx<    #  Push y<x
       #  (i.e. push True if team A won and False if it was a draw)
       # Implicit output

Screenshot

Screenshot Port of AndrovT's Vyxal answer

Thunno, \$ 26 \log_{256}(96) \approx \$ 21.40 bytes

{Au3*-s?x+X(y+Y(}xy<?2(yx<

(No ATO link since this requires Thunno 1.2.2+)

  • Input: 0 for 'A' and 1 for 'B'
  • Output: 2 for B wins; True for A wins; False for Draw

Explanation

{      # Loop over the input list:
 Au    #  Dump the inner list onto the stack
   3*  #  Multiply (the hits value) by 3
     - #  Subtract this (from the time value)
s      #  Swap (so the team value is on top)
 ?     #  If this is truthy (i.e. it is team B):
  x+X  #   Add (the score) to X
     ( #  Otherwise (i.e. it is team A):
y+Y    #   Add (the score) to Y
   (   #  End if
    }  # End for
xy<?   # If x is less than y (i.e. team B won):
    2  #  Push 2
     ( # Otherwise (i.e. team A won or it was a draw):
yx<    #  Push y<x
       #  (i.e. push True if team A won and False if it was a draw)
       # Implicit output

Screenshot

Screenshot

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes

eAu3*-*ESza

Attempt This Online! or verify all test cases.

Port of AndrovT's Vyxal answer

Post Deleted by The Thonnu
Added explanation
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74

Thunno, \$ 26 \log_{256}(96) \approx \$ 21.40 bytes

{Au3*-s?x+X(y+Y(}xy<?2(yx<

(No ATO link since this requires Thunno 1.2.2+)

  • Input: 0 for 'A' and 1 for 'B'
  • Output: 2 for B wins; True for A wins; False for Draw

Explanation

{      # Loop over the input list:
 Au    #  Dump the inner list onto the stack
   3*  #  Multiply (the hits value) by 3
     - #  Subtract this (from the time value)
s      #  Swap (so the team value is on top)
 ?     #  If this is truthy (i.e. it is team B):
  x+X  #   Add (the score) to X
     ( #  Otherwise (i.e. it is team A):
y+Y    #   Add (the score) to Y
   (   #  End if
    }  # End for
xy<?   # If x is less than y (i.e. team B won):
    2  #  Push 2
     ( # Otherwise (i.e. team A won or it was a draw):
yx<    #  Push y<x
       #  (i.e. push True if team A won and False if it was a draw)
       # Implicit output

Screenshot

Screenshot

Thunno, \$ 26 \log_{256}(96) \approx \$ 21.40 bytes

{Au3*-s?x+X(y+Y(}xy<?2(yx<

(No ATO link since this requires Thunno 1.2.2+)

  • Input: 0 for 'A' and 1 for 'B'
  • Output: 2 for B wins; True for A wins; False for Draw

Screenshot

Screenshot

Thunno, \$ 26 \log_{256}(96) \approx \$ 21.40 bytes

{Au3*-s?x+X(y+Y(}xy<?2(yx<

(No ATO link since this requires Thunno 1.2.2+)

  • Input: 0 for 'A' and 1 for 'B'
  • Output: 2 for B wins; True for A wins; False for Draw

Explanation

{      # Loop over the input list:
 Au    #  Dump the inner list onto the stack
   3*  #  Multiply (the hits value) by 3
     - #  Subtract this (from the time value)
s      #  Swap (so the team value is on top)
 ?     #  If this is truthy (i.e. it is team B):
  x+X  #   Add (the score) to X
     ( #  Otherwise (i.e. it is team A):
y+Y    #   Add (the score) to Y
   (   #  End if
    }  # End for
xy<?   # If x is less than y (i.e. team B won):
    2  #  Push 2
     ( # Otherwise (i.e. team A won or it was a draw):
yx<    #  Push y<x
       #  (i.e. push True if team A won and False if it was a draw)
       # Implicit output

Screenshot

Screenshot

Post Undeleted by The Thonnu
Post Deleted by The Thonnu
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74
Loading