Skip to main content
Commonmark migration
Source Link

#Japt, 22 bytes

Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 

Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Japt, 22 bytes

Japt is a shortened version of JavaScript. InterpreterInterpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 
whoops
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U.   // If this is NaN, return the original value of X. g // Take the sign of the resulting number. // Implicit: output last expression 

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U.   // If this is NaN, return the original value of X. g // Take the sign of the resulting number. // Implicit: output last expression 

#Japt, 22 bytes

Japt is a shortened version of JavaScript. Interpreter

U¬r@X+~~Y*(Z-Ub'^),0 g 

Returns -1 for L, 0 for B, and 1 for R.

###How it works

Uq r@X+~~Y*(Z-Ub'^),0 g // Implicit: U = input string Uq r@ ,0 // Reduce the input by this function, starting at 0: X+~~Y* // Return the previous value, plus the current value times (Z-Ub'^) // the current index minus the index of "^" in U. g // Take the sign of the resulting number. // Implicit: output last expression 
didn't work on some inputs
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241
Loading
Source Link
ETHproductions
  • 50.3k
  • 6
  • 96
  • 241
Loading