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 »
Challenges

Posts tagged code-golf

Code golf is a winning criterion, where users seek to solve the challenge in as few bytes of source code as possible.

This tag doesn't have a detailed wiki yet.

66%
+2 −0
Challenges Is it part of the mandelbrot set?

Input is a number, you have to decide if it is part of the mandelbrot set or not, after at least 16 iterations. This is done by applying this formula: $z_n = z_{n-1}^2 + c$ repeatedly. $c$ is the ...

0 answers  ·  posted 12d ago by [Object object]‭  ·  edited 3d ago by [Object object]‭

Question code-golf
50%
+0 −0
Sandbox 3D compass point from 3D coordinates

posted 12mo ago by trichoplax‭  ·  edited 9d ago by trichoplax‭

Article code-golf
60%
+1 −0
Sandbox Is it part of the mandelbrot set? [FINALIZED]

posted 13d ago by [Object object]‭  ·  edited 12d ago by trichoplax‭

Article code-golf
66%
+2 −0
Challenges Reverse the bits in a Byte

Simple challenge: Read a byte, swap bit 7 with 0, 6 with 1, 5 with 2 and 4 with 3 and then output the byte. For example the byte 0b1001'1100 would turn into 0b0011'1001. Rules: Shortest code wi...

6 answers  ·  posted 1mo ago by [Object object]‭  ·  last activity 16d ago by lovebuny‭

Question code-golf
84%
+9 −0
Challenges Looping counter

Looping counter Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. ...

19 answers  ·  posted 1y ago by celtschk‭  ·  last activity 16d ago by [Object object]‭

Question code-golf
75%
+4 −0
Challenges Knight safe squares

Given a chess board with some knights on it, say how many squares are neither attacked by a knight nor containing a knight. Input An 8 by 8 grid where each square is either a knight or empty T...

3 answers  ·  posted 12mo ago by trichoplax‭  ·  last activity 19d ago by Karl Knechtel‭

Question code-golf
50%
+0 −0
Sandbox A word suggester [FINALIZED]

posted 3mo ago by trichoplax‭  ·  edited 27d ago by trichoplax‭

Article code-golf
50%
+0 −0
Challenges Word suggesting

Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the suggested word is simp...

0 answers  ·  posted 27d ago by trichoplax‭

Question code-golf
66%
+2 −0
Challenges Give the fool's fibonacci sequence

Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: 2,8,34,144,610,2584,10946,46368,196418,...

0 answers  ·  posted 1mo ago by WheatWizard‭  ·  edited 1mo ago by WheatWizard‭

Question code-golf
80%
+6 −0
Challenges Keyword golfing

Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself. The challenge is to...

6 answers  ·  posted 1y ago by Lundin‭  ·  last activity 2mo ago by [Object object]‭

Question code-golf
71%
+3 −0
Challenges Lowercase, but not just the letters

Given a string of printable ASCII characters, convert them all to lowercase, except not just the letters. ASCII characters that are letters have a bit in their binary representation that is 0 for ...

7 answers  ·  posted 12mo ago by trichoplax‭  ·  edited 2mo ago by trichoplax‭

Question code-golf
86%
+11 −0
Challenges Reverse an ASCII string

Your goal is to reverse an ascii string. Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward. Function...

32 answers  ·  posted 3y ago by moony‭  ·  last activity 2mo ago by qwr‭

Question code-golf
58%
+5 −3
Challenges Make $2 + 2 = 5$

In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...

20 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2mo ago by qwr‭

Question code-golf
60%
+1 −0
Challenges Reverse engineer the colors for a layout.

At my job we have to sometimes lay out materials. Materials come in large long rolls and are cut into smaller pieces when being laid out. When we order the rolls we draw up a layout document which...

0 answers  ·  posted 2mo ago by WheatWizard‭

Question code-golf
71%
+3 −0
Challenges Sort letters by height

Given a sequence of lower case letters, sort them into order of height. Heights The heights of letters are dependent on font, so for this challenge the height order to be used is as defined below...

5 answers  ·  posted 11mo ago by trichoplax‭  ·  last activity 2mo ago by Taeir‭

Question code-golf
71%
+3 −0
Challenges Label a hinged tetromino

Given a hinged tetromino, give it a unique, consistent label independent of location, rotation, and reflection. Tetrominoes A tetromino is a connected subset of the square tiling, composed of 4 s...

2 answers  ·  posted 3mo ago by trichoplax‭  ·  last activity 2mo ago by RubenVerg‭

Question code-golf
66%
+2 −0
Challenges Find near miss prime multiples.

Given a number $n \geq 3$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\{-1,0,1\}$. That is there is a prime in the first $n$ p...

0 answers  ·  posted 3mo ago by WheatWizard‭  ·  edited 3mo ago by WheatWizard‭

Question code-golf
75%
+4 −0
Challenges Probability of rolling all 6 dice faces

The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input A positive integer $N$. Your code must work for inputs up to and including 10, but may crash, error, or give ...

4 answers  ·  posted 3mo ago by trichoplax‭  ·  last activity 3mo ago by RubenVerg‭

