instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Input
A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$.
Output
The output is obtained by applying successive rotations to the input string.
For each letter ([a-zA-Z]) in the input string, going from left to right:
if the letter is in upper case, rotate all characters before it by o... | stackexchange_codegolf |
A Shift matrix is a binary matrix with one superdiagonal or subdiagonal formed by only ones, everything else is a zero.
A superdiagonal/subdiagonal is a diagonal parallel to the main diagonal, which is not the main diagonal, i.e. all entries \$a_{ij}\$ where \$i=j+k\$ and \$k \neq 0\$.
The main diagonal is defined to b... | stackexchange_codegolf |
sandbox (deleted)
Lets define a matrix of 9s as:
$$ N = \begin{bmatrix} 9&9&9\\9&9&9\\9&9&9 \end{bmatrix} $$
Lets define an exploding number as a number at position \$(x,y)\$ that can be decomposed into equal integers between all its adjacent neighbors (including itself) and the absolute value of each portion is great... | stackexchange_codegolf |
In this challenge, the goal is to find the values of some variables after a number of assignments are done. An example input:
a = 5
b = 4
c = a = b
a = 2
b = a
This would result in:
a = 2
b = 2
c = 4
Each statement will be one of the following:
A variable name ([a-z_]+)
A numeric value ([0-9]+)
An assignment operati... | stackexchange_codegolf |
Not a duplicate of the valid move challenge because that asks for specific pieces.
Backstory
The other night I was doing a little trolling with ChatGPT and chess. I was trying to get it to call me out for making illegal moves, as a lot of the time, you can feed it whatever nonsense you want. While doing so, I wondered ... | stackexchange_codegolf |
The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we would replace a with d, b with e, w with z, x with a and so on.
Here is an example (rotation amount: 10):
Robo sc kx ohkwzvo
This cipher is very weak, becau... | stackexchange_codegolf |
You have a line with two endpoints a and b (0 ≤ a < b) on a 1D space. When a or b has a fractional value, you want to round it to an integer.
One way to do this is to round a and b each to its nearest integer, but this has a problem that the length of the rounded range (L) can vary while b - a stays the same. For examp... | stackexchange_codegolf |
Your task is to make a program that will take an input of a word of any length, in the Calibri font. This word will be made out of letter characters that are found on a normal QWERTY keyboard. There will be no accents or any other characters (i.e punctuation, numbers etc).
So, the original characters are:
A B C D E F ... | stackexchange_codegolf |
I'd like to propose a different kind of golfing challenge to this community:
(Artificial) Neural Networks are very popular machine learning models that can be designed and trained to approximate any given (usually unknown) function. They're often used to solve highly complex problems that we don't know how to solve alg... | stackexchange_codegolf |
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 with Fishing to use the least characters? And any string manipulation tricks would be cool, as I am finding that difficult... | stackexchange_codegolf |
Implement a function or program that can run simplified BitCycle code. The functions you must implement are:
<^>v: Change the direction of a bit to the direction this is pointing.
+: Turn all 0s left and all 1s right.
\ and /: Reflect one bit 90 degrees, then become inactive. In regular BitCycle, this is displayed as -... | stackexchange_codegolf |
UBASIC is a freeware basic interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing. It is considered to be a "ready-to-run" language that and is capable of running on DOS and Windows.
What general tips do you have for golfing in uBasic? Any ideas that can be applied to cod... | stackexchange_codegolf |
Introduction
Brainstract, a newly created dialect of Brainfuck adds a bit more elements to the syntax. In addition to the normal Brainfuck syntax, there are macros. To define a macro:
{macro_name ++++}
Then use it:
{macro_name} Adds 4 to the current cell
Challenge
Your challenge is to take a valid Brainstract progra... | stackexchange_codegolf |
I'm currently scanning a bunch of handwritten documents and converting them to .txt files. Since I have a terrible handwriting the .jpg->.txt converter converts some of my umlauts to the "normal" letter encased by '
Task
Write a program or a function that:
Is given a string
you can choose any I/O codepage as long as
... | stackexchange_codegolf |
Satisfying Rounding
You know when you're in science class, and asked to round to 2 sig figs, but your answer is 5.2501...? You should round to 5.3, but that's just so unsatisfying! By rounding to 5.3, you're off by a whole 0.05, which is a large amount compared to 0.1 (the place value you're rounding to)! So help me ro... | stackexchange_codegolf |
In a matrix of characters, a cursor is a movable position between two adjacent characters, before the first character or after the last character in a line, like that "I"-shaped indicator which moves while you type.
In this challenge, a cursor position is considered valid if at least one of its two sides touches a spac... | stackexchange_codegolf |
Background
This challenge is about the Game of Go. Here are some rules and terminology relevant to this challenge:
Game of Go is a two-player game, played over a square board of size 19x19.
One of the players plays Black, and the other plays White. The game is turn-based, and each player makes a single move each turn... | stackexchange_codegolf |
You are given an array A of non-negative integers. You can pick any non-empty subset, S from the array A. The score of a subset S is the sum of the elements in S raised to the power of K, i.e. for a subset S={s1,s2,…,sm}, the score of S is (s1+s2+…,sm)K. Output the sum of scores over all possible non-empty subsets of A... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 14.
To recap: The disk is a rectangular grid with \$r\$ rows and \$c\$ columns. Each square in the disk is either free (0) or used (1). So far, you have identified the current status of the disk (a 0-1 ma... | stackexchange_codegolf |
What all languages have a construct similar to python's eval, so you can write code during runtime and run it?
A list would be helpful for certain programming challenges - ones where it is obvious an eval is either necessary or highly efficient.
| stackexchange_codegolf |
Program: To count the sum of all Unicode characters of a given input.
(No need to display the output. The final answer can be calculated in any base no need to convert back to hexadecimal.)
Test case : XyZ= 0058+0079+005A=012B
Condition: If the program is inputted, then its output must be an integral multiple of 1729 (... | stackexchange_codegolf |
Given \$ i = \sqrt{-1} \$, a base-\$ (i - 1) \$ binary number \$ N \$ with \$ n \$ binary digits from \$ d_{0} \$ to \$ d_{n - 1} \$ satisfies the following equation.
$$ N = d_{n - 1} (i - 1) ^ {n - 1} + d_{n - 2} (i - 1) ^ {n - 2} + \cdots + d_{1} (i - 1) + d_{0} $$
For example, a decimal number \$ 15 \$ is \$ 1000111... | stackexchange_codegolf |
The optimal matrix (for the rather narrow scope of this challenge) is obtained by "zipping" the elements from the corresponding rows and columns of a square matrix and getting the maximum of each pair.
For instance, given the following matrix:
4 5 6
1 7 2
7 3 0
You can combine it with its transpose to get: [[[4,5,6],[... | stackexchange_codegolf |
API Easter egg hunt!
There's an API at http://easter_egg_hunt.andrewfaraday.com which will provide a special Easter egg hunt, just for you...
You can see the API docs at the above address, or try it from here.
The API:
All calls to this API are GET requests, which will return a JSON string.
These examples are in a 5x5 ... | stackexchange_codegolf |
A regular string looks like this:
Hello,IAmAStringSnake!
And a string snake looks something like this:
Hel
l rin
o,IAmASt g
S
!ekan
Your Task
String snakes are dangerous, so you must make a program that takes a string snake as input and outputs it as a regular string.
Specification... | stackexchange_codegolf |
Homologous series, any of numerous groups of chemical compounds in each of which the difference between successive members is a simple structural unit.
As an example, Alkane is a homologous group where the chemical compounds are in \$C_nH_{2n+2}\$ format. \$CH_4\$ (Methane) is part of the Alkane group because \$CH_4 \t... | stackexchange_codegolf |
The challenge is make a digital clock that exhibits ascii numbers in a 24-hour format like:
_ _ _ _
|_| |_| . |_| |_|
|_| |_| . |_| |_|
or
_ _ _
_| _| . |_| |_
|_ _| . | _|
and updates the screen every 1 minute (or every 1 second, for praticity reasons). It must reset to 00:00 after 23:5... | stackexchange_codegolf |
The challenge is to write a program which will find the shortest (least number of characters) command which will navigate to a target directory, given a starting directory, assuming a standard linux file system.
Take the following file system as an example, starting from ~:
.
├── target
└── test
└── starting
If th... | stackexchange_codegolf |
Introduction
This is the evolution of this previous challenge which was about checking satisfieability of normal formulae in conjunctive normal form (CNF). However, this problem is NP-complete and watching algorithms finish is just boring, so we're gonna simplify the problem!
Specification
Input
You may tune the follow... | stackexchange_codegolf |
If you place a knight on any square of a chessboard, what is the smallest amount of steps to reach every position?
Rules
It is an 8 by 8 board.
The knight starts at an arbitrary position, taken as input.
The knight moves 2 squares in one direction and 1 square in the other, for example, a knight on the square marked N... | stackexchange_codegolf |
Given a string, return that string's "luck".
A string's luck, as I completely just made up for the purpose of this challenge, is an integer, determined as so:
The base luck for a string is 1.
For each consecutive letter it shares with the word "lucky" (case insensitive), multiply the luck by 2. For instance, if your s... | stackexchange_codegolf |
Task
Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
The output should be a truthy or a falsy v... | stackexchange_codegolf |
Your task is to write 2 functions/programs. They may share code.
The first function must, given a string and a character, output a new string that does not contain that character.
The second function must, given the string from the previous function and the excluded character, reconstruct the original string.
All input... | stackexchange_codegolf |
Generate the shortest possible code in any programming language that can generate all Pythagorean triples with all values not exceeding a given integer limit. A Pythagorean triple is a set of three integers \$(a, b, c)\$ that satisfy the equation \$a^2 + b^2 = c^2\$. The program should output the triples in any format,... | stackexchange_codegolf |
Problem
Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers \$x_1, x_2, x_3... x_n\$ representing n rounds of coin flipping.
At each round, we randomly flip \$x_i\$ number of coins at random. i.e Coins that were heads become tails, and vice versa. Within each round,... | stackexchange_codegolf |
Your Task
Write a program that displays a dot that moves toward the position of your mouse at 4 pixels per second. The dot must be 100 pixels big and the window must fill the computer screen.
Input
None
Output
A window showing an animated dot moving towards the mouse at a fixed, non-changing speed.
Scoring
This is code... | stackexchange_codegolf |
Related: Clearly parenthesize APL trains
Background
In the most basic form, APL has two kinds of tokens: arrays and functions. For this challenge, we will use a lowercase letter a-z for an array, and an uppercase letter A-Z for a function. Furthermore, we will assume each character is a token of its own; Fx is equivale... | stackexchange_codegolf |
[Latest update: benchmark program and preliminary resuls available, see below]
So I want to test the speed/complexity tradeoff with a classic application: sorting.
Write an ANSI C function that sorts an array of floating point numbers in increasing order.
You can't use any libraries, system calls, multithreading or inl... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
There's a good news and a bad news.
Good news: you got a Christmas present from Santa. (Already?! Christmas is two weeks away!)
Bad news: the present is locked with a laser lock. And a note next to it says:
Only the ones who can prope... | stackexchange_codegolf |
A nondeterministic finite automaton is a finite state machine where a tuple \$(state,symbol)\$ is mapped to multiple states. Ie. we replace the usual \$\delta : Q \times \Sigma \to Q\ \$ transition function of a DFA with another function \$\Delta : Q \times \Sigma \to \mathcal{P}(Q)\$.
If you know what an NFA is you mi... | stackexchange_codegolf |
Inspired by this question and refined by Luis Mendo.
Challenge
Given a 2D matrix of integers, each row has a maximum value. One or more elements of each row will be equal to the maximum value of their respective row. Your goal is to determine which column(s) contain the most entries which are equal to their respective ... | stackexchange_codegolf |
Given an alphabet represented as a nonempty set of positive integers, and a word made up of symbols from that alphabet, find that word's position in the lexicographically ordered set of all words, assuming words can't contain duplicate symbols.
Example
Consider the alphabet {1, 2, 3} and the word [2, 3, 1]. The set of ... | stackexchange_codegolf |
Let's define a function \$f\$ which, given a positive integer \$x\$, returns the sum of:
\$x\$
the smallest digit in the decimal representation of \$x\$
the highest digit in the decimal representation of \$x\$ (which may be the same as the smallest one)
For instance:
\$f(1)=1+1+1=3\$
\$f(135)=135+1+5=141\$
\$f(209)=... | stackexchange_codegolf |
Introduction
One question that I have come across recently is the possibility of dissecting a staircase of height 8 into 3 pieces, and then re-arranging those 3 pieces into a 6 by 6 square.
Namely, is it possible to dissect the following into 3 pieces:
x
xx
xxx
xxxx
xxxxx
xxxxxx
xxxxxxx
xxxxxxxx
And rearrange those 3 ... | stackexchange_codegolf |
Introduction
The Prime Counting Function, also known as the Pi function \$\pi(x)\$, returns the amount of primes less than or equal to x.
Challenge
Your program will take an integer x which you can assume to be positive, and output a single integer equal to the amount of primes less than or equal to x. This is a code-g... | stackexchange_codegolf |
*What is a transmogrifier?
In the C programming language, there are formations called digraphs and trigraphs that are two and three characters sequences that evaluate to less common characters. For example, you can use ??- if your keyboard doesn't have ~.
Given text, replace all instances of the following digraphs and ... | stackexchange_codegolf |
Introduction
As you all know, German has umlauts. They're these things: ¨
However, most keyboards don't have an umlaut key. That's fine, though, because you can write ö, ä, and ü as oe, ae, and ue.
Challenge
Your job is to to replace ö, ä, and ü with oe, ae, and ue (and likewise for their capital versions).
You have t... | stackexchange_codegolf |
Sandbox post
In this code-golf challenge, you are provided with a series of y values at even x-values as well as a console width and height. The desired output is an ASCII-art representation of a ribbon plot of the y-values scaled to the desired size. If all values are positive or negative, the x-axis should be display... | stackexchange_codegolf |
Input
Take a list of values xi each paired with a key yi.
[(x1, y1), (x2, y2), ...]
Output
Return a list L containing only values from the set {xi}.
The length of L must be equal to the number of unique keys k in the set {yi}.
For each unique key k there must be a value from {xi} that has key k.
Details
Standard l... | stackexchange_codegolf |
A string can be shifted by a number n by getting the byte value c of each character in the string, calculating (c + n) mod 256, and converting the result back to a character.
As an example, shifting "ABC123" by 1 results in "BCD234", shifting by 10 in "KLM;<=", and shifting by 255 in "@AB012".
The Task
Pick as many num... | stackexchange_codegolf |
Challenge
Given two inputs, a positive ion and a negative ion, you must output the formula for the ionic compound which would be made from the two ions. This basically means balancing out the charges so they equal zero.
Do not bother with formatting the formula with subscript numbers, but you must have brackets for the... | stackexchange_codegolf |
Program the shortest code that will calculate the average BPM (Beats per Minute) using 8 data points of time passed. This is my first post, and I haven't seen a question similar to this. Since I am a fan of rhythm games, it would be nice to have a small handy tool to calculate BPM using your own keyboard and your own s... | stackexchange_codegolf |
Muriel is a language where the only way to loop is to create a quine and execute it. Your job is to create your own language with this property and an implementation of it in a pre-existing language.
We will define a Muriel-like language like as follows:
It has a built-in command for executing code in its own language... | stackexchange_codegolf |
I only very recently discovered code golf and just found this part of the Stackexchange network, and naturally after looking at so many clever answers, I feel inferior. Inner me knows I'll get better over time, but inner me is also vain and needs validation.
At the same time, I don't take kindly to pandering, so you'd ... | stackexchange_codegolf |
Given a list of strings, replace each string by one of its non-empty substrings which is not a substring of any of the other strings in the list and as short as possible.
Example
Given the list ["hello","hallo","hola"], "hello" should be replaced by just "e" as this substring is not contained in "hallo" and "hola" and ... | stackexchange_codegolf |
Halloween is almost here, the holiday after which most people need to wean themselves off a hollow diet of sugar.
Write a program that takes in a positive integer. If the integer is less than 31 (1 through 30), output this ASCII-art jack-o'-lantern, looking to the right as if looking forward to Halloween:
_____I_____
... | stackexchange_codegolf |
Write a program that takes in a string and spells that word out using the NATO Phonetic Alphabet.
The mapping is as follows:
'A' -> 'Alfa'
'B' -> 'Bravo'
'C' -> 'Charlie'
'D' -> 'Delta'
'E' -> 'Echo'
'F' -> 'Foxtrot'
'G' -> 'Golf'
'H' -> 'Hotel'
'I' -> 'India'
'J' -> 'Juliett'
'K' -> 'Kilo'
'L' -> 'Lima'
'M' -> 'Mike'... | stackexchange_codegolf |
You're organizing a treasure hunt for your friends. To conduct things more easily, you want to draw a map of all locations where you hid the precious objects.
Input
Any form of input denoting a list of points consisting of (nonnegative) x- and y-coordinate, 0 0 being the upper left corner is permitted (Note: You may al... | stackexchange_codegolf |
Task
The task is to convert a string to a number. It must accept the string via stdin and output the number via stdout.
You convert a string to a number by replacing each letter of the string by its index (mind that you don't need to replace it with the index, that's just an example. You are allowed to replace it with ... | stackexchange_codegolf |
You will be given 3 integers as input. The inputs may or may not be
different from each other.
You have to output 1 if all three inputs
are different from each other,
and 0 if any input is repeated more
than once.
This is code-golf, so make your code as short as possible!
| stackexchange_codegolf |
First challenge!
What is an ambigram?
Ambigrams are word(s) that read the same word(s) or another word given a certain transformation and possibly stylistic alterations.
Example:
That's an example of a rotational ambigram; it reads the same word, even when flipped around.
The Challenge
You are to create a function, pr... | stackexchange_codegolf |
Stolen from @Downgoat with permission
The point of this challenge is to (not) settle the debate on the pronunciation of "gif".
"
The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced jif, it's still commonly disputed.
In this challenge you will be given a set of words that have ... | stackexchange_codegolf |
My PIN number is 1077, but that's too difficult to remember. I know from muscle memory that it's a digit, followed by a different digit, then followed by two of the same digit, which is different to the other two digits before it. As a pattern, we can say it is ABCC (where each letter represents a digit, and the same ... | stackexchange_codegolf |
Write a program that, for any \$n\$, generates a triangle made of hexagons as shown, \$2^n\$ to a side. The colors are to be determined as follows.
We may give the triangle barycentric coordinates so that every hexagon is described by a triple \$(x,y,z)\$ with \$x+y+z=2^n-1\$. (The three corners will be \$(2^n-1,0,0)\$... | stackexchange_codegolf |
Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited to 200 bytes, and the winner is the answer that correctly finds the number for the most status codes.
For this challenge, the status codes your program should handle are:
100 Continue
101 Switc... | stackexchange_codegolf |
Your goal is to print (to the standard output) the largest number possible, using just ten characters of code.
You may use any features of your language, except built-in exponentiation functions.
Similarly, you may not use scientific notation to enter a number. (Thus, no 9e+99.)
The program must print the number wit... | stackexchange_codegolf |
Everybody has heard of the phrase "be there or be square". So I thought it was time for a challenge about it.
Input
You will take a full absolute directory address as text as input via STDIN or equivalent.
Output
If the directory address exists and is valid, your program will move itself to that folder on your computer... | stackexchange_codegolf |
Given two numbers \$x,y > 2, x≠y \$ output all integers \$m\$ such that
$$
x + y \equiv x \cdot y \pmod m
$$
$$
x \cdot y > m > 2
$$
Input
Two integers
Output
A list of integers
Test cases
3, 4 -> 5
5, 8 -> 3, 9, 27
29, 9 -> 223
26, 4 -> 37, 74
13, 11 -> 7, 17, 119
6258, 571 -> 463, 7703, 3566489
| stackexchange_codegolf |
In this programming-puzzle, your goal is to write the following function in JavaScript, using (essentially) point-free (tacit) programming:
(f) => void(f())
Your submission should be an expression which returns a function which behaves like the above (taking a function as an argument and calling it, and returning unde... | stackexchange_codegolf |
In a few British newspapers there is a game known as Hidato. It is somewhat similar to Sudoku, albeit instead of having 1-9 in a line and block, it's about placing numbers such that they connect in order from 01 all the way up to the highest one, so they are all touching horizontally, diagonally or vertically.
Inputs w... | stackexchange_codegolf |
Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features.
function gcode(str){
//Removes comment, parses command name and args
const [,f,args] = (str.match(/^([GM]\d+) ([^;]+)/) || [,"",""]);
//A1.2... | stackexchange_codegolf |
You've been hired to write some code for a dictation-taking app, which takes voice input from a spoken source, parses it as words, and writes it down on a screen.
The management doesn't really trust you with all that much powerin the project—you're known to sit around and golf code all day instead of doing your work, u... | stackexchange_codegolf |
Let's define a sequence of positive integers. We will define the value of the sequence at every even index to be double the previous term. The odd indices of the sequence will be smallest positive integer not yet appearing in the sequence.
Here are the first couple terms.
1,2,3,6,4,8,5,10,7,14,9,18,11,22,12,24,13,26,... | stackexchange_codegolf |
Background
Wuxings(五行) are the five "elements" in Chinese philosophy. They are Fire(火), Water(水), Wood(木), Metal(金), and Soil(土). You can find them on East Asian calendar, where some days (Tuesday through Saturday) are named by the Wuxings.
Some Korean names are given according to Wuxings, so that father's name will ha... | stackexchange_codegolf |
Your task is to write a program or function
that determines whether a number is divisible by another.
The catch is that it should give an answer as soon as possible,
even if not all digits of the number have been given.
Your program should take an integer D ≥ 2
and then a series of digits as input.
These represent the ... | stackexchange_codegolf |
Write a program that takes in a string or text file whose first line has the form
width height
and each subsequent line has the form
x y intensity red green blue
where:
width and height may be any positive integers.
x and y may be any integers.
intensity may be any non-negative integer.
red, green, and blue may be a... | stackexchange_codegolf |
Your job is quite simple, write a program that prints Hello, world!, that when twisted creates a program that prints Twister!.
How strings are twisted
The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It kinda loo... | stackexchange_codegolf |
This is the second in a series, the third is Two roads diverged in a yellow wood (part 3)
This is based on Two roads diverged in a yellow wood (part 1), a previous challenge of mine. It was fairly well received, but it was also fairly trivial (a Java answer in 52 bytes!) So I made something more complex...
The inspirat... | stackexchange_codegolf |
The official release of the Nintendo 64 in North America was on September 29, 1996.[1] I figured that this anniversary deserved an ASCII art challenge. There's one small twist though, you have to output a different ASCII art for each of three different inputs.
If the input is 1, output this ASCII art of an N64 Controll... | stackexchange_codegolf |
Introduction
In a general election, one would like to calculate a constant price per parliament seat. This means that for N >= 0 seats to be distributed and a list ns of votes per party, we would like to find a number d such that
sum(floor(n/d) for n in ns) == N
To make things interesting (and more like the real worl... | stackexchange_codegolf |
Your task is to make a program in L that takes n as an input number, output a program p in L that prints its own first n characters.
Rules
The program p has to be irreducible, See an example below.
PAY ATTENTION TO THIS RULE: If a program takes an input as n, the first n characters of the output would be the same as... | stackexchange_codegolf |
Write a program that takes an input such as:
n,k
which then computes:
$$\binom n k = \frac {n!} {k!(n-k)!}$$
and then prints the result.
A numerical example:
Input:
5,2
Internal computation:
$$\frac {5!} {3!\times2!}$$
Printed Output:
10
I'd like to see an answer that beats my python solution of 65 characters, but... | stackexchange_codegolf |
In chess, Forsyth-Edwards Notation, more commonly called "FEN", is a textual way of transcribing boards. It describes each of the board's eight rows (called "ranks" in chess) from top to bottom from White's perspective. The pieces are written as K (king), Q (queen), R (rook), B (bishop), N (knight), and P (pawn). Black... | stackexchange_codegolf |
RLE Brainfuck
(related to BF-RLE)
The hypothetical RLE (Run-Length Encoding) dialect of Brainfuck accepts the symbols for the 8 commands and also accepts digits. The digits are used to represent the number of successive repetitions of a command, thus allowing run-length encoding of the source code.
8> is equal to >>>>>... | stackexchange_codegolf |
Here is a challenge:
What is the shortest possible compiled program? Writing one line programs are fun, but they often lean on language libraries that get pulled into the final bits. How lean can you get the 'scaffolding' that supports and hooks into the compiled instructions? This seems like an interesting question be... | stackexchange_codegolf |
Related
Sometimes when I use my microwave, I do a little trolling and enter times such as 2:90 instead of 3:30 because they end up being the same time anyway. The microwave happily accepts this and starts counting down from 2:90, displaying times like 2:86 and 2:69 until it gets back to a stage where it can count down... | stackexchange_codegolf |
Your task here will be to write a very dumb AI capable of fetching all treasures on a map.
Map
The map is defined as follow: (artist-mode™-powered)
Basic case:
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | | | | | | ... | stackexchange_codegolf |
Background
The Sidi polynomial of degree \$n\$ – or the \$(n + 1)\$th Sidi polynomial – is defined as follows.
$$S_n(x) = \sum^n_{k=0}s_{n;k}x^n \text{ where } s_{n;k} = (-1)^k\binom n k (k+1)^n$$
The Sidi polynomials have several interesting properties, but so do their coefficients. The latter form OEIS sequence A0755... | stackexchange_codegolf |
Although on codingame.com, Objective C and C are two of the best golfing languages there, so I would like to know some of the best golfing methods (although I am a python person, I am currently trying to learn C++/C)
I am looking for general ways/tips to golf one's code (so please don't post tips such as "remove commen... | stackexchange_codegolf |
This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here).
Task
Given a release name, output its number.
For reference, use the below list:
Great Pumpkin 2.14.0
December Snowflakes 2.14.1
Gift-Getting Season 2.14.... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
I've got an infinite supply of \$n\$-dimensional chocolate for some positive integer \$n\$. The shape of the chocolate is not important. You may assume that they are just \$n\$-dimensional hypercubes with side length \$1\$.
To celebrat... | stackexchange_codegolf |
A natural number (written in the decimal base) is qualified as digisible if and only if it fulfills the following 3 conditions:
none of its digits is zero,
all the digits that compose it are different,
the number is divisible by all the digits that compose it.
The challenge is to output all the digisibles (there are ... | stackexchange_codegolf |
Given a nonnegative integer, return whether it is a three digit number ending in one, in any consistent integer base. In other words, the number needs to be represented in base-N, N being an integer greater than zero.
Rules
This is code-golf, so shortest answer wins.
Since unary behaves weirdly, the behavior with inpu... | stackexchange_codegolf |
0. DEFINITIONS
A sequence is a list of numbers.
A series is the sum of a list of numbers.
The set of natural numbers contains all "non-negative integers greater than zero".
A divisor (in this context) of a natural number j is a natural number i, such that j÷i is also a natural number.
1. PREAMBLE
A couple of other que... | stackexchange_codegolf |
Sandbox
There are special sets S of primes such that \$\sum\limits_{p\in S}\frac1{p-1}=1\$. In this challenge, your goal is to find the largest possible set of primes that satisfies this condition.
Input: None
Output: A set of primes which satisfies the conditions above.
This challenge is a code-challenge, where your s... | stackexchange_codegolf |
Write a program or function that draws an ASCII star, given the size of the arms as input.
Here's a star of size 1
_/\_
\ /
|/\|
Here's a star of size 2
/\
__/ \__
\ /
\ /
| /\ |
|/ \|
Here's a star of size 3
/\
/ \
___/ \___
\ /
\ /
\ /
| /\ |
| / \ |
|/... | stackexchange_codegolf |
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 there was some trick I'm not aware of.
Here's my try (I compile with C17, but any standard before C23 is very likely to com... | stackexchange_codegolf |
Nuggets of Code
It's a hypothetical situation where it is Friday evening, and you've invited over the usual golfing buddies to participate in your favourite hobby: code golfing. However, as this is such a brain-draining task, you need to pick up some brain food for the group so you can golf as much as possible off your... | stackexchange_codegolf |
The below pattern will form the basis of this challenge.
/\
\/
/\
/ \
/ \
/\/ \/\
\/\ /\/
\ /
\ /
\/
/\
\/
Given an input width and height, each >=1, output the above ASCII art pattern repeated that many times, joining (and overlapping) at the small diamond... | stackexchange_codegolf |
Your task is to write a full program that will continue to count down from 10 every time it is run.
The first time you run the program, it should print 10.
The next time, it should output 9.
The next time, it should output 8, and so on.
Instead of printing 0, the program should crash. You do not have to handle the pro... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.