Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Posts by Lundin‭

65 posts
66%
+2 −0
Challenges "Hello, World!"

Taxi, 183 bytes Go to Writer's Depot:w 1 r 3 l 2 l."Hello, World!"is waiting at Writer's Depot.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.Go to Taxi Garage:s 1 l 1 l 2...

posted 1y ago by Lundin‭  ·  edited 1y ago by Lundin‭

Answer
66%
+2 −0
Challenges Display a Progress Bar

C (gcc), 88 bytes char a[53]={91},*p=a+1,i;f(n,d){for(;i<50;)p[i++]=1.*n/d<=i/50.?45:124;p[i]=93;puts(a);} Try it online! There's two approaches to this in C that I came up with - eith...

posted 2y ago by Lundin‭

Answer
66%
+2 −0
Meta Category migration and the sandbox

This has probably been discussed before but I couldn't find any posts about it. I think we should re-make the sandbox category in the following way: Votes in the sandbox category should not c...

3 answers  ·  posted 2y ago by Lundin‭  ·  last activity 2y ago by celtschk‭

Question feature-request discussion sandbox categories
66%
+2 −0
Challenges How many odd digits?

C (gcc), 41 bytes r;o(char*s){for(;*s;r+=*s++&1);return r;} Try it online! This is under the assumption that in a function solution, input has to be passed as parameter and output throug...

posted 2y ago by Lundin‭  ·  edited 2y ago by Lundin‭

Answer
66%
+2 −0
Meta How should we handle incorrect answers?

^ That can be used. You can try to contact the person who posted the challenge and have them mark the answer as "React -> Invalid". Or otherwise it seems that anyone can mark an answer as inva...

posted 3y ago by Lundin‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Repeat the characters