Question code-golf
66%
+2 −0
Challenges Expected value of highest dice rolled

You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score? Input A positive integer ...

2 answers  ·  posted 3mo ago by trichoplax‭  ·  last activity 3mo ago by RubenVerg‭

Question code-golf
60%
+1 −0
Sandbox Probability of rolling all 6 dice faces [FINALIZED]

posted 3mo ago by trichoplax‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
81%
+7 −0
Challenges Roll n fair dice

Challenge This is a simple randomness challenge: Given a non-negative integer $n$, and positive integer $m$, simulate rolling and summing the results of $n$ fair dice, each of which have $m$ sides...

10 answers  ·  posted 2y ago by Moshi‭  ·  last activity 3mo ago by RubenVerg‭

Question code-golf
66%
+2 −0
Sandbox Expected value of highest dice rolled [FINALIZED]

posted 3mo ago by trichoplax‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
66%
+2 −0
Sandbox Caesar shift cipher [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
50%
+0 −0
Sandbox 99 Shortened Bottles of Beer [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
66%
+2 −0
Sandbox A chunk of symbols is a calculation [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
60%
+1 −0
60%
+1 −0
Sandbox Make my value binary [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
66%
+2 −0
Sandbox Stairs? Stairs! Stairs. [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
60%
+1 −0
Sandbox Abbreviate everything [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
60%
+1 −0
Sandbox Reverse your quine [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
75%
+4 −0
60%
+1 −0
71%
+3 −0
Sandbox Operation "Find The Operator" [released]

posted 2y ago by General Sebast1an‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
66%
+2 −0
Challenges Prove commutativity on this monoid presentation.

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ fro...

0 answers  ·  posted 3mo ago by WheatWizard‭

Question code-golf
75%
+4 −0
Challenges Calculate the Z-array

Task Given a list of numbers $X$ produce a second list of numbers $Y$ such that $Y_i$ is the length of the longest common prefix of $X$ and $X$ with the first $i$ elements removed. For example if...

1 answer  ·  posted 3mo ago by WheatWizard‭  ·  last activity 3mo ago by TheCodidacter, or rather ACodidacter‭

Question code-golf
86%
+11 −0
Challenges Cumulative Counts

Challenge Given an array of numbers return the cumulative count of each item. This is the number of times an item has occurred so far. Examples [1,1,2,2,2,1,1,1,3,3] -> [1,2,1,2,3,3,4,5,1,2]...

19 answers  ·  posted 2y ago by rak1507‭  ·  last activity 3mo ago by WheatWizard‭

Question code-golf
66%
+2 −0
Challenges Build a replacement ball in regex.

In this challenge you will take a number $n$ and a string $X$ of length $\geq n$, and produce a regular expression which matches all strings that are withing $n$ character substitutions of $X$. Sp...

3 answers  ·  posted 3mo ago by WheatWizard‭  ·  last activity 3mo ago by WheatWizard‭

Question code-golf
66%
+2 −0
Challenges Are these reduced forms of the same thing?

Task You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removin...

0 answers  ·  posted 3mo ago by WheatWizard‭  ·  edited 3mo ago by WheatWizard‭

Question code-golf
81%
+7 −0
Challenges Efficient censorship

You are a low-level censor working for the Ministry of Media Accuracy. Part of your job is to make sure that certain words don't appear in publications. Every morning you get a fresh stack of next...

4 answers  ·  posted 3mo ago by WheatWizard‭  ·  last activity 3mo ago by Shaggy‭

Question code-golf
66%
+2 −0
Challenges Connect the corners without 4 in a row

Connect opposite corners of a rectangle of characters without putting 4 characters in a row. Input Two numbers, W and H, representing the width and height of the rectangle Each number will be ...

1 answer  ·  posted 11mo ago by trichoplax‭  ·  last activity 3mo ago by WheatWizard‭

Question code-golf
66%
+2 −0
Sandbox Evaluate a univariate polynomial [FINALIZED]

posted 3y ago by moony‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
71%
+3 −0
71%
+3 −0
Sandbox Generate Lewis Caroll's Jabberwocky [FINALIZED]

posted 3y ago by celtschk‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
60%
+1 −0
Sandbox Write a Deadfish Interpreter[FINALIZED]

posted 2y ago by Razetime‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
71%
+3 −0
Sandbox Shuffle a subset of a list [FINALIZED]

posted 2y ago by user‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
71%
+3 −0
Sandbox Add two negabinary integers [FINALIZED]

posted 2y ago by Moshi‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
81%
+7 −0
Sandbox Reduce over the range [1..n] [FINALIZED]

posted 2y ago by user‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
71%
+3 −0
Sandbox Are All Elements Equal?[FINALIZED]

posted 2y ago by Razetime‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
66%
+2 −0
Sandbox Multiply two strings [FINALIZED]

posted 2y ago by celtschk‭  ·  edited 3mo ago by trichoplax‭

Article code-golf
77%
+5 −0
Sandbox Repeat the characters [FINALIZED]

posted 2y ago by celtschk‭  ·  edited 3mo ago by trichoplax‭

Article code-golf