« first day (994 days earlier)      last day (1646 days later) » 

8:33 AM
@H.PWiz Wow I suspected I didn't stand a chance. Amazing.
 
9:01 AM
@H.PWiz I'm still sat here making the matrix with 2⊥⍣¯1⊢⍳⍴⍵
 
9:13 AM
* 2*¯1¨⍳⍴⍵
 
 
2 hours later…
11:19 AM
@RichardPark My best with that was only one byte longer: ¯1*(⍉+.×⊢)2⊥⍣¯1⍳≢⍵
 
 
1 hour later…
12:30 PM
SierpinskiPath←{
     ⍝ ⍵ should be 2 integers, to and from
     A B←{ ⍝ the alphabet for this version
           ⍝ of adic is ⍳3
         n←⌊3⍟1+⍵×2
         z←(¯1+3*n)÷2
         (⍳3)[1+(n/3)⊤⍵-z]
     }¨⍵
     L←(≢A)⌈(≢B)
     m←¯1+0⍳⍨(L↑A)=(L↑B)
     P←m↓A
     Q←m↓B
     R←⍬{  ⍝ getting the shortest from A
           ⍝ to the common ancestor of A and B
         0=≢⍵:⍺
         p←⍵
         t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3
         (⍺,p[t])∇ ⍵↑⍨t-1
     }P
     ('S'('NE')'NW'[R]),'N'('SW')'SE'[Q]
 }
Submitted for comment and golfing as a answer to this Sierpinski triangle challenge
 
Ven
12:59 PM
do you really need to keep A and B separate?
(⍳3)[1+(n/3)⊤⍵-z] is (1+(n/3)⊤⍵-z)⌷⍳3, but why do you index ⍳3?
if you don't keep A and B separate, you could i.e. ⌈/≢¨V
P Q←2↓¨A B should work, but again, if A and B are stored in the same array, it's not as annoying. (L↑A)=(L↑B) can be written =⍥(1∘↑) in Extended, but not sure if that's of any help...
 
1:27 PM
@Ven I don't need to keep them separate, this is just a convenient separation for what may become the explanation for when I write all this into an answer
 
Ven
Ah! I see
 
The (L↑A)=(L↑B) is a fix for a bug where I need to account for answers of differing lengths (otherwise LENGTH ERROR)
 
Ven
I'm just pointing out a train-ish way (which doesn't look all that much better)
 
2:22 PM
@H.PWiz you can get -1 by a similar method. nowhere near 23 though
 
2:32 PM
@dzaima Is "-1" 27?
 
@H.PWiz yes
 
 
3 hours later…
5:21 PM
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌊3⍟1+⍵×2⋄(⍳3)[1+(n/3)⊤⍵-(¯1+3*n)÷2]}¨⍵⋄(('S' 'NE' 'NW')[⍬{0=≢⍵:⍺⋄p←⍵⋄t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3⋄(⍺,p[t])∇⍵↑⍨t-1}P],('N' 'SW' 'SE'[Q]}174 175
 
@Sherlock9
SYNTAX ERROR
 
Nuts
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌊3⍟1+⍵×2⋄(⍳3)[1+(n/3)⊤⍵-(¯1+3*n)÷2]}¨⍵⋄(('S' 'NE' 'NW')[⍬{0=≢⍵:⍺⋄p←⍵⋄t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3⋄(⍺,p[t])∇⍵↑⍨t-1}P]),('N' 'SW' 'SE')[Q]}174 175
 
@Sherlock9
┌──┬──┬─┬─┬─┐
│NE│SE│N│N│N│
└──┴──┴─┴─┴─┘
 
YES! :D
 
5:33 PM
@Sherlock9 Congratulations on achieving whatever you were trying to achieve with that.
 
Thank you! And it's this old challenge from Martin Ender about navigating a Sierpinski triangle codegolf.stackexchange.com/questions/66875/…
I believe the phrase "There's got to be a better way to do this" applies very well here XD
 
Ven
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌊3⍟1+⍵×2⋄(⍳3)⌷⍨⊂1+(n/3)⊤⍵-(¯1+3*n)÷2}¨⍵⋄('S' 'NE' 'NW'⌷⍨⍬{0=≢⍵:⍺⋄p←⍵⋄t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3⋄(⍺,t⌷p)∇⍵↑⍨t-1}P),'N' 'SW' 'SE'⌷⍨⊂Q}174 175
 