C (gcc), 56 bytes i;f(s,n)char*s,n;{for(;*s;s++)for(i=n;i--;putchar(*s));} Try it online! My attempt at recursion ended up at 61 bytes: o;f(s,n)char*s,n;{for(o=n;*s&&n--;putchar(*...

posted 5y ago by Lundin‭

Answer
66%
+2 −0
Challenges "Hello, {name}!"

C (gcc), 43 bytes a[99];main(){printf("Hello, %s!",gets(a));} Try it online!

posted 5y ago by Lundin‭

Answer
66%
+2 −0
Challenges In The Jailhouse Now

C (gcc), 119 118 116 115 bytes #define p(x,y,z) printf(i^1?i^c?#z:#y:#x) i,j;f(c){for(i=1;i<=c;p(╗\n,╝\n,╣\n),i++)for(j=p(╔,╚,╠);j++<c;)p(╦,╩,╬);} Try it online! Function solution. I...

posted 5y ago by Lundin‭  ·  edited 5y ago by Lundin‭

Answer
66%
+2 −0
Challenges 99 Shortened Bottles of Beer

C (gcc), 244 bytes main(){for(char*w=" bottles of beer on the wall",i=100;--i;)printf("%d%.*s%s, %d%.*s%.8s.\n%s, %d%.*s%s.\n\n",i,i-1?8:7,w,w+8,i,i-1?8:7,w,w+8,i^1?"Take one down and pass it ar...

posted 5y ago by Lundin‭  ·  last activity 5y ago by Lundin‭

Answer
66%
+2 −0
Q&A How to add lots of command line arguments to https://tio.run?

I have a question about everyone's favourite Code Golf editor https://tio.run. After picking a language, is there a sensible way to enter command line arguments to it, other than adding them manual...

0 answers  ·  posted 5y ago by Lundin‭  ·  edited 5y ago by Lundin‭

Question code-golf try-it-online command-line-arguments ide
66%
+2 −0
Challenges Caesar shift cipher

C (gcc), 112 bytes Function solution. p,*a;f(char*s,int n){a=strdup(s);for(s=a;*s;s++)(p=isalpha(*s)?(*s&96)^96?65:97:0)&&(*s=(*s-p+n)%26+p);puts(a);} Try it online! Explanati...

posted 5y ago by Lundin‭  ·  edited 5y ago by Lundin‭

Answer
66%
+2 −0
Challenges It's Hip to be Square

C (gcc), 57 64 bytes x,s;main(){scanf("%d",&x);s=sqrt(x);printf("%d",s*s==x);} Try it online!

posted 5y ago by Lundin‭  ·  edited 5y ago by Lundin‭

Answer
66%
+2 −0
Sandbox Print the alphabet using alphabetic source

The task is to write a program that takes no input and prints the English alphabet in upper-case letters. It can be printed either as a single line ABCDEFGHIJKLMNOPQRSTUVWXYZ, or as letters separat...

posted 5y ago by Lundin‭

66%
+2 −0
Sandbox The Tannenbaum series

A series of 7 single digits, that if added in sequence to create an unbalanced binary search tree, is considered a Tannenbaum series, in case: the left branch of the root has depth 3 and consist...

posted 6y ago by Lundin‭

Article code-golf
66%
+2 −0
Challenges Integer to Roman numeral

C (compliant), 194 bytes 197 198 bytes. Golfed version of the function in the question, using X macros: #define L Y(1000,M)Y(900,CM)Y(500,D)Y(400,CD)Y(100,C)Y(90,XC)Y(50,L)Y(40,XL)Y(10,X)Y(9,IX...

posted 6y ago by Lundin‭  ·  edited 1y ago by Lundin‭

Answer
60%
+1 −0
Challenges Find the IP address class

C (gcc), 55 bytes a;f(char*s){for(;atoi(s)&128>>a&&a<4;a++);return 65+a;} Try it online! Just call atoi and start masking with 0x80. If true, keep looping and next che...

posted 2y ago by Lundin‭  ·  edited 2y ago by Lundin‭

Answer
60%
+1 −0
Challenges "Hello, World!"

C (gcc), 30 bytes main(){puts("Hello, World!");} Try it online! This is using GNU C extensions. GNU C allows main() over int main(), ss well as using puts without including stdio.h.

posted 2y ago by Lundin‭

Answer
60%
+1 −0
Challenges Reverse the bits in a Byte

C (gcc), 42 bytes c;f(i){c++<8&&(printf("%d",i&1),f(i>>1));} Try it online! Binary output version.

posted 3y ago by Lundin‭

Answer
60%
+1 −0
Challenges Reverse the bits in a Byte

C (gcc), 47 bytes r,c;f(i){return c++<8&&(r=r<<1|i&1,f(i>>1)),r;} Try it online! I didn't manage to come up with anything better than the most obvious recursive im...

posted 3y ago by Lundin‭  ·  edited 3y ago by Lundin‭

Answer
60%
+1 −0
Challenges Lowercase, but not just the letters

C (gcc), 36 bytes f(int*p){for(;*p;putchar(32|*p++));} Try it online! Similar solutions: 36 bytes too but with new lines: f(int*p){for(;*p;*p|=32,puts(p++));} 37 bytes using recursion:...

posted 4y ago by Lundin‭

Answer
60%
+1 −0
Challenges Sort letters by height

C (gcc), 152 bytes r;e(c){r=c=='j'?5:strchr("bdfghklpqy",c)?4:c=='i'?3:c=='t'?2:1;}c;s;f(char*i,char*o){s?(e(*i),c=r,e(*o)):(qsort(i,strlen(i),s=1,f),puts(i));return r-c;} Try it online! Out...

posted 4y ago by Lundin‭  ·  edited 4y ago by trichoplax‭

Answer
60%
+1 −0
Sandbox Code bowling using unique characters

The aim of the challenge is to write as long a source code as possible (code bowling), every character typed gives 1 point, using the following rules: No symbol typed in the source may be re-use...

posted 4y ago by Lundin‭  ·  edited 4y ago by Lundin‭

60%
+1 −0
Challenges Roll n fair dice

C (gcc), 48 43 bytes s;r(n,m){s+=rand()%m+1;return--n?r(n,m):s;} Try it online! Previous 48 bytes version using loop: i,s;r(n,m){for(;i<n;i++)s+=rand()%m+1;return s;}

posted 4y ago by Lundin‭  ·  edited 4y ago by Lundin‭

Answer
60%
+1 −0
Challenges Looping counter

C (gcc), 47 bytes i,n;f(){for(i=n+++2;i--;)putchar(i?42:13);f();} Try it online!

posted 4y ago by Lundin‭  ·  edited 4y ago by Lundin‭

Answer
60%
+1 −0
Sandbox Bird is the word

Make a program that prints the lyrics of the first verse of Surfin' Bird by the Trashmen: A-well-a everybody's heard about the bird B-b-b-bird, b-bird's the word A-well, a bird, bird, bird, bi...

posted 5y ago by Lundin‭  ·  edited 3y ago by General Sebast1an‭