Skip to content

Instantly share code, notes, and snippets.

@lewdev
Created March 14, 2024 00:42
Show Gist options
  • Select an option

  • Save lewdev/5690dcbf5aaa013dd94998167644fe1e to your computer and use it in GitHub Desktop.

Select an option

Save lewdev/5690dcbf5aaa013dd94998167644fe1e to your computer and use it in GitHub Desktop.
⛳ Code Golf: Arrows Solution

⛳ Code Golf: Arrows Solution

https://code.golf/arrows#javascript

p=[0,0]
arguments.map(g=>{[a,b]=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1],[0,0],[0,0]]["↙↲⇙←⇐⇦↖↰⇖↓⇓⇩↑⇑⇧↘↳⇘→⇒⇨↗↱⇗↔↕⇔⇕⥀⥁".indexOf(g)/3>>0]
p[0]+=a
p[1]+=b
print(p.join` `)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment