« first day (2866 days earlier)      last day (1982 days later) » 

12:39 AM
> Definitely not the right language for this kind of challenge, but ah well..
 
12:55 AM
I still doubt 05A1BE is actually longer than Python
there are just so many possible 100-byte programs in a golfing language that one of them should work
 
 
2 hours later…
3:22 AM
CMP: ++foo; or foo++;?
 
3:34 AM
foo++; IMO, since the first thing it tells you is what variable it's working on, and then what it's doing.
 
3:50 AM
I vaguely remember hearing ++foo is faster but that might be swapped by the compiler as needed
 
I use foo++ in general but sometimes I just need to use ++foo
 
4:22 AM
@Pavel I like the former way better
 
I almost always use ++foo
 
I also use ++foo, except in for loops...
for (int i = 0; i < 10; i++)
 
Anonymous
@Pavel Former unless I need the side effects of the latter, or I'm using a language that only supports the latter.
 
I don't think I can name any language that has i++ but not ++i...
 
Anonymous
4:38 AM
@Pavel I believe there's a BASIC variant that only has the latter. I can't think of which one, though
 
5:15 AM
A lot of languages have ++i but not i++, with the catch that they're usually no-ops...
 
 
2 hours later…
7:30 AM
@Pavel When I was a young fool, I'd do things like arr[foo++] = foo or even have multiple ++ and -- within the same statement. Nowadays I'm a bit more restrictive when it comes to that, but if it's a single statement I prefer i++ (like in a for loop), otherwise I'll use whatever it suitable for the situation. The compiler usually creates the same machine code anyway, so having to use ++i is just an artifact of the past.
 
8:19 AM
0
A: Sandbox for Proposed Challenges

Vedant KandoiSeconds to human readable format Not sure whether this has been done before (There are a couple related) Given an integer input n seconds, output the time in human readable format. Output must be a string of the format: x Millennia/Millennium, x Centuries/Century, x Decades/Decade, x Years/Ye...

 
8:42 AM
How many languages support ++i++? i.e. increment by two, returning the value incremented by one?
 
9:01 AM
@JoKing It depends on how you use it. I recently wanted to try just that
#include <stdlib.h>
#include <stdio.h>

int main() {
    int n = 10;
    int *a = malloc(n*sizeof(int));
    for (int i = 0; i < n;) {
        i--[a++] = i++*i;
        printf("%d\n", ++i++[--a]);
    }
}
 
 
1 hour later…
10:19 AM
1
A: Sandbox for Proposed Challenges

lastresortConvert to Suzhou numerals Suzhou numerals (蘇州碼子; also 花碼) are Chinese decimal numerals: 0 〇 1 〡 一 2 〢 二 3 〣 三 4 〤 5 〥 6 〦 7 〧 8 〨 9 〩 They pretty much work like Arabic numerals, except that when there are consecutive digits belonging to the set {1, 2, 3}, the digits alternate between vertica...

 
 
3 hours later…
12:52 PM
@Pavel foo++ unless ++foo is necessary. It almost always will make sense to use foo++ - array[size++]=Val etc and it looks better
 
@maxb it's undefined behaviour though
 
@dzaima I can imagine, I haven't done a proper analysis (and I'm not a C/C++ programmer), so I'm just happy that I got something that ugly running.
 
i--[a++] = i++*i; is undefined behavior, but I'm not sure about ++i++.
Postfix ++ has higher precedence than its prefix counterpart, so the order of evaluation is fixed.
 
I know that it's not that interesting of a challenge for golfing languages, but do we have a challenge to check if an input array is sorted or not? E.g. [0,1,2] => true but [2,1,3] => false. I have looked through the questions, but I couldn't find anything when it comes to code golf.
 
1:38 PM
If it exists, it's missing a tag. codegolf.stackexchange.com/…
 
@Dennis I'll probably add a post in the sandbox, and if anyone has heard of such a challenge I just won't post it. It just feels like a very basic golfing challenge, that definitely should exist on the site in my opinion.
 
We do have a few challenges that require to test if the digits of a number are in ascending or descending order, which is rather closely related.
 
@Arnauld I recall having solved similar challenges myself, so I don't think it's very interesting for languages like 05AB1E and similar (MathGolf solves it with s=). But I'm more interested in solutions using more traditional languages.
 
There's always this if you hate yourself: codegolf.stackexchange.com/questions/22333/…
 
@maxb Probably still a variant of x==sorted(x) in most high-level languages.
 
1:47 PM
do we have a challenge for converting hexadecimal to decimal or vice versa?
 
we definitely have one for decimal to hexadecimal
 
2:01 PM
@Dennis That's a good point, though a lot of major (Java, C#) will have to use another method
 
Still possible even in C, but any approach involving qsort and memcmp probably isn't golfy...
 
2:49 PM
0
A: Sandbox for Proposed Challenges

maxbIs the array sorted? Inspired in part by Creative ways to determine of an array is sorted. Given an array of integers, find out if the array is sorted. This challenge is as simple as it sounds. I'm surprised that I couldn't find a question like this on PPCG. I'm aware that a lot of golfing lang...

 
@Geobits That was the only "is it sorted" question I could find, but it's not a code-golf question which makes it substantially different from the one I'm proposing.
 
