![]() |
|
Code Golf Challenge #1 - Thue-Morse Sequence - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: Code Golf Challenge #1 - Thue-Morse Sequence (/Thread-Code-Golf-Challenge-1-Thue-Morse-Sequence) |
RE: Code Golf Challenge #1 - Thue-Morse Sequence - Shebang - 08-15-2015 (08-14-2015, 09:58 PM)eclipse Wrote: Fucking hell.. I didn't know golfing was a thing. Yeah, there's a decently-large site on Stack Exchange dedicated to it. It's been running for at least 3 years. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Eclipse - 08-15-2015 (08-15-2015, 02:32 PM)Shebang Wrote: Yeah, there's a decently-large site on Stack Exchange dedicated to it. It's been running for at least 3 years. Yeah, I saw it. Without it my program would be more than 250 Bytes. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Shebang - 08-17-2015 Sending this back up! Looking for some competition so Eclipse doesn't win too easily
RE: Code Golf Challenge #1 - Thue-Morse Sequence - Equinox - 08-19-2015 103 bytes Written in NodeJS. http://ideone.com/N7zDBK Example output (the one on my computer uses argv, argv makes it just 4 bytes longer ):Code: LVL 78 (176/3800) ~ ●●● node ~/bin2.js
[ 0 ]
LVL 78 (258/3800) ~ ●●● node ~/bin2.js 6
[ 0, 1, 1, 0, 1, 0 ]
LVL 78 (349/3800) ~ ●●● node ~/bin2.js 20
[ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1 ]RE: Code Golf Challenge #1 - Thue-Morse Sequence - lux - 08-19-2015 (08-19-2015, 01:00 PM)Stocking Wrote: 103 bytes Use some ES6 self executing arrow functions and you could bring the byte count down. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Equinox - 08-19-2015 (08-19-2015, 01:12 PM)Lux Wrote: Use some ES6 self executing arrow functions and you could bring the byte count down. I can easily bring it down more than a single byte. In-fact, I can bring it down to 97. But too lazy, can't be asked to edit the code. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Shebang - 08-19-2015 (08-19-2015, 01:00 PM)Stocking Wrote: 103 bytes What is the result of n=0? It should not print out anything for this case. EDIT: This does not function as intended for n=0 and n=1. It currently prints out n=1 for n=0, and n=2 for n=1. The rest of the test cases appear to work. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Equinox - 08-19-2015 (08-19-2015, 01:56 PM)Shebang Wrote: What is the result of n=0? It should not print out anything for this case. Originally it would return just 0, but I fixed it (just returns an empty array). Now it's 105 bytes. http://ideone.com/N7zDBK (same link as in the first post) RE: Code Golf Challenge #1 - Thue-Morse Sequence - Shebang - 08-19-2015 (08-19-2015, 02:05 PM)Stocking Wrote: Originally it would return just 0, but I fixed it (just returns an empty array). n=1 still prints [0,1]. It should just print [0]. RE: Code Golf Challenge #1 - Thue-Morse Sequence - Eclipse - 08-19-2015 (08-19-2015, 02:21 PM)Shebang Wrote: n=1 still prints [0,1]. It should just print [0]. Yeah he just needs to set it to print the first n elements of what's returned. |