« first day (4 days earlier)      last day (2365 days later) » 

3:16 AM
in The Nineteenth Byte, 8 hours ago, by Leaky Nun
CMC: print a circle of radius n. You must pick two consistent symbols. The grid is of radius 2n+1, with center being (n,n). A grid is "colored" if the floored Euclidean distance from the grid to the center is n.
in The Nineteenth Byte, 8 hours ago, by Leaky Nun
e.g. for n=5:
in The Nineteenth Byte, 8 hours ago, by Leaky Nun
00111111100
01100000110
11000000011
10000000001
10000000001
10000000001
10000000001
10000000001
11000000011
01100000110
00111111100
in The Nineteenth Byte, 8 hours ago, by Leaky Nun
Sample implementation in Python:
in The Nineteenth Byte, 8 hours ago, by Leaky Nun
n = eval(input())
size = 2*n+1
for i in range(size):
	r = ""
	for j in range(size):
		if int(((i-n)**2 + (j-n)**2)**0.5) == n:
			r += "1"
		else:
			r += "0"
	print(r)
@HyperNeutrino ^
 
user165474
Ooh.
 
user165474
Alright. Interesting!
 
@HyperNeutrino are you doing it?
 
user165474
I'm working on it. I'm trying to start with going as short as possible instead of making a crazy solution and then golfing it. (as in, golf the algorithm first, not the implementation later)
 
alright
@HyperNeutrino actually I haven't tried it lol
 
user165474
3:32 AM
lol I see :P
 
user165474
Erik hasn't been here for a long time lol :P
 
3:44 AM
@HyperNeutrino are you doing it?
 
user165474
Yes. I have Ḥ‘Ḷ_ so far to generate the distances, but I realized that that's unnecessary and can be shortened (because distances are absolute lol)
 
user165474
Seems to be the shortest way though. lol
 
user165474
Is there any way to take something like [a, b, c] and return [[[a, a], [a, b], [a, c]], [[b, a], [b, b], [b, c]], [[c, a], [c, b], [c, c]]]?
 
yes
 
user165474
I feel like it has to do with , for pair.
 
3:52 AM
16 bytes for me
 
user165474
For the whole thing?
 
yes
 
user165474
Nice.
 
15 bytes
 
user165474
Ooh. Nice.
 
user165474
3:56 AM
Can you give me a hint as to how to get the pairwise combinations of the array with itself?
 
þ
 
user165474
Ah. I'm using that right now, but it's giving me the pairwise combinations of the array with the range [1, argument].
 
user165474
Ḥ‘Ḷ_,þ
 
because it's still a dyad
click that
 
user165474
Okay.
 
user165474
4:00 AM
Okay, I see.
 
user165474
Hm.
 
user165474
So wait, this currently is [monad][monad][monad][dyad][product_table_dyad].
 
user165474
I think that [dyad] in there might be what's causing the problem?
 
user165474
Aha Ḥ‘Ḷ_µ,þ
 
I mean, the combined link is one dyad
 
user165474
4:05 AM
Oh.
 
is one dyad
 
user165474
Oh, okay.
 
user165474
The above works for me for what I want, but I will keep that in mind.
 
user165474
I may need to change it as well.
 
user165474
Ḥ‘Ḷ_µ,þµ²
 
user165474
4:11 AM
Gives me the relative x and y absolute distances squared.
 
user165474
Something like this: [[[4, 4], [1, 4], [0, 4], [1, 4], [4, 4]], [[4, 1], [1, 1], [0, 1], [1, 1], [4, 1]], [[4, 0], [1, 0], [0, 0], [1, 0], [4, 0]], [[4, 1], [1, 1], [0, 1], [1, 1], [4, 1]], [[4, 4], [1, 4], [0, 4], [1, 4], [4, 4]]]
 
user165474
I need to figure out how to get the sums of all of the pairs.
 
Did you confuse the radius with the diameter?
 
user165474
I hope not..
 
user165474
If I sum them, square root them, and floor them, it should give me the distances to the center.
 
