« first day (3204 days earlier)      last day (681 days later) » 

2:26 AM
Q: Spanning tree of a rectangular grid

BubblerBackground A spanning tree (Wikipedia) of an undirected graph is a subgraph that is a tree which includes all of the vertices of the original graph. The following is an example of a spanning tree of a 4-by-4 grid graph. Task Given two positive integers w and h, output any valid spanning tree...

A: Sandbox for Proposed Challenges

Bubbler20 cards with no Set code-golf card-games Background Set is a card game. The deck consists of 81 unique cards that vary in four features: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple). For convenienc...

7 hours later…
9:28 AM
A: Sandbox for Proposed Challenges

Sara JFormat a swedish telephone number On the Check the validity of a 10-digit telephone number challenge, some people in the comments were talking about verifying phone numbers that didn't follow the rather rigid NANP format. Well, technically they were talking about british phone numbers, but I don...

@Anush ○/
hi @Adám . I am still thinking about the matrix problem I gave you
10:05 AM
it would be great to be able to ask this :)
A photon moving at speed 1 in the x-y plane starts at time t = 0 at (x, y) = (1/2, 1/10) heading due east. Around every integer lattice point (i, j) in the plane, a circular mirror of radius 1/3 has been erected. How far from (0, 0) is the photon at t = 10?
@Anush particle or wave? :)
@ngn particle! :)
the answers to my billiard balls problem may come in useful
@ngn how did you draw the diagram?
I am always looking for better diagram drawing tools
@Anush inkscape
10:19 AM
it's annoyingly transparent :)
which inkscape does
yeah, i should have used a fixed bg colour. too late now, i deleted the svg long ago.
when I have done the same thing I found that convert (as in imagemagick) has a specific command line option for this
maybe flatten?
convert image.png -background White -flatten image.png
in case it's ever useful :)
10:35 AM
@Anush that worked, thanks!
np.. I remember it took me a while to dig out when I had to do it. So very happy to share
also the channel is the most useful IT support channel on the internet :)
In mathematical notation, if I want to sum elements that fulfil a certain condition, is there a way to express this?
A _
Multiply the values being summed by the condition. If the value is 1 this is an identity. Otherwise, those values will not be in the sum.
@A_ Yeah, I thought of that (using an Iverson bracket), but I'm taking the summing the reciprocal of the non-zero values, so I can't just multiply by the condition, as that implies dividing 1 by 0.
@Adám i've seen big sigmas with this written below: p∊N, p is prime
10:46 AM
Indicator functions are what people at my uni use
@ngn Hm, I don't see how that can work here.
Then use x≠0 / f(x)≠0 under the sigma?
put the condition in the subscript of the sum
$\sum_{i> 4} f(i)$
@H.PWiz So there'd be two lines under the sigma, one saying i=0 and the other saying E_i≠0 ?
Yeah, I think that wouldn't look too weird
10:49 AM
@Anush The condition isn't in the index, but on the value at that index.
can you explain the sum in detail?
that might help
It might be normal to change to 0≤i≤n, E_i≠0 all at the bottom. But I'm not sure which looks best, or is used more commonly
I'm just trying to do
for all non-zero elements of E.
ah ok.. I think \sum_{i=1, E_i \ne 0} is fine
Almost the harmonic mean
10:52 AM
what is E_i?
was ist das?
thanks! All clear now
it must be electrical something - capacity, conductivity, resistence...
10:55 AM
@Anush Hm, I really don't like how the text below the sigma sticks out:
@Adám use \\ instead of ,
Markdown FTW
@ngn That's just plain weird:
I don't think Knuth had that in mind.
\sum_{\substack{i=0 \\ i\neq 4}}^n i
substack is your friend here
@Anush I guess that works, but it isn't exactly pretty. Is it obvious what it means, though?
would you prefer the = and \ne to be aligned?
pretty is important
11:00 AM
@Anush I don't think so, that'd make everything else look lopsided.
\sum_{\subalign{n&=1\\n&\neq i}}^N
try that
subalign instead of substack
I think it's unambiguous as \ne 0 is not a starting value
@Anush wait, you have n≠i?
@Anush I can't seem to get subalign to parse
you can write 0≤i≤n instead of i=0 and n above
@ngn You mean 1≤i≤n below E_i≠0 above (or opposite?)?
@Adám i'd expect 1≤i≤n to be above E_i≠0
11:07 AM
@ngn So two small lines, where?
$$\sum_{\substack{1\le i \le n\\E_i\ne 0}}$$
and add Anush's magic (\subalign) if you want
How about:
that's not what "cases" was meant for
I could go full Iverson bracket:
@Adám oh sorry! I didn't give you the definition
A: Align in Substack

