« first day (2032 days earlier)      last day (1931 days later) » 

6:00 AM
-1
Q: c++ , if else statement doesn't work , where is my mistalke? thanks for the help!

user4745by the following code it should be printed how many times is every element appears in an array but it seems that i have a mistake in my code, that i couldn't recognize the numbers 0.3 and 0.6 are counted as 0.0 i would be grateful if i get some help. void getTotalA(int n, float a[], int b[]);...

 
Anonymous
@LeakyNun Maybe, but then the stack would have to be conserved across every iteration. It's less complicated to just give it a new stack.
 
Anonymous
@LeakyNun That's not a bug. That's a feature that's only present in the newest version. TIO is a version or two behind.
 
Anonymous
Speaking of which... @Dennis, pull Actually please?
 
@Mego Cool, then I can use 'bu to produce c
 
Anonymous
Yep
 
6:09 AM
Also, what is the "extended command"?
 
Anonymous
@LeakyNun 11 bytes: 93+#"{:x}"f
 
Anonymous
@LeakyNun Nothing yet
 
@Mego wow, nice
I'm still going to use 'bu though
 
Anonymous
@LeakyNun If you're talking about the challenge I think you're talking about, that feature post-dates it
 
6:12 AM
@Mego ... y u no say earlier
I've changed everything already
 
Anonymous
Because it's your responsibility to make sure that the language features you use are older than the challenge?
 
sure
Why doesn't this work?
 
Nice thanks
 
Anonymous
After you post your competitive solution, I'm going to try to come up with a non-competitive optimal set of solutions using the entire code page.
 
6:26 AM
Ok
Heck, with your newly added feature, everything can be done in under 3 bytes
 
Which challenge, Leaky?
 
25
Q: Print every printable ASCII character without using it