4:15 AM
look at my sample output
 
user165474
Hm. If my implementation works correctly, it theoretically should give the correct output.
 
@HyperNeutrino but I only see a 5x5 grid here
 
user165474
This is for n = 2.
 
oh ok
figure out what þ does
 
user165474
I think it takes two arrays, takes all pairs of one of the left and one of the right array, and applies the specified dyad to them.
 
4:22 AM
alright
 
4:42 AM
@HyperNeutrino you still aren't seeing it...
 
user165474
Oh, I had two failed ideas, I just need to take half of each and put them together ;_;
 
user165474
But Dennis says there's a shorter way (unbase 1), which I should go look at to see what it doesn.
 
ftlog you can use + as the dyad to the outer product quick
 
user165474
You mean replace the , with a +?
 
yes
 
user165474
4:49 AM
That won't work.
 
user165474
That works for manhattan distance
 
square before adding
 
user165474
...oh
 
user165474
Is this what you meant? Ḥ‘Ḷ_µ²+þ
 
yes
 
user165474
4:56 AM
It gives 2 -> [[2, -1, -2, -1, 2], [3, 0, -1, 0, 3], [4, 1, 0, 1, 4], [5, 2, 1, 2, 5], [6, 3, 2, 3, 6]]
 
heh, the right argument is not good
use a backtick
 
user165474
Where?
 
at the end
 
user165474
Oh okay.
 
user165474
Yay.
 
user165474
4:59 AM
This: Ḥ‘Ḷ_µ²µ+þ: also works, but it ends with a dyad.
 
user165474
5:10 AM
I have a 14 byte solution. @LeakyNun
 
btw my solution is 11 bytes now
 
user165474
Nice.
 
user165474
Mine is:
 
user165474
Ḥ‘Ḷ_µ²+þ`ƽ=³Y
 
our codes are identical except for the Ḥ‘Ḷ_µ part
which I replaced with 2 bytes
 
user165474
5:13 AM
Ooh. I see.
 
user165474
I think I found your solution:
 
user165474
rN²+þ`ƽ=³Y
 
nice
 
user165474
yay :D
 
user165474
It hit output cache when I ran it lol
 
user165474
5:17 AM
cache is strange ;_;
 
lol
 
user165474
yay
 
user165474
Do you have another code task that I could probably complete in half an hour or so?
 
given two coprime integers x and y, output two integers a and b such that ax+by=1
bonus points for pointing out the relavant theorem
 
user165474
Hm. Interesting.
 
user165474
5:31 AM
Anyway, I'm too tired to continue thinking (because this requires actual math not just clever implementations), so I'll continue this challenge "tomorrow" morning. Bye!
 
alright
 
 
7 hours later…
user165474
12:17 PM
I think I can prove that if ax + by = 1 for coprime x and y, we can always have ax < xy.
 
user165474
@LeakyNun ^
 
user165474
Or equivalently by < xy.
 
user165474
Because either a or b must be negative.
 
sure
 
user165474
That just helps me restrict the values a bit, as in |a| < y and |b| < x.
 
12:38 PM
@HyperNeutrino are you doing it?
 
user165474
Yes. I'm trying to do it mathematically first and I've gotten this:
 
user165474
ax + by = 1
a + by/x = 1/x
a = (1 - by) / x
 
not sure how that helps...
 
user165474
So essentially I need to find b such that by - 1 is divisible by x.
 
user165474
I'm not very sure either, but ^
 
12:39 PM
alright
 
12:51 PM
After you finished that, you might want to attempt this
 
user165474
1:37 PM
Alright. I'll do that after I finish the coprime task.
 
nice
 
2:01 PM
@HyperNeutrino progress?
 
user165474
@LeakyNun I'm in class right now so I can't really work on it right now. I'll think about it over lunch break.
 
ok
 
2:50 PM
@HyperNeutrino progress?
 
user165474
@LeakyNun I have to go now, but I will be thinking about it over lunch. Bye!
 
alright
 

« first day (4 days earlier)      last day (2365 days later) »