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 General Sebast1an‭

150 posts
50%
+0 −0
Challenges Reverse an ASCII string

Java (JDK), 88 83 bytes static void f(String s){for(int i=s.length();i>0;System.out.print(s.charAt(--i)));} Try it online!

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
50%
+0 −0
Challenges Make $2 + 2 = 5$

Java (JDK), 51 50 23 21 bytes x->y->x==y&y==2?5:x+y Try it online! Golfed 27 bytes thanks to @Moshi's advice. Golfed 2 bytes thanks to @user's advice on Discord.

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Q&A Tips for golfing in Java

A clever way to replace Math functions You can shorten if-else statements through the a?b:c syntax, where a is the statement of if, b is the result of if, and c is the result of else. static vo...

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Q&A Tips for golfing in Java

Booleans are replaceable Java, like Python, has pretty convenient yet nasty ways to golfing down code through comparison operators. Especially this case, this time with booleans. You can compare i...

posted 2y ago by General Sebast1an‭

Answer
50%
+0 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Java (JDK), 150 bytes interface M{static void main(String[]a){int i=new java.util.Scanner(System.in).nextInt(),j=0;for(;i!=1;j++){i=i%2==1?i*3+1:i/2;}System.out.print(j);}} Try it online! Fr...

posted 2y ago by General Sebast1an‭

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

Java (JDK), 311 301 296 bytes interface A{static void main(String[]x){String a=" bottle",b=" of beer",c=" on the wall. ",e;for(int i=99;i>0;i--){e=i>1?"s":"";System.out.println(i+a+e+b+c+(...

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
66%
+2 −0
Q&A Tips for golfing in Java

Use interface The special thing about this is that it lets you drop public when you originally call a class to run the main function. class F{public static void main(String[]a{}} interface M{sta...

posted 2y ago by General Sebast1an‭

Answer
66%
+2 −0
Q&A Tips for golfing in Java

Use for(;;) instead of while(true) The title's self-explanatory. A byte saver.

posted 2y ago by General Sebast1an‭

Answer
66%
+2 −0
Q&A Tips for golfing in Java

This is a list of golfing tips for the language known as Java. If you have a tip, add it in!

7 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf tips
81%
+7 −0
Challenges Operation "Find The Operator"

Challenge Make a program that takes input of 3 non-negative integers: a result and 2 other values that once calculated results to the 3rd value. The program must figure out how to get the 2 fir...

5 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by radarek‭

Question code-golf math number
60%
+1 −0
Challenges "Hello, World!"

Seriously, 1 byte H Try it online! Similar to HQ9+.

posted 2y ago by General Sebast1an‭

Answer
50%
+0 −0
Challenges 99 Shortened Bottles of Beer

Seriously, 1 byte N Try it online! Yep. lmao

posted 2y ago by General Sebast1an‭

Answer
50%
+0 −0
Challenges Truthify an array

shortC, 78 bytes i,j;f(Ix,Iy,I*p){R"[");O;i<x;i++)Oj=0;j<y;j++)*p++&&R"[%d,%d],",i,j);J"\b]");} Try it online! From @Lundin's C (gcc) answer.

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges "Hello, {name}!"

shortC, 30 bytes B){Cs[100];Qs);R"Hello, %s!",s Try it online!

posted 2y ago by General Sebast1an‭

Answer
50%
+0 −0
Challenges Obligatory Quine Challenge

shortC, 38 bytes Bs){Rs="Bs){Rs=%c%s%c,34,s,34",34,s,34 Try it online! From GeeksForGeeks's C implementation.

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges Collatz conjecture; Count the tries to reach $1$

shortC, 47 bytes a,b;AOK"%d",&b);b-1;b=b%2?b*3+1:b/2)a++;R"%d",a Try it online! From @ugoren's C answer from CGCC.

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges 99 Shortened Bottles of Beer

shortC, 223 bytes AOC*w=" bottles of beer on the wall",i=100;--i;)R"%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 around":"Go to the stor...

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges Repeat the characters

shortC, 40 37 bytes i;f(C*s,In){O;*s;s++)Oi=n;i--;P*s));} Try it online! A shortC conversion of @Lundin's C (gcc) implementation.

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges Reverse an ASCII string

shortC, 24 bytes f(C*s){*s&&f(s+1)^P*s);} Try it online! A shortC conversion of @Sisyphus's C (gcc) implementation.

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges Encode and decode floating point integers

Python 3, 268 250 235 233 210 197 148 bytes def a(n):e=(n>>6).bit_length();f=2**e;l=n&(f-1);N=(n>>e)&31;return((e+(n>31))<<5)+N+(2*l+N%2>f) def b(r):E=r>>5...

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
71%
+3 −0
50%
+0 −0
Q&A Tips for golfing in Python

| == or This bitwise operator can sometimes be used as the replacement for or. a=-2;b=3 if(a>0)|(b>0):print(a+b) Try it online!

posted 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges 1, 2, Fizz, 4, Buzz!

shortC, 95 93 91 bytes AIi;Wi++<100){C*h[]={"%d "," "},**p=h;i%3||(*p++="Fizz%2$s");i%5||(*p="Buzz ");R*h,i,h[1]); Try it online! From @celtschk's C (gcc) answer.

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer
60%
+1 −0
Challenges Convert integer to English

Python 3, 596 589 585 482 468 467 429 bytes def f(x): s="";i="r fif six seven eigh nine";a=f"zero one two three four five six seven eight nine ten eleven twelve thir fou{i} twen thir fo{i}".sp...

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Answer