Helka HombaIn a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program. For example, if your language was Python, your program that outputs the character P might be print(ch...

 
Ah, nice
 
Is ' doable in 3?
 
why would it be?
 
6:30 AM
You said "everything can be done in under 3 bytes"?
 
Oh, with the newly added feature
 
Anonymous
Nope
 
Anonymous
Can't use ' to make '
 
@Mego Except the space
 
Anonymous
"&"u for 4
 
6:31 AM
The space would need to be :32c
since you added u but not D
 
Anonymous
Yeah D is coming next
 
Anonymous
I ran out of time to add the functionality to D
 
Anonymous
There, D now works similarly
 
6:44 AM
0
A: Print every printable ASCII character without using it

Leaky NunActually, 383 For easy reference, the first column is the character code, the second column is the character, and the third column is the code. The code for 0 is a single space. 032 :32c 033 ! HN 034 " 9Fc 035 # :35c 036 $ :36c 037 % :37c 038 & :38c 039 ' :39c 040 ( :40c 041 ) :41c 042 * :42...

@Mego
114 r 9R$F
@Mego \o/
 
Anonymous
Nice
 
7:06 AM
anyone here?
I don't understand this problem
 
@orlp you are given the values of f(1) ... f(10)
your task is to find f(0)
 
@LeakyNun but f(0) is always 0...
f(x) = Σ[n=0..9]{a_n*x^n}
see my problem?
 
@orlp 0^0 is 1 here
 
@orlp How?
 
@ASCII-only apart from because powers of 0...
but 0^0 is undefined
normally
 
7:16 AM
@orlp No, it's 1 normally
 
@orlp just assume that it is 1 here
 
so if I understand this correctly
we have this matrix
[1  1   1    1     1      1       1        1         1          1 | i_1]
[1  2   4    8    16     32      64      128       256        512 | i_2]
[1  3   9   27    81    243     729     2187      6561      19683 | i_3]
[1  4  16   64   256   1024    4096    16384     65536     262144 | i_4]
[1  5  25  125   625   3125   15625    78125    390625    1953125 | i_5]
[1  6  36  216  1296   7776   46656   279936   1679616   10077696 | i_6]
[1  7  49  343  2401  16807  117649   823543   5764801   40353607 | i_7]
 
yes
 
err i should've been a
oh no
a is the variables in the columns
 
multiplier
 
7:23 AM
[1  1   1    1     1      1       1        1         1          1][a_1]    [ f(1)]
[1  2   4    8    16     32      64      128       256        512][a_2]    [ f(2)]
[1  3   9   27    81    243     729     2187      6561      19683][a_3]    [ f(3)]
[1  4  16   64   256   1024    4096    16384     65536     262144][a_4]    [ f(4)]
[1  5  25  125   625   3125   15625    78125    390625    1953125][a_5]    [ f(5)]
[1  6  36  216  1296   7776   46656   279936   1679616   10077696][a_6]  = [ f(6)]
[1  7  49  343  2401  16807  117649   823543   5764801   40353607][a_7]    [ f(7)]
 
yes
 
well
just one equals sign
 
Anonymous
Unless you're multiplying row vectors by single-element vectors
 
Anonymous
In which case the multiple equals signs makes sense :P
 
I had a good idea for a challenge
I'm going to sandbox it soon
sandbox'd
 
7:31 AM
@LeakyNun I don't see an elegant solution
 
@orlp me neither
 
do you know if it's possible to solve a matrix using sympy
but without concrete values
 
0
A: Sandbox for Proposed Challenges

Destructible WatermelonPlay the centipede game king-of-the-hill (please note that I need to learn how to make a controller) In this challenge, you must create a bot which plays the centipede game. In the centipede game, there are two players, and two piles of coins. One pile is 1/4 the size of the other. Each turn,...

 
Anonymous
Probably
 
Anonymous
Just put in variables for the variable values
 
7:36 AM
0
A: Sandbox for Proposed Challenges

Destructible WatermelonPlay the centipede game king-of-the-hill (please note that I need to learn how to make a controller) In this challenge, you must create a bot which plays the centipede game. In the centipede game, there are two players, and two piles of coins. One pile is 1/4 the size of the other. Each turn,...

 
7:47 AM
@orlp As far as I can tell, it's like going from f(1) = 1, f(2) = 4, f(3) = 9 and interpolating a quadratic to get f(0) = 0? But in this case a degree 9 poly
 
if I did everything correctly
a_0 = 10*f_1 - f_10 - 45*f_2 + 120*f_3 - 210*f_4 + 252*f_5 - 210*f_6 + 120*f_7 - 45*f_8 + 10*f_9
a_1 = -4861*f_1/252 + 7129*f_10/2520 + 6121*f_2/56 - 6541*f_3/21 + 6751*f_4/12 - 6877*f_5/10 + 6961*f_6/12 - 1003*f_7/3 + 3533*f_8/28 - 789*f_9/28
a_2 = 79913*f_1/5040 - 6515*f_10/2016 - 115923*f_2/1120 + 400579*f_3/1260 - 71689*f_4/120 + 5985*f_5/8 - 461789*f_6/720 + 22439*f_7/60 - 39867*f_8/280 + 161353*f_9/5040
a_3 = -663941*f_1/90720 + 4523*f_10/2268 + 264767*f_2/5040 - 433739*f_3/2520 + 728587*f_4/2160 - 62549*f_5/144 + 273431*f_6/720 - 242639*f_7/1080 + 435893*f_8/5040 - 197741*f_9/10080
is that the generic solution
(but we only need a_0)
so let's try 10*f_1 - f_10 - 45*f_2 + 120*f_3 - 210*f_4 + 252*f_5 - 210*f_6 + 120*f_7 - 45*f_8 + 10*f_9 out
 
Er... that's an unnecessarily complicated way to go about it I think
 
Anonymous
Yeah, sum(a*b for a,b in zip((10, -45, 120, -210, 252, -210, 120, -45, 10, -1),map(int,input().split())) should work
 
seems that that did it
[10,-45,120,-210,252,-210,120,45,10]
is there some significance to this sequence?
 
Binomial coefficients with alternating signs would be my first guess
 
7:52 AM
seems pascal triangle-esque
yep
 
Hmm now I'm not sure whether the direct approach with your coefficient list is better or whether successive differences is better
 
successive differences?
 
8:08 AM
As in f=lambda L:L>[]and L[0]-f(map(int.__sub__,L[1:],L[:-1])) (badly golfed)
 
also, I'm new to anarchy code golf, why does it give multiple test cases that your program must solve at once?
@Sp3000 Im still confused
 
in Code Golfer's Corner, 15 hours ago, by xnor
is there a reason that anarchy challenges usually have multiple lines in input in each test case?
 
my direct form is not the simplest solution?
 
shrugs
 
I don't understand your solution Sp
can you write it non-golfed?
 
8:09 AM
Easier to give an example, e.g. the quadratic from before
[1, 4, 9] -> [3, 5] -> [2] taking differences
Then starting from the end, 3-2 = 1, and then 1-1 = 0
 
now I'm even more confused
like, how is repeated subtractions a solution for this problem?
 
It's like doing discrete derivatives then interpolating
 
we should have banner art for PPCG.
 
Anonymous
@orlp Divided differences a la Lagrange interpolation
 
Quoi?
 
8:16 AM
7
Q: Implement the Method of Finite Differences

A Nerd - IThe Method of Finite Differences is a technique used to find the next term in a sequence of numbers, given that the sequence is governed by consecutive values of a certain polynomial. Given a list of n terms, the Method will be able to determine the degree of the polynomial, which is a maximum of...

 
^^ thanks xsot, was having trouble explaining
(also forgot that it had an actual name)
 
I didn't know this was a thing actually
 
why does this give a_0 though
 
CMC: 10 programs for each digit without using any digit (0x30 to 0x39 inclusive) in the source code.
 
It's to do with the fact that all the values given are for x=1..9 (i.e. evenly spaced with interval 1)
You could get f(-1) with a repeated application of the second half of the algorithm
 
8:19 AM
It helps to consider simpler polynomials
 
(for example)
 
Pop-con: build the banner for PPCG in 1kb or less?
Make-your-own banner?
 
Pyth:
Z
hZ
hhZ
hhhZ
hhhhZ
hhhhhZ
ttttT
tttT
ttT
tT
 
That way we could have a banner for PPCG and a reasonable pop-con.
 
Anonymous
52
Q: No strings (or numbers) attached

AdámIf you like this, you may also like Official Dyalog APL 2016 Year Game. Make 12 snippets/expressions, in the same language, that result in the numbers 0 through 10, and 42 respectively, but without writing any literal numeric, string, or character data. Build-in data, like PI() and ALPHABET()...

 
8:21 AM
@LeakyNun for C, 'a'^'Q', 'b'^'Q', ...
 
@mego close the challenge on main as dup?
@orlp you forgot main and puts
 
@LeakyNun irrelevant
just wanted to post the solution
not the boilerplate :P
 
alright
 
@Sp3000 I think it's really cool that my two solutions for Fractal X and Fractal Plus only differ by 4 characters
 
8:39 AM
@orlp It's to avoid this kind of scenario: golf.shinh.org/p.rb?read+english+numbers
 
@xsot you can make many test cases without having them in one invocation of your program
 
The site restricts the problem setter to 3 test cases at most.
 
9:02 AM
@orlp for C use the first argument of main instead
 
Morning all
CMC: What's the best pyramid you can make?
 
programming quiz: what is the value produced by the following snippet? (dont cheat)

int a=0; (a++)+(++a)+(a++);
 
i think it is 5 instead
 
(0+1)+(1+1)+(1+1)
Oh yeah, that's five :P
 
9:10 AM
It’s undefined behavior.
 
@LeakyNun i think answer is 3
RTL
a++ increments a but reurns the initial value. ++a increments a and returns the incremented value. It all happens RTL
 
Anonymous
^
 
Anonymous
It depends on the compiler. gcc evaluates LTR, MSVC evaluates RTL.
 
@LeakyNun putchar('D'-' ') ... putchar('M'-' ');
 
Anonymous
Unless I got that backwards again
 
9:20 AM
@Mego i thought gcc is rtl too, it isn't?
 
Anonymous
Oh wait it's RTL for gcc and LTR for MSVC (and clang)
 
Trying to find a good source w8
 
Anonymous
Actually, as of C++17, it's no longer UB. The standard states that the compiler is allowed to choose any evaluation order (indeterminate order).
 
The C Standard states in any UB compiler should choose what happens, what is the difference?
 
10:10 AM
Question: The C Standard says that compilers must specify their UB, but where are these specifications stored?
 
@orlp 80: main(x){for(x<<=16;x--;)x&x/2&'UU'||x%256*putchar((x^x>>8)&85?32:88)||puts("");}‌​
 
@xsot hah, didn't think of multi-letter constants
should I post that?
or
 
Post as orlp (xsot) or the other way around?
However the system works
 
no need to credit me
it's a common trick
looks like you're still behind tails by one byte
 
@xsot ?
oh he posted a new answer then
@xsot wait a sec he's doing something weird
the statistics don't add up
 
10:19 AM
The missing bytes are whitespace characters
 
the only way I can see improving on my golf is the way you handle newlines
like, my answer is already so heavily golfed...
 
10:33 AM
@orlp btw forgot to say regarding earlier, I didn't mean that your solution wasn't simpler, it's just that they both look pretty good and I'm having trouble telling which one's golfier (xsot probably has an idea :P)
 
11:00 AM
@ReleasingHeliumNuclei main? if you have the main you can use the first argument
 
11:44 AM
@Dennis Could you please pull Brachylog?
 
11:56 AM
Anyone know Retina here?
Actually nvm
 
@Fatalize What did you add?
@βετѧΛєҫαγ I am quite fluent in Retina
@ReleasingHeliumNuclei The second one prints 3 because you did not store the expression. You are only printing the final value of b which should be 3.
If you wrote b= (b++)+(++b)+(++b) then it would print 5.
 
@LeakyNun Fixed this
 
@LeakyNun I was wondering if it'd be a good language to answer this in:
9
Q: What's on the TV?

βετѧ ΛєҫαγChallenge Write a program which, using the XML data from the site here, display the name of the programme which is currently showing on BBC 1. Information All times are given at London time (GMT+1 at the time of posting and GMT+0 after the 30th October). Therefore, you should convert your loca...

 
@βετѧΛєҫαγ No because you can't access the internet?
 
Yeah, that's what I thought
 
12:02 PM
@Fatalize I see, thanks
CMC: come up with an alphabet challenge as CMC
 
o___O
 
CMC: Print the Greek alphabet
 
hammered as duplicate
 
Which part, how much, what order
 
3 hours ago, by Leaky Nun
programming quiz: what is the value produced by the following snippet? (dont cheat)

int a=0; (a++)+(++a)+(a++);
;_;
 
@ReleasingHeliumNuclei What
 
you didnt say a= ;_;
 
a=0;_; would define a variable underscore right
 
i wrote "you didnt say `a=` ;_;" btw
 
12:11 PM
that would be syntax error
 
Okay, new CMC: Display my username in as few bytes as possible.
 
HTML: 19 bytes: βετѧ Λєҫαγ CSS: 41 bytes: body::before{content:"βετѧ Λєҫαγ
 
@ReleasingHeliumNuclei You mean I should omit the int?
 
@LeakyNun you understood really wrong ;_; the snippet you posted (int a=0; (a++)+(++a)+(a++);) isnt int a=0; a=(a++)+(++a)+(a++); i meant this
 
coi ro do. What’s up~
 
12:17 PM
Oh...
@Lynn coi
@ReleasingHeliumNuclei I intended it to be something like REPL
where the value intended is the last expression
 
Okay, final CMC:
Create a simple game in under 300 bytes
 
@Lynn what's a coi ro do
 
@ReleasingHeliumNuclei So the smiley you used matched the snippet completely by chance? That's quite a coincidence.
 
@Fatalize "bonjour a tous" in lojban
 
12:24 PM
à*
I see
 
@βετѧΛєҫαγ PowerShell v2+, 100 bytes -- $r=Random -ma 100;while(($x=Read-Host)-ne$r){("Higher","Lower")[$x-gt$r];$i++}"You win! $i guesses."
 
@Fatalize I dont want to type the accent
 
PS C:\Tools\Scripts\golfing> .\random-number-guesser.ps1
50
Higher
75
Lower
65
Lower
60
Higher
63
Lower
62
You win! 5 guesses.
 
@βετѧΛєҫαγ i did one, but its on the coke'd laptop ;_;
 
Don't want to take a look at Lojban, its phonology is awful
 
12:26 PM
In theory ^ that works...
It's an addition game
 
@Fatalize What do you dislike about it?
 
@Lynn It just sounds terrible
 
Obligatory xkcd
 
That prenu klesi makes some pretty cool stuff! There’s a lot of nerdy heated debates though. I just ignore ’em.
 
Also no idea why it uses ' instead of h
 
12:32 PM
I like Lojban, but slightly ironically
 
which looks a lot worse in text
 
You can use h if you like (I do this when typing on my phone)
But yeah there’s Weird Reasons™. It’s a bit of a mess
 
i like the word "pterodactyl"
2
did i spell it correctly?
 
12:41 PM
I believe so
 
yay
 
Do english speakers pronounce the p in pterodactyl?
 
ugh
 
Like Ptolemy
 
12:42 PM
pno, like pneumonia
2
 
Blame the greeks
 
no
 
Blame the british, we have the same words and we pronounce the leading p
 
knee knight know
 
how do you even do that?
 
12:43 PM
@Fatalize we do too
 
knights who say nee
 
… you just pronounce a p before it
that's not that awkward
 
like ph-terodactle?
 
puhtehrodactil
No, that's awful
puhnewmoaneea
 
I say it like terodactle
newmonia
 
12:44 PM
puhtowlemee
 
nee night now
 
@βετѧΛєҫαγ Ok I actually do say the 'p' in that one
 
Pn and Pt are slightly awkward, right, but why not pronounce p in psychology!?
 
12:46 PM
@Fatalize because it would sound weird
'psyduck'
 
@Fatalize It's not like you pronounce your Hs ;)
 
It wouldn't sound weird if everyone did it
 
it messes up with timing of syllables.
 
Then how do you pronounce phthisis?
 
You don't
2
 
12:47 PM
@BusinessCat is that even a word?
 
Sixth is the worst
 
Yes it is
 
@Fatalize sicth
 
n. 1. A disease characterized by the wasting away or atrophy of the body or a part of the body.
 
12:48 PM
8 vs 8th
 
@BusinessCat PH, this is?
 
@muddyfish seek-th?
 
@Fatalize The French accent is strong with you
 
eight vs eighth
 
@Fatalize that would emphasize the 'i' sound, it's meant to be short
 
12:49 PM
siks-th
 
It's actually pronounced thigh-sis for some reason
 
sick-th
 
But that's wrong, x is not pronounced k aaaargh
 
@Fatalize phth is pronounced as th
 
12:50 PM
Damn it, I've forgotten how to say sixth
 
@Fatalize x is ks so xth = ksth and you just elided the s for easy pronunciation
 
sic-th
 
(UK) IPA(key): /sɪksθ/, /sɪkθ/ The latter being non-standard
 
siksþ is da tru way
 
12:51 PM
how the hell do you pronounce ksθ
 
That's how people say it ;_;
 
that's physically impossible
 
@BusinessCat k-th
 
þ and θ are the same thing, former is an icelandic letter and the latter is an ipa thing
 
like cuff
 
12:52 PM
Now you're trying to tell me hard c and k are different sounds
 
Curly c and Kicking k
 
why do you guys have c in the first place
its either s or k
 
blame the romans
 
(shakes head) I don't know...
 
@ReleasingHeliumNuclei Church?
Champion?
 
12:52 PM
I had to practice /sθ/ forever. Also /θs/, /ðz/
(Months, clothes)
 
We could just have one letter to be ch
instead
 
Months and Clothes for some reason I find those not too hard
but sixth though
 
like Ç or Č, its the ch sound in different languages
 
Are you sure you aren’t saying “monts” and “clodes”, though? I was, for years D:
 
12:53 PM
@ReleasingHeliumNuclei the "thorn" isnt an icelandic letter
Saxon runic also has that letter
 
Ç in French is s, just to annoy you even more
 
@LeakyNun you know what i mean ._.
 
@Fatalize of course "ksth" is pronounceable
 
ci-k-th
 
I'm a native English speaker and I can't pronounce sixth properly so don't worry
2
 
12:54 PM
@BusinessCat nobody cares as long as its recogniseable
 
@Fatalize What about circonflexe? Does that change the sound?
 
@ReleasingHeliumNuclei ç is "ch" in your language?
 
@LeakyNun yup
 
@βετѧΛєҫαγ c has no circinflexe
e circonflexe opens the vowel
 
@LeakyNun I know that, I was talking about other letters
 
12:55 PM
o circonflexe closes the vowel
 
@βετѧΛєҫαγ ê is always pronounced /ε/, whereas e is not alway pronouced that way
 
And this is TOTALLY about code golf right?
 
other circonflexes do nothing
 
@muddyfish discussing languages. noone said it was about programming
 
12:56 PM
I always called ê 'an e with a hat'
 
â is pronounced slightly differently than a though that difference is rapidly dissappearing
and î is the same as i
same for û
 
In math they call it a hat
 
@muddyfish actually...circumflex is called a hat in my language :D
 
ô is pronounced /o/ whereas o is sometimes an open o
 
My french teacher told me circonflexes were added when an s was removed from Medieval French. E.g. vestements => vêtements
 
12:57 PM
true but not for all words
 
So I assumed they didn't change the sound
 
forest > forêt / hospital > hôpital
 
but that's not all words with circumflex accents
 
And then English had the sense to not use accents and put the s's back in
 
12:58 PM
english stole the words before the accents appeared I think
 
Meh, the British spoke Medieval French for ages, so we just never changed the language
 
english is a pretty new language
 
Café
 
Old English was around the year 1000 right?
 
12:59 PM
Cheese
 
Lamb...yo
 

« first day (2032 days earlier)      last day (1931 days later) »