1
Q: Chess ASCII Art, Knight

ThaufekiWas meant to post this during the WCC which ended November 28th, however Chess ASCII Art, Knight In honor of the world chess championship, in the shortest possible program, output the following ASCII art piece ,...., ,::::::< ,::/^\"``. ,::/, ` e`. ,::; | '. ,::| \___,-. ...

 
, ... What's the difference?
 
@Dennis I can't tell if you're golfing...
 
Oh, I'm definitely golfing.
 
2:55 PM
Dennis is such a golf
6
 
3:53 PM
0
Q: NPC transforming

l4m2Solve TSP. You're given an oracle(blackbox function) that solves maximum independent set in \$O(\text{number of edges}^3)\$. Fastest algorithm to (number of edges+sum of lengths of edges) win. Note. Because TSP (decision version) is NP and maximum independent set is NP-hard, it's possible to ha...

 
uh... looks like I'm seeing a couple misled stars or something, not sure
 
4:14 PM
?
 
 
1 hour later…
5:27 PM
@JoKing your move
 
5:48 PM
do we have an advent of code leaderboard, or a channel for it?
 
6:36 PM
oh yeah advent of code is happening
I've been so caught up in halite I totally forgot about AoC
 
6:53 PM
What's Advent of Code? (Yes, I looked at the website) Is it just a competition page of various programming puzzles, like Project Euler?
 
one puzzle with 3 parts unlocked every day
you get a star for solving a part
the maximum is, ofc, 75 stars
 
2 parts?
 
Ah, so it has a method of keeping you addicted. ;-)
 
maybe it changed, yeah
 
there is a global leaderboard and private leaderboards
based on how early you completed the puzzles
based on my calculations, -2000 people will complete day 5
 
6:59 PM
That checks out.
 
7:44 PM
uh... I feel like this year's AoC is very, very buggy
at least for my inputs, that is
(I think different people have different inputs)
 
I want to solve AoC in 25 different languages, but I'm not sure if I have the skill
 
you can't...
once you solve a problem, you've solved it, the end
 
I think my AoC is broken
I'm on part 2 and it's not cycling
 
yeah me too
 
And I've let it run for like half an hour
 
7:48 PM
@EriktheOutgolfer no I mean 1 language per day
 
hm... surely you don't want 2 languages per day? :P
that's 50 in total
 
python, then mathematica, then haskell, then apl, then 21 languages I don't even pretend to know
 
@Pavel it should work as long as two numbers in the cumulative sum are congruent mod the sum
 
you mean aoc day 1 part 2?
it took ~150 cycles and 2.5 minutes to finish for me
 
the thing is, of course, you can't spoil code
 
7:51 PM
I'll run my code with the time command and just leave it there for however long it takes
 
we should create a TNB leaderboard :P
 
@H.PWiz that was my original solution too :)
@H.PWiz how did you do 4 in apl?
 
My computer's lagging out
 
(if you did it in apl)
 
Haven't yet
 
7:54 PM
I think it's eating too much memory filing up the list of already seen numbers
 
which ones have you done?
 
First 3
 
i did 1 in emojicode, 2 in python, 3 and 4 in C
 
Would it be ok if I sent someone my list of frequency changes to check if it's actually broken or my code is bugged
My script's up to 7 gigabytes...
 
Can you not check yourself using the criterion I gave you?
 
7:56 PM
anyone done day 4?
 
(Its not a solution on its own)
 
@betseg yes in apl
 
@H.PWiz I'm not actually sure what that means
 
oh nice
 
@betseg it took around 140 cycles for me, and 13 seconds :P
 
7:57 PM
i admit my code isnt the most optimized but it took a short time to write :P
 
Computer crashed
 
mine took a very short time to write, I wrote it in TIO
 
@Pavel Take the cumulative sum. For each x in that, do x%<sum of list> and see if any of those are equal. If not, it is unsolvable
 
inserting the frequencies sorted shortened the run time by about 15% for day 1 part 2 (took inspiration from here )
 
@H.PWiz "those are equal" ... equal to 0 right?
 
8:01 PM
@Cowsquack to eachother, I would imagine
 
wait the differences mod sum should be 0 nvm
 
hmm I wonder
 
@betseg yes
 
@Cowsquack uh, for day 4, did you sort the input file before running the program?
cause i didnt and everyone i saw did
 
given an arbitrary list of additions and subtractions, like the frequency challenge inputs. Is it always possible to eventually reach the same number twice by repeating the list over and over?
oh wait no of course it isn't. It'd fail for +274, -1
 
8:03 PM
if its just +1
 
or yeah
 
@betseg when I submitted my answer, yes, but afterwards I refined my solution to include the sorting in the program
 
you'd have to rely on overflows for that, which is language dpeendent
 
@Cowsquack i wrote a program that doesnt need sorting at all
 
@Skidsdev I believe it is possible if the pairwise differences of the cumsum mod the sum contain a 0
 
8:04 PM
those are words
 
ok i created a private leaderboard, join with 383923-1cc3bff3
11
 
