Skip to main content

Questions tagged [tips]

For questions asking for tips on golfing in a specific language, doing well in certain challenge tag, or improving a particular piece of code.

Filter by
Sorted by
Tagged with
10 votes
5 answers
748 views

GolfScript many-items rotation

There isn't a builtin in golfscript which lets you rotate a bigger portion of the stack than the three top-most elements. It should take one number n as argument and rotate the nth value from the top, ...
Styleurcam's user avatar
0 votes
1 answer
300 views

How can I reduce the characters in the following python code? [closed]

The following code is 47 characters. print(("Ekki v","V")["COV"in input()]+"eikur!") How can it be reduced to 46 or less? I ...
LargeHorse's user avatar
3 votes
0 answers
148 views

Tips for golfing in Emmental

What general tips do you have for golfing in Emmental? It is a self-modifying language defined by a meta-circular interpreter, so I wonder if there are tips for golfing for this esoteric programming ...
CrSb0001's user avatar
  • 421
8 votes
4 answers
286 views

Tips for golfing in Acc!​!

What general tips do you have for golfing in Acc!!? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Acc!! (e.g. "remove comments&...
Mukundan314's user avatar
  • 12.7k
6 votes
2 answers
548 views

Situations when recursion helps [closed]

Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful. One case per answer.
l4m2's user avatar
  • 26k
0 votes
0 answers
171 views

Shortest Float32Array to Int32Array conversion for audio processing

I'm currently converting a Float32Array to an Int32Array for input to a real-time audio raw PCM to MP3 recording application. <...
guest271314's user avatar
4 votes
0 answers
118 views

Electra "Hello World!" [duplicate]

This will be a bit of a different challenge. Back in 2023, I developed a 2D esolang called Electra, and looking back at my hello world program, (which is 582 bytes by the way) I see a lot of room for ...
DolphyWind's user avatar
-2 votes
1 answer
223 views

Solving Reverse Polish Notation with GolfScript and Eval Function

I am exploring a unique approach to the classic problem of Reverse Polish Notation on code.golf. Unlike the conventional solutions, my focus lies on leveraging the ...
Golfscript-Noob's user avatar
9 votes
4 answers
599 views

Tips for golfing in Uiua

What general tips do you have for golfing in Uiua? I'm looking for ideas that can be applied to code golf problems in general that are specific to Uiua. (e.g. "remove comments" would not be ...
Joao-3's user avatar
  • 1,368
0 votes
0 answers
103 views

Shortest way to print the first 20 numbers in the fibbonacci sequence with python3 [duplicate]

I was wondering if it was possible to make this code even shorter than it already was. f=lambda x:f(x-1)+f(x-2) if x>1 else 1 [print(f(i))for i in range(20)] ...
Eric Pan's user avatar
6 votes
4 answers
1k views

Shortest C code to display argv in-order

I recently tried to produce the shortest C code possible to display all its command line arguments (which are stored in argv). I ended with a relatively small piece of code, and I was wondering if ...
Chi_Iroh's user avatar
  • 173
8 votes
1 answer
328 views

Tips for Golfing in Vyxal 3

The reason for this question is because I made a deadlineless bounty and I need a tips question to link in the bounty Vyxal 3 is the third major version of the Vyxal golfing language. As it is ...
lyxal's user avatar
  • 34k
6 votes
0 answers
288 views

Shortest CSS selector to select ALL html elements, without using asterisk *

What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following: ...
user3163495's user avatar
12 votes
7 answers
4k views

How can I shorten a C code that repeatedly outputs a number?

I wrote a code that separates the numbers from 1 to 9999 by comma void p(n){printf("%d,",n);if(n<9999){p(n+1);}}main(){p(1);} Is there a way to make ...
olivia's user avatar
  • 129
2 votes
2 answers
245 views

Binary expansion and partition numbers [closed]

Not sure if it's correct to ask such a question on this site, but let's try. Let a(n) be a sequence of positive integer such that a(1) = 1. To reproduce the sequence a(n) through itself, use the ...
Notamathematician's user avatar
6 votes
2 answers
292 views

Tips for radiation hardening

The aim of this post is to gather all the tips that can often be applied to radiation-hardening challenges. Please only post answers which can apply to a large number of languages, and one tip per ...
Command Master's user avatar
-2 votes
1 answer
113 views

PHP+C polyglot solution to mixed types

Some built-in functions in PHP return mixed types, like file_get_contents that returns both string or ...
Olle Härstedt's user avatar
1 vote
1 answer
198 views

Shorten this recursive even fibonacci implementation [closed]

I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list: ...
Wheat Wizard's user avatar
  • 99.5k
2 votes
0 answers
99 views

Tips for golfing in Thue

Anyone got tips for golfing in Thue. One tip per answer, and no tips aplicable to all languages (like remove comments)
Dadsdy's user avatar
  • 2,095
4 votes
4 answers
218 views

Tips for golfing in (,) in-paren-comma

What tips do you have for golfing in (,)? I've found that there are so many ways to make code shorter, and I want more ways. I doubt there even are any tips for (,) that are applicable in the majority ...
Dadsdy's user avatar
  • 2,095
6 votes
5 answers
236 views

Tips for golfing in Arturo

Arturo is a bytecode-compiled/interpreted, garbage-collected general-purpose language filling a role similar to JavaScript, Python and Ruby. It is centered around the concept of blocks, which hold ...
chunes's user avatar
  • 26.3k
13 votes
2 answers
1k views

Can Bitshift Variations in C Minor be compressed down to less than 185 characters?

Bitshift Variations in C Minor by Robert Miles is a Code Golf music piece written in C (with some additional bash commands). It was originally presented in a 2016 Computerphile video Code Golf & ...
brubsby's user avatar
  • 253
-2 votes
1 answer
485 views

What is the ABSOLOUTE shortest way to write this code?

So I got kinda bored and was wondering if it was possible to make this code shorter without modifying anything except a file named coin.py... ...
Eric's user avatar
  • 115
3 votes
6 answers
935 views

Tips for golfing in Thunno 2

Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu. It seems like a good idea to share some tips for golfing in Thunno 2. Please,...
The Thonnu's user avatar
  • 18.2k
6 votes
2 answers
400 views

Shortening this Code to process nested tuple even further without the use of max()

I have the code: ...
Dark Programmer's user avatar
7 votes
1 answer
672 views

Is there any less code way to make a leaf (eye) shape in CSS?

I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape: <...
j-0-n-e-z's user avatar
  • 171
0 votes
0 answers
238 views

How to efficiently count all powers of 2 in a given set of numbers in vb.net?

Every integer can be expressed in powers of 2. You know this as the binary system Assume you are given a set of k numbers (...
aludebe's user avatar
  • 17
16 votes
13 answers
2k views

Tips for golfing in SVG

SVG is an XML vector graphics markup language embeddable in web content. Your tips should be at least somewhat specific to SVG. Please post one tip per answer.
Jakob Lovern's user avatar
9 votes
5 answers
562 views

Shortest way to convert the result of a test to a string output (e.g. true or false) in bash

I'm trying to shorten a bash solution to a Code Golf challenge, which requires an output of true or false. I've managed to ...
ShadowRanger's user avatar
5 votes
3 answers
881 views

Tips for shortening this type-safe addition in JavaScript

Consider: c=(a,b)=>(+a||0)+(+b||0) Yes, it is not good to solve it like that. But I want to shorten it even more. If a is a ...
Felix Schönherr's user avatar
0 votes
2 answers
225 views

Tips for golfing in Wren

Wren is a small, fast, class-based concurrent scripting language. Does anyone have any tips for this language? Please make sure to post 1 tip per answer, and don't post answers like "remove ...
DialFrost's user avatar
  • 5,097
13 votes
4 answers
2k views

Tips for improving your score in fastest code challenges

Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible. From the tag wiki: The winner of a fastest-code challenge is determined by the runtime ...
mousetail's user avatar
  • 13k
8 votes
2 answers
612 views

Inverting string-based binary number in one line in Python

I want to read two strings on separate lines, each string the same length and containing only 0's and 1's, and determine if the first is the one's complement of the second. How succinctly can this be ...
Fixee's user avatar
  • 181
3 votes
0 answers
106 views

Tips for golfing in Arn

Does anyone have tips on how to golf in this language? Please one tip per answer and avoid posting simple and general tips such as "remove whitespace". Here is the github link and here is ...
DialFrost's user avatar
  • 5,097
2 votes
0 answers
283 views

Shorten this dns txt record request script as much as possible

I have made a short script that will pull dns txt records down from a server and combine them into a single string. DNS txt records are: 1.website.com ...
I am Jakoby's user avatar
6 votes
1 answer
226 views

Need some feedback with PHP+C polyglot code and class/struct properties [closed]

If you consider the following PHP+C polyglot snippet, there is a problem regarding class property access in the printf call: ...
Olle Härstedt's user avatar
4 votes
3 answers
1k views

Python: can I shorten this code further for checking substrings

So the golf question was like this: You are given a number T and then a total of T number of 17-character strings. For each of ...
chnmasta05's user avatar
5 votes
1 answer
742 views

Help me golf this C program checking for string patterns in a sorted hand of cards

I could not think of a better title. This is a tips question. I'm asking for tips on golfing my code. I recently took part in a code golf competition in C. The competition ended and I lost. The ...
TwilightSparkle's user avatar
11 votes
7 answers
809 views

Tips for golfing in Knight

Knight is the Language of the Month for August 2022, and I noticed that it didn't have a tips page, so here it is! I'm looking for ideas which can be applied to code-golf problems and which are also ...
Aiden Chow's user avatar
15 votes
2 answers
2k views

Can `a?b<c:b>c` be shortened in Javascript?

So I have the situation where I have one boolean value a and, if that one is true and b<c ...
Julian Wagner's user avatar
8 votes
4 answers
131 views

Tips for golfing in J-uby

J-uby is the Language of the Month for June 2022, so I'm looking for tips for golfing in it. As usual, please post one tip per answer, and avoid general tips such as "remove whitespace" or &...
naffetS's user avatar
  • 12.8k
11 votes
2 answers
880 views

Curry tips for Haskell programmers

Curry is the Language of the Month this month and some users are starting to get into it, so let's get some tips together. Haskell and Curry are similar in a lot of ways and a lot of tips for Haskell ...
Wheat Wizard's user avatar
  • 99.5k
13 votes
5 answers
956 views

Tips for golfing in Piet

Seeing that the current language for Learn You a Lang for Great Good is Piet, and that we don't seem to have a tips page for Piet yet, I decided to make one. Piet is a stack-based esoteric programming ...
Aiden Chow's user avatar
2 votes
0 answers
103 views

Tips for golfing in Fennel

Fennel is a lispy language which compiles to Lua. From its page: Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax ...
zoomlogo's user avatar
  • 1,655
4 votes
0 answers
222 views

Tips for golfing in Seriously

I am looking for tips to code in this golfing language Seriously, and was wondering what some of the ways for golfing this language is. "Remove comments" is not a tip. Actually is also ...
DialFrost's user avatar
  • 5,097
7 votes
2 answers
308 views

How to shorten Python code involving the sum of reciprocals?

I have a coding problem that goes like this: Given a positive integer \$N\$, return a list of all possible pairs of positive integers \$(x,y)\$ such that $$\frac1x+\frac1y=\frac1N$$ I already solved ...
Aiden Chow's user avatar
-11 votes
1 answer
365 views

The right way to return [[0, 0, 0], [0, 1, 0], [0, 0, 0]] [closed]

Here is the program to return [[0, 0, 0], [0, 1, 0], [0, 0, 0]] [[0]*3,[0,1,0],[0]*3] Try it online! Can you shorten this code?...
Fmbalbuena's user avatar
  • 4,225
13 votes
2 answers
354 views

Shortest way to coerce to array

Given a variable a (non array) or (any[]) convert to (any[]) function example(s: string | string[]) { const e = Array.isArray(s) ? s: [s] return e } Is ...
ThomasReggi's user avatar
7 votes
6 answers
210 views

Tips for golfing in Lexurgy

What general tips do you have for golfing in Lexurgy? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Lexurgy (e.g. "remove ...
bigyihsuan's user avatar
  • 10.4k
10 votes
2 answers
902 views

Can I shorten this Python code for simulating a car driving around

I am trying to write a solution to the following problem using as few characters as possible (to meme my friend and introduce him to golfing). Can any improvements be done to my code? So the problem ...
chnmasta05's user avatar

1
2 3 4 5
8