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
11
votes
1answer
3k views

Shortest python A + B program with input and output

Some of you may say that I am wasting my time, but this task does not give me peace for more than 500 days. It is required to write a program in Python 3.x that takes two numbers as input and displays ...
9
votes
1answer
728 views

C# First 1 (right to left) in binary number

I am trying to use C# to find the index of the first 1 (right to left) in the binary representation of a number. For example, since 100 in binary is: 0b1100100 ...
7
votes
4answers
652 views

How can I golf this code to count all perfect squares below 100?

I'm trying to strip down my python code to be as few lines as possible. The task: count how many square numbers are below 100. Here's my code so far: ...
32
votes
7answers
3k views

Tips for writing quines

A quine is a program that produces output that's identical to the program's source code. On this website, we generally only care about proper quines (at the time of writing, the current definition is "...
7
votes
2answers
434 views

PowerShell: test connection in as few characters as possible

I need this down to as few characters as possible. I would use Test-NetConnection but I need PSv2 compatability. Any help would be appreciated. ...
13
votes
10answers
773 views

Tips for golfing in Röda

Röda is a stream-based scripting language created by fergusq. What general tips do you have for golfing in Röda? I'm looking for ideas that can which can be applied to code-golf problems and which ...
13
votes
5answers
285 views

Tips for golfing in Underload

Underload is a stack-based semi-functional tarpit created by ais523. I've recently been trying to golf in it, as it's a surprisingly elegant language. What tips do you have for golfing in Underload? (...
14
votes
4answers
492 views

Tips for golfing in TikZ

TikZ is a Latex package used for drawing precise images in Latex documents. It has a massive specification and a boatload of features that may be useful for graphical-output style questions. What ...
11
votes
8answers
878 views

Tips for golfing in SmileBASIC

SmileBASIC deserves more attention. I've only seen 3 users here (including myself!) providing SB answers, and while that doesn't surprise me, it disappoints me. It being a paid lang as well as being a ...
5
votes
3answers
207 views

Tips for golfing in tinylisp

tinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can ...
23
votes
7answers
562 views

Tips for golfing in Brachylog

Brachylog is a language that's beginning to rise in prominence in code-golfing recently (and just received a major update with a terser syntax). Like Prolog, it has the advantage that it can often ...
33
votes
6answers
11k views

Python workarounds for assignment in lambda

This is a tips question for golfing in Python. In Python golfing, it's common for a submission to be a function defined as a lambda. For example, ...
9
votes
3answers
1k views

Smallest possible runnable Mach-O executable

What is the smallest possible runnable Mach-O executable on x86_64? The program can do nothing (not even returning a return code), but must be a valid executable (must run without errors). My try: ...
5
votes
1answer
237 views

Tips for golfing in Wierd

What tips do you have for golfing in Wierd? Tips for golfing other languages don't seem to help one golf Wierd programs so I'm looking for ideas that can be applied to code golf problems that are ...
12
votes
3answers
725 views

Tips for golfing in Nim

What general tips do you have for golfing in Nim? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Nim (e.g. "remove comments" is not ...
48
votes
16answers
4k views

Tips for creating polyglots

A polyglot is a program that can be run in 2 or more different programming languages. What general tips do you have for making polyglots, or choosing languages that are easy to write polyglots for a ...
16
votes
1answer
322 views

Tips for golfing in Starry

What general tips do you have for golfing in Starry? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Starry (e.g. "remove comments" is ...
41
votes
14answers
13k views

Tips for golfing in 05AB1E

Do you have any tips for code-golfing in 05AB1E, a golfing language created by Adnan? Your tips should be at least somewhat specific to 05AB1E. Please post one tip per answer.
24
votes
9answers
2k views

Tips for Golfing in Brain-Flak

Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000. Some users are very experienced in the mysterious ways of Brain-Flak. So I thought ...
8
votes
6answers
737 views

Tips for golfing in Emotinomicon

What general tips do you have for golfing in Emotinomicon? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Emotinomicon (e.g. "remove ...
6
votes
3answers
167 views

Tips for golfing in S.I.L.O.S

What general tips do you have for golfing in S.I.L.O.S? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to S.I.L.O.S (e.g. "remove ...
22
votes
4answers
1k views

Are there any languages especially good at ASCII art?

I was wondering if there are any esoteric or golfing languages which specifically target text output and ASCII art? For example, 05AB1E at least started by targeting base conversions. Are there any ...
29
votes
11answers
2k views

Tips for golfing in Excel?

It's strange that I haven't seen this, as Excel seems to be a valid language for code golfing (despite its 'compiler' not being free). Excel is somewhat of a wildcard in golfing, being good at ...
12
votes
6answers
666 views

Tips for golfing in Haxe

What general tips do you have for golfing in Haxe? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Haxe (e.g. "remove comments" is not ...
2
votes
0answers
144 views

Tips for golfing in SageMath

SageMath is an open-source mathematics software system, built on Python 2. Its extensive math library support makes it a strong choice for golfing in math-based challenges. What tips do you have for ...
20
votes
3answers
1k views

Brainf*ck Loop Problem

I have a problem for a cyber club that asks you to print: ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! Using Brainf**k in 29 bytes or ...
7
votes
1answer
631 views

How can I shorten this multiple assignment in Lua?

Is there any better way to golf this (other than removing newlines/indentation)? ...
16
votes
4answers
2k views

Java Asterisk Rectangle

For my CS class, my instructor has given us the assignment of creating a rectangle made of asterisks with diagonal lines drawn through it in Java. He also told us to write it in as few bytes as ...
6
votes
1answer
330 views

Javascript tips: 2 to the power of x multiplied by n

I'm new to ES6 and code-golfing. Here's the original function: function puzzle(n, x) { return n * Math.pow(2, x); } And here's what I have so far: <...
5
votes
2answers
443 views

Tips for golfing in Common Lisp [duplicate]

What general tips do you have for golfing in Common Lisp? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Common Lisp (e.g. "remove ...
15
votes
2answers
1k views

Is there a way of shortening fat-arrow functions?

From what I've seen throughout my time here on PPCG, most JavaScript entries involving fat arrow functions tend to be one of two camps: The simple ones that are capable of running as a single ...
4
votes
2answers
445 views

Tips for golfing in Jellyfish

Jellyfish is a two-dimensional esoteric programming language inspired by J and written in Python 3. It was inspired by a challenge on PPCG. The name was suggested in PPCG chat as a combination of ...
12
votes
6answers
308 views

Tips for golfing in Cheddar

Cheddar is a high-level, functional + object-oriented programming language created by our user Downgoat designed to make programming easier, faster, and more intuitive. What general tips do you have ...
6
votes
2answers
178 views

Tips for golfing in Fishing

I recently found out about the Fishing language, and it is now a favorite of mine. However, I'm finding it difficult to do anything cool with it, including code golf. Are there any tips for golfing ...
1
vote
1answer
158 views

JSON tips: filter objects from array of objects where object name is alpha [closed]

What could be the shortest code for filtering the following array in Javascript without any library? My code is: filtered_obj = _.where(obj, { name: "Alpha" }); ...
12
votes
1answer
280 views

Coercing a string to an integer in GolfScript

GolfScript automatically coerces values, according to the following ‘priority’ sequence: integer → array → string → block (listed from lowest to highest.) This means that ...
10
votes
1answer
658 views

How to find the item in a list whose f(item) is the smallest?

I have a list, l and a function f. f is not strictly increasing or decreasing. How can I ...
14
votes
1answer
363 views

Tips for golfing in Erlang

Does anybody have tips for golfing in Erlang? I'm looking for specific things that can be applied to Erlang, not any language. I know we already have tips for Elixir, but that is different. As usual,...
18
votes
1answer
1k views

Better way to read multiple int in C than scanf

I'm trying to read 4 ints in C in a golfing challenge and I'm bothered by the length of the code that I need to solve it: ...
2
votes
0answers
238 views

Help golfing MIPS assembly [closed]

I want to write 7 assembly instructions (28 bytes) that runs a logical equivalent of this C snippet: c = a + b + 6; while (c > 5) { c = c - a; b = b + 1; } ...
10
votes
5answers
1k views

Tips for golfing in Lisp

What general tips are these for golfing in Lisp (any dialect)? Please post one tip per answer, and only answers that are specific to a dialect of Lisp (e.g. "remove comments" is not an answer). ...
26
votes
12answers
1k views

Tips for golfing in Swift

What are some tips for code-golfing in Swift? Its focus on safety seems to make it difficult to golf in, but that makes little tips and even more useful. Are there any features in Swift that may help ...
12
votes
7answers
1k views

Tips for golfing in Jolf

Jolf is a procedural golfing language made by @CᴏɴᴏʀO'Bʀɪᴇɴ. What tips do you have for golfing in Jolf? Please post one tip per answer. These tips should be at least somewhat specific to Jolf, e....
7
votes
8answers
374 views

Tips for golfing in PARI/GP

PARI/GP is a free computer algebra system. It is designed for (algebraic) number theory, not golfing, but that's part of the attraction. Unsurprisingly, it fares best at mathematical tasks; its ...
21
votes
12answers
1k views

Tips for golfing in MATL

MATL is a golfing language created by Luis Mendo. MATL has proven to be highly competitive, often beating submissions in other golfing languages such as Pyth, CJam and Jelly. What are some useful ...
7
votes
3answers
510 views

How can I shorten this python code analyzing a 3d grid?

My Python 3 function golf(...) should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal ...
19
votes
13answers
721 views

Tips for golfing in dc

What general tips do you have for golfing in dc? dc is a calculator utility for UNIX/Linux that predates the C language. I am interested in how to make my dc programs (calculations?) shorter. I'm ...
5
votes
1answer
876 views

Need help golfing Python 3 code to calculate volume & surface of spheroids in <150 bytes

I want to write a function golf(C, A) that takes the height (C = 2*c) and the width (A = 2*a)...
19
votes
9answers
711 views

Tips for golfing in Racket / Scheme

What general tips do you have for golfing in Racket / Scheme? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Racket / Scheme (e.g. "...
14
votes
4answers
783 views

Tips for King of the Hill bots

What general tips do you have for creating a bot to participate in a King of the Hill challenge? What strategies do you use to go from considering the challenge to creating your bot? What data ...

1 2 3
4
5
7