I feel like I'm reading the puzzle wrong or some shit
 
@Cowsquack ^^
 
@Skidsdev take the differences between every pair of integers in the cumulative sum of the input (making sure to not have differences between the same integers), mod that by the sum of the input, and check if there is a 0
 
It works on the test cases...
 
8:08 PM
@betseg I joined :P
 
because every time you concatenate the list with itself, you start again the the sum as the starting number instead of 0, so the cumsum is added to the sum
 
@Skidsdev yay im not alone
 
Can someone please try running part 2 on my frequencies, I've had two different scripts run out of RAM before finishing, which nevertheless work on the test cases: paste.fedoraproject.org/paste/OhCkTxpfsv69ifALNFKE9g
 
program finishes for me
 
God dammit
How long did it take?
 
8:11 PM
<1 second
 
oh damn
nice code
 
fucking dammit
 
apl master race
 
@Pavel my NodeJS solution in TIO finished in 15.751s
@Cowsquack I assume you're doing some fancy math thing rather than just bruteforcing it?
 
I should try running mine in TIO, might work better, who knows?
 
8:13 PM
my python solution on my pc finished in 137 sec
@Pavel on your input
 
My computer runs out of ram before running for that long, jeez
 
my solution just loops through endlessly storing every value it finds until it finds a value it's already stored, then outputs and exits
 
same
 
/me checks if I have a stray malloc(ten thousand)
 
@Skidsdev pairwise differences...
huh I wrote a "brute-force" solution but I lost it
 
8:15 PM
Sidenote: the Team PPCG bot on Halite just hit Silver rank :D we're almost in the top 1000 (out of 2700, but still...)
4
 
@Skidsdev you only need to store the cumsum
 
you can find AoC solutions on google in 30 seconds, can i share my code to make you puke
 
you probably used the puke emoji in your code
 
I mean surely it's fine as long as you clearly mark it as an AoC spoiler
like this:
 
@Cowsquack no, its just bad code™
 
8:17 PM
AHAH
CLOSING EVERY ELECTRON APP ON MY COMPUTER IT FINISHED IN 3 MINUTES
 
lmaoo
 
After hitting swap and freezing my computer, of course
 
Here was my solution [SPOILER]
expects the input copy-pasted into the first argument, with newlines
 
8:20 PM
@Pavel that's so similar mine, even down to print then terminate in the loop :D
 
@Cowsquack can i see your day 4 code
 
I totally cheesed day2 part 1
 
Anonymous
@Pavel My solution was very similar. The only difference was that I used a set.
 
tfw your inputs are most likely unsolvable...
 
I guess I just need to download more ram
 
8:46 PM
i reloaded the leaderboard and saw mego getting 2 stars on day 3 :D
 
Anonymous
:D
 
Anonymous
Doing AoC while I'm waiting for people to respond to questions for real work
 
i did AoC on maths class today
 
9:23 PM
I'm just going to probably do AoC over the weekends and break.
 
9:47 PM
phew, finished all current AoC in apl. 250ms for getting all answers, with the extremely horrible code I wrote for everything :D
 
10:01 PM
DELETE * FROM questions
 
The hero we both deserve and need
 
10:49 PM
@flawr here we go
@Mego yours^
@betseg what is AoC?
 
@Adám oh, thanks!
 
11:09 PM
@Adám those challenge descriptions are way too long could be golfed
 
@flawr I didn't write them. ¯\_⁽⍨⁾_/¯
 
Anonymous
@flawr That is interesting, but not surprising :P
 
so I thought:)
 
@flawr Do you have a website that will generate it given a user id? Would be cool to embed in profile.
 
(just have to change the corresponding url to codegolf)
and this was just the most simple option, you can do a lot of stuff if you want
 
11:17 PM
@flawr Bah, no online service so the cloud gets generated on demand.
 
@Adám this is the simple vanilla version for yours:)
@Adám yeah=/
 
@flawr I figured, I recognised it.
 
Oh, dammit! I forgot about advent of code to do halite.io I have some catching up to do(hopefully not much)
 
Tfw your Bubblegum answer gets more votes than the one you wrote instead of sleeping...
 
@betseg I need to join this, it will give me motivation to actually do it and not show all of PPCG that I can’t get past challenge 2
 
11:28 PM
D1p2 isn't cycling for me either.
 
@Khuldraesethna'Barya Mine gives a cycle at 144th iteration or so
 
I honestly doubt that they give out impossible inputs
 
Tried it locally and on TIO in Python and Haskell. Both worked for other inputs.
 
What is the sum of your numbers? How many numbers are there?
 
1024 numbers, sum to 553
 
11:36 PM
It is possible
Besides, If it wasn't possible, what would the input box be expecting?
 
@Quintec yea I basically completely forgot about AoC because of halite too
 
Yeah, it must be possible. Weird.
 
Anonymous
@Khuldraesethna'Barya If you'd like, you can send me your inputs and I can try with my program
 
Anonymous
11:54 PM
I won't give you the answer, but I can at least confirm that it does repeat at some point
 

« first day (2866 days earlier)      last day (1982 days later) »