Skip to main content
Commonmark migration
Source Link
added 847 characters in body
Source Link
GammaFunction
  • 7.1k
  • 14
  • 24

Zsh, 156 122 122116 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
m=n+=(${(n)m})}
s $=1
n=($m)
s $=2
((r=(n[1]+0.)/m[1]n[4],r*m[2]r*n[5]-n[2]||r*m[3]n[2]||r*n[6]-n[3]))

Try it online! Try it online! Try it online!Try it online!

I believe this is within the rules; there is no calculation done beforehand, simply duplication and re-ordering. No sorting criteria is applied either.

Here is the previousfirst 156 byte answer, which takes the input in a less abusive format. The abusive format removes line 2 in s, and reduces line 3:

Zsh, 156 122 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
m=(${(n)m})}
s $=1
n=($m)
s $=2
((r=(n[1]+0.)/m[1],r*m[2]-n[2]||r*m[3]-n[3]))

Try it online! Try it online!

I believe this is within the rules; there is no calculation done beforehand, simply duplication and re-ordering.

Here is the previous 156 byte answer, which takes the input in a less abusive format. The abusive format removes line 2 in s, and reduces line 3:

Zsh, 156 122 116 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
n+=(${(n)m})}
s $=1
s $=2
((r=(n[1]+0.)/n[4],r*n[5]-n[2]||r*n[6]-n[3]))

Try it online! Try it online! Try it online!

I believe this is within the rules; there is no calculation done beforehand, simply duplication. No sorting criteria is applied either.

Here is the first 156 byte answer, which takes the input in a less abusive format. The abusive format removes line 2 in s, and reduces line 3:

added 1201 characters in body
Source Link
GammaFunction
  • 7.1k
  • 14
  • 24

Zsh, 131156 122 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
m=(${(n)m})}
s $@[1,12]$=1
n=($m)
s ${@:13}$=2
((r=(n[1]+0.)/m[1],r*m[2]-n[2]||r*m[3]-n[3]))

Try it online! Try it online!Try it online!

AbusesSaves 34 bytes by abusing "any structure" for input. Given a pair of triangles:

The input should be the two strings:

1'1 2 3 4 3 4 5 6 5 6 1 22' 7'7 8 9 10 9 10 11 12 11 12 7 88'

Zsh, 131 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
m=(${(n)m})}
s $@[1,12]
n=($m)
s ${@:13}
((r=(n[1]+0.)/m[1],r*m[2]-n[2]||r*m[3]-n[3]))

Try it online! Try it online!

Abuses "any structure" for input. Given a pair of triangles:

The input should be:

1 2 3 4 3 4 5 6 5 6 1 2 7 8 9 10 9 10 11 12 11 12 7 8

Zsh, 156 122 bytes

s(){m=
for a b x y;m+=($[(a-x)**2+(b-y)**2])
m=(${(n)m})}
s $=1
n=($m)
s $=2
((r=(n[1]+0.)/m[1],r*m[2]-n[2]||r*m[3]-n[3]))

Try it online! Try it online!

Saves 34 bytes by abusing "any structure" for input. Given a pair of triangles:

The input should be the two strings:

'1 2 3 4 3 4 5 6 5 6 1 2' '7 8 9 10 9 10 11 12 11 12 7 8'
added 1201 characters in body
Source Link
GammaFunction
  • 7.1k
  • 14
  • 24
Loading
Source Link
GammaFunction
  • 7.1k
  • 14
  • 24
Loading