@Ven
┌──┬──┬─┬─┬─┐
│NE│SE│N│N│N│
└──┴──┴─┴─┴─┘
 
Ven
@Sherlock9 ^ for -3
(¯1+3*n)÷2 is also 2÷⍨¯1+3*n for -1 :)
 
5:56 PM
I just realized what you meant by ⍳3 and golfed it down a lot
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{1+3⊥⍣¯1⊢⍵-2÷⍨¯1+3*⌊3⍟1+⍵×2}¨⍵⋄('S' 'NE' 'NW'⌷⍨⍬{0=≢⍵:⍺⋄p←⍵⋄t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3⋄(⍺,t⌷p)∇⍵↑⍨t-1}P),'N' 'SW' 'SE'⌷⍨⊂Q}174 175
 
@Sherlock9
┌──┬──┬─┬─┬─┐
│NE│SE│N│N│N│
└──┴──┴─┴─┴─┘
 
-11 bytes!
Hm there's might be a golfier way to do all those ¨s
Or maybe not
 
ngn
@Sherlock9 ⍵-2÷⍨¯1+ -> ⍵+2÷⍨1-
{1+3⊥⍣¯1⊢⍵+2÷⍨1-3*⌊3⍟1+⍵×2}¨⍵ -> 1+3⊥⍣¯1¨⍵+2÷⍨1-3*⌊3⍟1+⍵×2 (only ⊥⍣¯1 needs an ¨ here, all other functions are pervasive)
 
6:15 PM
OH I have made a mistake. ⊥⍣¯1 doesn't decode properly
Rather there isn't enough padding
Also doesn't want to enclose scalars for which leads to this
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌊3⍟1+⍵×2⋄(⍳3)⌷⍨⊂1+(n/3)⊤⍵-2÷⍨¯1+3*n}¨⍵⋄('S' 'NE' 'NW'⌷⍨⍬{0=≢⍵:⍺⋄p←⍵⋄t←⌊/∊{/⍨⊃⌽⍸p=⍵}¨⍳3⋄(⍺,t⌷p)∇⍵↑⍨t-1}P),'N' 'SW' 'SE'⌷⍨⊂Q}299792458 2
 
@Sherlock9
LENGTH ERROR
 
Oh and
⎕←⍬⌷'S' 'NE' 'NW'
 
@Sherlock9
┌─┬──┬──┐
│S│NE│NW│
└─┴──┴──┘
 
6:35 PM
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌈3⍟1+⍵⋄(⊂1+(n⍴3)⊤⍵-2÷⍨¯1+3*n)⌷⍳3}¨⍵⋄('N' 'SW' 'SE')[Q],⍨('S' 'NE' 'NW')[⍬{0=≢⍵:⍺⋄t←⌊/∊⍵∘{/⍨⊃⌽⍸⍺=⍵}¨⍳3⋄(⍺,t⌷⍵)∇⍵↑⍨t-1}P]}299792458 2
 
@Sherlock9
┌──┬─┬─┬──┐
│NE│S│S│SW│
└──┴─┴─┴──┘
 
So I'm back up to here
Oh right I still don't need that first ⍳3
⎕←{P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←{n←⌈3⍟1+⍵⋄1+(n/3)⊤⍵-2÷⍨¯1+3*n}¨⍵⋄('N' 'SW' 'SE')[Q],⍨(⊂⍬{0=≢⍵:⍺⋄t←⌊/∊⍵∘{/⍨⊃⌽⍸⍺=⍵}¨⍳3⋄(⍺,t⌷⍵)∇⍵↑⍨t-1}P)⌷'S' 'NE' 'NW'}299792458 2
 
@Sherlock9
┌──┬─┬─┬──┐
│NE│S│S│SW│
└──┴─┴─┴──┘
 
 
2 hours later…
8:37 PM
I'm going to bed
Thanks for all the help!
 
 
3 hours later…
11:23 PM
I've been trying to think up ways in J to golf the 2 dial "odometer function," but where the max value of the higher-bit dial increases by one each time it turns over. This Try it online! should clarify. I feel like there's a much simpler answer I'm missing...
 

« first day (994 days earlier)      last day (1646 days later) »