egregThis essentially duplicates \substack, but adding an alignment point. \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand{\subalign}[1]{% \vcenter{% \Let@ \restore@math@cr \default@tag \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \...

11:37 AM
Q: Fastest N times Hello World (Java/C/ C++)

Looking4TipsNot a new one: Input N, being n, 0 ≤ n ≤ 5. Output N times "Hello World." Example: Input 3 Output Hello World. Hello World. Hello World. These 2 are my best solutions: First public class Out { public static void main(String[] a) throws Exception { java.io.Output...

1 hour later…
12:39 PM
in C, I think it's possible to write code the uses AVX if the CPU supports it via some gcc magic... but I have no idea how. Does anyone know?
@Anush -march=native? or do you mean you want to manually call a specific avx instruction?
It needs to happen at runtime
2 hours later…
2:43 PM
@Adám Well... technically you could do production in Japt... you can write plain JS in it after all... :P
2:54 PM
Do you have to wrap JS in Japt? Or can you just fire away?
You have to wrap it, yes
3:33 PM
CMC Given a list of integers A and another integer X, output a truthy value if there is a pair of items in A that sum to X, and a falsey value otherwise.
@Quintec I wonder if any real-life production systems are transpiled (?) from a golfing language.
@AdmBorkBork Can an item from A pair with itself?
No, then it's not a pair of items, it's a single item.
@AdmBorkBork Can A have duplicates?
Examples: {1,2,3} 4 = truthy but {1,2,4} 4 = falsey
Let's say guaranteed distinct integers in A
3:40 PM
@AdmBorkBork A: strictly positive/non-negative/…?
Pretty much reads like the specs
No restriction on positives/negatives/etc.
A subset of 2 elements (a couple) that sums to the given output variable
@AdmBorkBork APL (Dyalog Extended), 17: ⎕∊.5⍢(1 1∘⍉)∘.+⍨⎕ Try it online!
Wow, that seems longer than I would expect.
3:47 PM
@AdmBorkBork Maybe I'm failing to see something. ∘.+⍨ is an outer product sum selfie. .5⍢(1 1∘⍉) puts 0.5 down the diagonal.
Ah, one byte shorter by using infinity instead of 0.5 (they are about the same anyway):⎕∊∞⍢(1 1∘⍉)∘.+⍨⎕
I sometimes wish that PowerShell had any and the like.
@AdmBorkBork I think you could also do sum
Does powershell have list comprehensions? Like l=list(a**2 for a in range(10))?
3:58 PM
$l=1..10|%{$_*$_} would work the same
Is | kinda like map then?
Q: Find the Longest Even Length Word

KrishnaFind the Longest Even Length Word Consider a string, sentence, of space-separated words where each word is a substring consisting of English alphabetic letters only. We want to find the first word in the sentence having a length which is both an even number and greater than or equal to the lengt...

No. It functions more like a pipe in Bash than anything else. Here it's taking the object 1..10 (range from 1 to 10) and piping it into a foreach-loop %{...}.
So you could say |% is the map if you really want to
Yeah, kinda.
4:06 PM
@AdmBorkBork I was missing something; APL (Dyalog Unicode), 13 bytes: ⎕∊(~+⊢)⍤1 0⍨⎕
That's more what I was expecting - low teens.
@AdmBorkBork For once, J is pretty competitive too; 15 bytes: e.&,(-.+])"1 0~
Ugh, I hate unbalanced brackets.
6 bytes in jelly: Try it online!
@DJMcMayhem That's much better than mine :P
5 bytes using the S€ builtin :P
Lol, I was pretty sure there's a better way to do that
4:20 PM
It's one of the new fangled builtins :P
@AdmBorkBork Cludgey PS for 58
When I learnt Jelly, we only had 200 builtins, not 210 like the newbies :P
60 to normalize it to true/false
Not in love with the route I went but I also didn't think too hard about it
@Veskah Since an empty array is falsey and a non-emtpy array is truthy, how about the following? Try it online!
@cairdcoinheringaahing How would you make something like Œṗ=³Œc work?
4:27 PM
@DJMcMayhem Is this for Adm's CMC?
Yes. Almost confused Adám and Adm
Bork's CMC then :P
I go by Bork
even IRL sometimes
I tried going by caird, but no one can pronounce it :P
"Jim" ... seems easy enough to pronounce.
4:31 PM
@DJMcMayhem You can use { and } to make a monad use either the left or right argument to the link
@AdmBorkBork Wicked smaht
@AdmBorkBork Do the truthy/falsey values have to be consistent?
In which case, using @DJMcMayhem's idea, 6 bytes
@AdmBorkBork Oh wait, this pops out multiple arrays if there's multiple solutions. If that's still fine, great, otherwise you'll need a counter as well
4:37 PM
@cairdcoinheringaahing I don't find it difficult but I'm probably doing it very wrong:P
that reminds me, I should think about decreasing my vovel/consonant ratio...
@flawr aeiou! John Madden John Madden John Madden
@Veskah Should only be spitting out one array, since there's only one pipeline happening. It'll produce multiple elements in the array, but should still only be one.
@flawr I pronounce it the same as "cared" (as in I cared about something), but I refuse to touch coinheringaahing :P
@AdmBorkBork Ha ha, I was only pretending to be retarded
@flawr Flwr
4:41 PM
@cairdcoinheringaahing how did you come up with this name then:)
@DJMcMayhem fphvlwrrh
@DJMcMayhem DJMcMyhm
Mine looks very weird: crd cnhrnghng
Looks about as weird as your normal name :P
@cairdcoinheringaahing ooooohh
4:44 PM
@cairdcoinheringaahing Wow, and I thought it was Gaelic or something.
y is why considered a consonant? Why is y considered a consonant?
Nah, my username's PPCG born and raised :P
@cairdcoinheringaahing "Cnhrnghng" is probably a sign of distress when spoken
@flawr Yo, think about it.
@Veskah that is the sound that my neighbours dog makes when playing tug of war
4:46 PM
@cairdcoinheringaahing CO-in-HAIR-in-GAH-hing
@DJMcMayhem Huh, not coin-herring-aah-hing?
@cairdcoinheringaahing That's how I've said it in my head
Nope. In my head I've always read it the first way
Also, for a long time I read @flawr as "flower"
I wonder if there's any other way to read it
@DJMcMayhem I read it as flaw, like a flaw in my code
4:48 PM
flaw, flawr, flawrst
@Veskah How do you delete someone else's pronunciation? :P
actually for many names that I cannot read at the first glance I don't ever think about how they would sound
@flawr "This isn't even my final form" - flawr
@flawr Oh, that's so easy, but my name IRL is really hard for Westerners to deal with.
4:51 PM
Flawr needs to level up before they can evolve :P
@cairdcoinheringaahing Flawrs don't "level up" — they sprout.
@Adám Pronounced similar to ah/uh-dam, right?
A dam, but with a hard a
@Veskah that reminds me of the latex font sizes (in order): \large \Large \LARGE \huge \Huge
(there is actually no \HUGE)
4:53 PM
@cairdcoinheringaahing Oh, not my first name; everybody can come up with something, and I don't care. I personally use a whole handful of pronunciations for my first name. No, my family name: Brudzewsky
@Adám Brud-zhew-ski?
@cairdcoinheringaahing I read it at zoo instead of zhew
Because d-zh becomes a j if you say it fast
@cairdcoinheringaahing I think it has to be broo-DGEFF-ski with DG as in dodge.
4:55 PM
is that a czech or polish name?
Is it Polish by any chance?
Had a few friends with similarly odd consonant sounds (sz -> sh)
@Adám Your name is comprised of 5 different English words. "A dam brew jeff ski"
I always thought you look polished.
4:56 PM
Jun 27 '18 at 15:17, by ngn
@Adám "ah damn, brew Geoff's key"
Like a polish mirror
Brudzew [ˈbrud͡zɛf] is a village in the administrative district of Gmina Błaszki, within Sieradz County, Łódź Voivodeship, in central Poland. It lies approximately 7 kilometres (4 mi) south-east of Błaszki, 17 km (11 mi) west of Sieradz, and 69 km (43 mi) west of the regional capital Łódź. == References... ==
Any feedback on this challenge? It's been a while since I posted
5:29 PM
@Adám e.&,++1+\.+ 11 bytes
balance included
@FrownyFrog Clever.
5:48 PM
@DJMcMayhem you can shorten that quite a bit: formatoptions -> fo, ['+','-'] -> '+-'
Oh yeah, that should have been obvious.
But nnoremap <expr> <leader>a ":\<C-u>set fo"."+-"[&fo =~# 'a']."=a\<CR>" is still pretty ugly looking imo
Especially that nasty =~#. Hands down my least favorite part of vimscript
@DJMcMayhem i agree. there should have been a set fo^=a for toggling
@DJMcMayhem yeah, case-sensitivity depends on a global variable... reminds me of ⎕io and ⎕ct in apl
6:15 PM
Polish, eh? Ja nie mówię dobrze po polsku.
@TerranSwett you're polish?
Nope, I just happen to know some of it.
Although I did recently change my Twitter display name to "Tapper Sześćszczęśliwychpszczółski."
It's not a real Polish last name (as far as I know), but the Polish for "six happy bees" is in fact "sześć szczęśliwych pszczół."
i watched this video of a polish and a bulgarian guy (i'm bulgarian) trying to communicate speaking only their own languages. it's amazing how much they were able to figure out, given how far slavic languages have diverged.
@TerranSwett once i figure out what consonant is behind the the "sh"-s and "ch"-s, i can understand almost everything :)
"shest shtastlivi pcheli"
Yeah, so pretty much the same, except for some sound changes. :D
oh, i remember now :)
6:29 PM
@ngn that is interesting!
I have a tendency to repeat myself from time to time :D
I decided to switch from "dziewięćdziesiąt" (ninety) to "sześć" (six) in order to cram even more consecutive consonants in there.
Even just "six bees" is a bit of a doozy—"sześć pszczół."
/ʂɛɕt͡ɕ pʂt͡ʂuw/
@flawr tbh my compatriot didn't do a great job of figuring out everything he should have, e.g. i think i would have guessed what "wisha" and "smok" and "schana" and "pratsuyesh" are (i'm sure that's not the right spelling), but given it was live and under stress... i guess it was okay
i know smok is a dragon
Well I cannot comment, I don't know either language:)
the rest are a mystery
6:33 PM
You’re given k arrays, each array has k integers. There are k^k ways to pick exactly one element in each
array and calculate the sum of the integers. Your task is to find the k smallest sums among them.
just for fun :)
@FrownyFrog it is, in polish :) in bulgarian it's a species of snake
@Anush just take the minimum from each array?
what's "schana"?
@FrownyFrog "stena"
a wall
@flawr I don't think that's right
6:36 PM
@Anush let's assume if in one array we did not take the minimum. Then we can make the sum smaller by exchanging that integer with the minimum of that array.
not convinced?
oh, way too similar to be believable I guess :)
@flawr that gives you one sum, you need to find k-1 more
@TerranSwett @FrownyFrog should we carry on in lgwstks?
@FrownyFrog oh
@flawr you may be right.. let me show you the original
@Anush no I was just thinking about the single smallest sum
6:43 PM
ah ok
@Anush Can we take K as an additional input?
@Adám You can only take Special K or your language's cereal equivalent
@Veskah Dyalog APL's special K would be ⌸ which indeed does look like a cereal box.
7:04 PM
Q: How can I draw in Java the altitude of a triangle?

BUGLet's say I have 3 points: A(Ax, Ay), B(Bx, By), C(Cx, Cy). I want to draw the altitude of triangle ABC through A (for example), where an altitude of a triangle is a line segment from a vertex perpendicular to the opposite side. How can I find the coordinates of this opposite side?

7:17 PM
Hello I'm back
7:53 PM
8:10 PM
@MDXF nice to meet you, back, I'm flawr
2 hours later…
10:03 PM
@MDXF just in time to see everyone leaving
2 hours later…
11:51 PM
A: Sandbox for Proposed Challenges

AZTECCOASCII texturing code-golfascii-art2d Write a function or a full program that apply an ASCII texture T to a 2d shape S . Inputs : Shape, texture, dimensions(optionally). Both Shape and Texture can be given by any convenient method (matrix, array of strings or string whit newlines) Shape data...

