instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Challenge description
We've had a few challenges involving the Look-and-say sequence. Quick reminder:
The sequence starts with 1,
Subsequent terms of this sequence are generated by enumerating each group of repeating digits in the previous term,
So the first few terms are:
1 "one"
11 "one one" (we look a... | stackexchange_codegolf |
What are some tips for golfing in Turing Machine But Way Worse, a language made by MilkyWay90 and ASCII-only?
Tips should be Turing Machine But Way Worse-specific and not be trivial (For examples that you shouldn't post, removing unnecessary whitespace or using shorter state names).
EDIT: Added documentation to TMBWW
| stackexchange_codegolf |
(related)
Your challenge is to output the highest number you can. You can output as a number or as a string. You must output something that matches the regex ^\d+$, as in only 0-9.
The Twist
Your source code must be:
Same forwards and backwards
3 bytes long
The middle byte must be different from the other two
Exampl... | stackexchange_codegolf |
Objective
Given an integer \$n\$ interpreted as two's complement binary, output two integers, namely the integer consisting of \$n\$'s bits at places of \$2^0, 2^2, 2^4, \cdots\$, and the integer consisting of \$n\$'s bits at places of \$2^1, 2^3, 2^5, \cdots\$.
Note that the input may be negative. Since \$n\$ is inter... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
Christmas is coming up, and Santa hasn't kept to his diet very well this year. Due to his size, he is getting the elves to collect a list of all the chimneys he will be able to fit down. Unfortunately, chimneys these days are a bit of ... | stackexchange_codegolf |
A man lives in the north-west corner (0, 0) of a town with height h and width w . Everyday he walks from his home to the border (?, w) or (h, ?). In the following example, the man goes to (3, 3) today.
(0, 0) +--+ + + . (0, 4)
|
+ +--+--+ .
|
+ + + + .
... | stackexchange_codegolf |
I created a programming language for manipulating strings called Stringy. It's very different from other programming languages, since you only have one string (for manipulation) and some variables. With the various commands you can manipulate that one string. I created it because it might be useful for some challenges ... | stackexchange_codegolf |
In this challenge you will write a function that takes a list (ordered set) containing real numbers (the empty list is an exception, as it has nothing) and calculates
$$f(x)=\begin{cases}1 & \text{if } |x|=0 \\ x_1+1 & \text{if } |x|=1 \\
\log_{|x|}\sum_{n=1}^{|x|}{|x|}^{x_n} & \text{otherwise}
\end{cases}$$
where \$|x... | stackexchange_codegolf |
Introduction and Credit
Today without a fancy prelude: Please implement takewhile.
A variation of this (on a non-trivial data structure) was an assignment at my university functional programming course. This assignment is now closed and has been discussed in class and I have my professor's permission to post it here (I... | stackexchange_codegolf |
The game of Chinese checkers is played on a board with spaces in the shape of a six-pointed star:
Image from Wikipedia
We can create an ASCII-art representation of this board, using . for empty spots and the letters GYORPB for the six colored starting locations:
G
G G
G G G
G ... | stackexchange_codegolf |
Syntax
~ not
/\ and
\/ or
t true
f false
P, Q, FISH, etc: variables
(Operators are given in order of precedence)
Introduction
Some boolean formulae can be changed to different forms to make them shorter. For example, the formula
~(~P /\ ~Q)
can be changed to the shorter form
P\/Q
while the formula
P \/ ~P
can be cha... | stackexchange_codegolf |
Task
Write a program that will output another distinct program, and so on, while using as few distinct characters (and as few bytes) as possible.
For example, program 1 should output program 2, and when program 2 is executed, it should output program 3. This can be nested as deeply as needed, but must be at least 3 dis... | stackexchange_codegolf |
Programming is very rigid. You can't tell a program to "output the banana count", you have to tell it to print(bananas).
But when you do that, you end up with a problem: you don't know how many bananas you have beforehand, so you don't know whether to use a plural.
Sometimes, programmers go the lazy way. Instead of che... | stackexchange_codegolf |
I'm a time traveler, and I'm obsessed with the passage of time. I particularly love the moments when the clock hands pass 12, or when I get to flip to the next page of my calendar, or when everyone yells "Happy New Year!"
Please write for me a program to show me how far I am from the last such moment to the next, in th... | stackexchange_codegolf |
The magic music box (MMB)
This explains the motivation for the challenge, feel free to ignore.
The magic music box is a word game played by a group of people, where one is the owner of the magic music box and the other people are trying to put words inside the magic music box.
Rules for the game with humans: the game g... | stackexchange_codegolf |
Display the remaining battery charge, as a percentage of maximum charge
Remember if you can't run your code on a phone, calculator, etc, you can probably install your environment on a laptop at least. If you absolutely can't run on a device that has a battery, then unfortunately your language isn't eligible since you h... | stackexchange_codegolf |
I was browsing Stackoverflow and saw this question about tiling an MxN rectangle, and I thought it would be great for golfing. Here is the task.
Given the dimension M and N, write a program that outputs how many unique ways a MxN rectangle (N is the number of rows, not columns. Not that it really matters) can be tiled ... | stackexchange_codegolf |
Background
A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and each attack causes a specific amount of heads to regrow. The knights have hired you to write a program or function that... | stackexchange_codegolf |
Robber Thread here
The Challenge
Choose any numeric* formula, algorithm, or code challenge. Implement it in such a way that the math is correct, but at least one answer is wildly** wrong due to some defect in how computers/programs operate, e.g. floating point errors, uninitialized/corrupted memory, environment bugs, c... | stackexchange_codegolf |
Introduction
Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and S is 83. As we all know, the formula for averaging two numbers \$x\$ and \$y\$ is \$\frac{x+y}{2}\$. I'm pretty sure you can see where this is going. Your challenge is to average two letters.
Challenge
Yo... | stackexchange_codegolf |
Introduction
In this challenge, we will be dealing with a certain ordering of the positive integers.
The ordering goes like this:
3, 5, 7, 9, 11, ...
2*3, 2*5, 2*7, 2*9, 2*11, ...
4*3, 4*5, 4*7, 4*9, 4*11, ...
8*3, 8*5, 8*7, 8*9, 8*11, ...
16*3, 16*5, 16*7, 16*9, 16*11, ...
...
... 64, 32... | stackexchange_codegolf |
You should write a program or function which receives a string describing the floor as input and outputs or returns the area of the simplest meta-tiling which could create the given pattern of the floor.
The floor is a part of a square grid. Every square tile is colored either azure or black (represented by a and b in ... | stackexchange_codegolf |
Your objective: Given a string of brackets, output the minimum Damerau-Levenshtein Distance required to turn the input string into a string where the brackets are balanced.
Input
The input string will only contain brackets and no other characters. That is, it is a combination of any of the characters in (){}[]<>. You m... | stackexchange_codegolf |
This is the cops' challenge. To post a robber, go here.
In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans... | stackexchange_codegolf |
Task: Given the area of a triangle, find a Heronian triangle with that area. Any Heronian triangle with the specified area is allowed.
A Heronian triangle is a triangle with integer sides and integer area. By Heron's formula, a triangle with sides lengths a,b,c has area
sqrt(s*(s-a)*(s-b)*(s-c))
where s=(a+b+c)/2 is ... | stackexchange_codegolf |
As we all know, most Pokemon are created by combining some English (or Japanese) words; these words are the Pokemon's "etymology." For example, "charmander" is "char" and "salamander" put together.
Your task is, given a Pokemon's etymology and number, output the original Pokemon name. A short answer will be able to com... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
While other Elves are busy carrying air blowers, Fen comes and shouts, "I've got a spell for this job!"
To recap, a chimney is modeled as a rectangular grid. The number in each cell represents the amount of smoke in the region. The lef... | stackexchange_codegolf |
My PPCG holiday is over :D
Intro
Fractional time is the year + (the value (minute of year) / number of minutes in the year).
Example calculation
You should assume that February always has 28 days and the year is always 365 days long.
Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstl... | stackexchange_codegolf |
Given a positive integer input N, output the two non-negative numbers, a and b, where a < b, with the lowest possible mean value that will result in the number N being part of the recurring relation sequence:
f(0) = a
f(1) = b
f(n) = f(n-2)+f(n-1)
In case there are more than one solution where the mean of a and b are ... | stackexchange_codegolf |
This is kept fairly original:
Write a program that creates a standard blackjack game:
input "h" means hit or draw another card
input "s" means stand, or take what you have already
Rules:
cards values are as follows:
2-9 = face value of card
10, J, Q, K = 10
aces = 11 unless player busts, then it's only a 1
if 2 or m... | stackexchange_codegolf |
A pandigital number is an integer which contains every digit from 0 to 9 at least once. 1234567890, 1902837465000000, and 9023289761326634265 are all pandigital. For the purposes of this challenge, numbers such as 123456789 are not pandigital, since they do not contain a 0, even though 123456789 = 0123456789.
A diverse... | stackexchange_codegolf |
The purpose of this challenge is to figure out whether all the dominoes will fall, given an input string representing a top view of the table.
Input format
The program can take the input as a single string with newlines or a list of strings. Spaces denote, well, empty spaces, and the rest represent dominoes.
The start ... | stackexchange_codegolf |
The objective of this challenge is to take an array of positive integers, and enumerate its indices, grouping like elements.
An enumeration without any duplicates is done by just outputting an array of pairs (value, index), for example, [3, 4, 13, 9, 2] => [[3,1],[4,2],[13,3],[9,4],[2,5]].
However, if a given element a... | stackexchange_codegolf |
I am new to the sport of code golf. I am trying to generate a ladder of integers using the least number of unique characters in C++.
Let's say we are given an integer 4.
We will generate the following ladder:
1
1 2
1 2 3
1 2 3 4
In short, my program will read a positive integer from stdin and print this ladder to the o... | stackexchange_codegolf |
In 1.13, Minecraft language files were switched from being a simple multi-line key=value format to JSON.
Challenge
Write a program converting from the original format returning a JSON string. Input can be taken using any standard input method, output must be json from any standard output method
The original format cont... | stackexchange_codegolf |
Recently, I created a binary word search that got me working with grids. It was fun, so I wanted to create some more similar content. Meet Pythagoras' Golfing grid:
Each of d, e, f, g, h, i, j, k and T represent a numeric value.
Now consider an orthogonal triangle along the lower diagonal of this grid (so the vertical... | stackexchange_codegolf |
This is a fewest-operations challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, but it can use other operations for arithmetic operations, loops, checking if it's sorted etc. The number of sub-vector re... | stackexchange_codegolf |
I was doing some investigation into trig functions using compound angles recently, and noticed that the results are really long and tedious to write:
$$
\cos(A+B) = \cos A \cos B - \sin A \sin B \\
\cos(A-B) = \cos A \cos B + \sin A \sin B \\
\sin(A+B) = \sin A \cos B + \sin B \cos A \\
\sin(A-B) = \sin A \cos B - \sin... | stackexchange_codegolf |
Given a non-empty list of decimal digits (0, 1, ..., 9), replace each zero by the most recent nonzero, if possible.
Example 1: given
1 4 3 0 0 7 5 5 0 3
the output should be
1 4 3 3 3 7 5 5 5 3
Note how the first two zeros are replaced by 3, which is the most recent (i.e. rightmost) nonzero. Similarly, the last zer... | stackexchange_codegolf |
The set of necklaces is the set of strings, where two strings are considered to be the same necklace if you can rotate one into the other. Your program will take nonnegative integers k and n, and generate a list of the k-ary (fixed) necklaces of length n.
Necklaces will be represented by any representative string. So t... | stackexchange_codegolf |
Write an irreducible proper quine, i.e. a program that prints its own source code, which can't be reduced by removing characters to a shorter program with the same constraints.
Eg. the python quine:
var='var=%r;print(var%%var)';print(var%var)
can be reduced to the quine
v='v=%r;print(v%%v)';print(v%v)
thus it is no... | stackexchange_codegolf |
I like anagrams. I like programs that reference their own source code. So this challenge combines them!
Input.
The input to the program could be anything, including letters, numbers, symbols, you name it.
Output.
A truthy value if the input's characters can be rearranged to give the source code, and a falsy value if th... | stackexchange_codegolf |
Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and syntax. With some help from Wikipedia, you can likely solve this problem with no prior knowledge of music theory.
Write a pro... | stackexchange_codegolf |
As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below:
Image credit: Wikipedia
For the purposes of the current task we will say that a normalized pentomino solution is a solution that ... | stackexchange_codegolf |
Recently, I've found a rant from 2004 about Internet Explorer's color parsing. Turns out, MS made sure that just about anything will be parsed as a color somehow and I think it makes for a neat challenge.
Well, how does IE parse colors?
Let's give it an input with a length of...
...less than 4 chars:
Replace chars no... | stackexchange_codegolf |
Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total.
This challenge was inspired by this video by Matt Parker.
Testcases
Use this file if you want to test your code against the English vocabulary. Sample output sets:
["fjord", "vibex", ... | stackexchange_codegolf |
Your task is to fill the bucket with numbers upto a given input.
Rules
Numbers occupy the leftmost position then rightmost, then leftmost and so on.
After overflow, the numbers start to gather around the bucket in a similar manner. They occupy position diagonally.
The examples should make it clear what the expected out... | stackexchange_codegolf |
Your code may not contain the letter "e", but must count the number of "e"s in the inputted string and output that as a number. Bonus points if you use a language that is not a codegolf language and a language that actually uses the letter e (unlike brainfuck) --- not a required criteria.
| stackexchange_codegolf |
The bus driver picks up the children from their homes every morning for school. All the homes are positioned around a circular street and the bus driver has to stop at every home exactly once.
One monday morning the bus driver decided to only pick up every second child he encountered along his way. However, he still ha... | stackexchange_codegolf |
Roman numerals can be (mostly) written in a one column format, because each letter intersects the top and the bottom of the line. For example: I, or 1 intersects both the top and bottom of the line, and V or 5 intersects the bottom and top lines, the top twice and the bottom at one place.
The value of all roman numeral... | stackexchange_codegolf |
This challenge is about gradually shifting hues in an image to make pretty pictures like this:
(original)
Challenge
Write a program or function that takes in two non-negative integers and an image in any common image file format of your choosing (you can take a path to the image or the raw image data).
We'll call the ... | stackexchange_codegolf |
Problem
Given input a where a is a grid of characters in any input format as long as it has only one element for each 'block' of the output.
And input b where b is a grid of numbers the same size as input a.
There are two types of road, a 1 represents a stone road marked by @ and a 2 represents a dirt road marked by #
... | stackexchange_codegolf |
B-splines are defined using a set of "knots", "control points", and degree. For the purposes of this challenge, the control points are not needed.
The knots are simply a list of strictly increasing real values (note that real B-splines may have repeated knots, for the purposes of this challenge assume knots are all uni... | stackexchange_codegolf |
This king-of-the-hill challenge is based off of the game show, Weakest Link. For those unfamiliar with the show, the crux of this challenge deals with who you vote off:
If the other players are smarter than you, then you have less of a chance of getting the pot.
If the other players are dumber than you, then you have... | stackexchange_codegolf |
A Fermi-Dirac Prime is a prime power of the form \$p^{2^k}\$, where \$p\$ is prime and \$k \geq 0\$, or in other words, a prime to the power of an integer power of two. They are listed as integer sequence A050376. While a normal prime factorization generally does not contain a set of distinct primes (for example \$24=2... | stackexchange_codegolf |
As we all know, negative press covfefe has been conspiring to bring down the American president for some months now.
There's also, definitely, an algorithm in play in that word. Covfe is a refreshing caffeinated beverage, and following the president's remarks it's clear the word can now be appended with successive f's ... | stackexchange_codegolf |
I came across this picture the other day: (Credit to Josep M Batlle I Ferrer)
Your job is to generate this picture. This graph is generated by repeatedly applying newton's method to the graph of:
$$f(x)=\cosh(x)-1$$
In other words, repeatedly apply the following function to every point till the rectangular distance is... | stackexchange_codegolf |
Intro:
I remember, when I was a kid, I would get a calculator and keep on pressing the + button, and see how high I could count. Now, I like to program, and I'm developing for iOS.
Counting is a fundamental skill for both humans and computers alike to do. Without it, the rest of math can't be done. It's done simply by ... | stackexchange_codegolf |
Your task is to create a polish notation calculator.
For those who don't know what is polish notation, it's a mathematical notation where operators are before the operands.
Eg: + 1 2 = 1 + 2
Your calculator should implement integer addition, substraction multiplication and division.
Standard loopholes are forbidden but... | stackexchange_codegolf |
Credit goes where credit is due
Given two digits, x, and y, calculate the shortest number of horizontal or vertical jumps to get from x to y on a standard numpad, e.g.
789
456
123
00
You can safely assume that all inputs will be 0-9, and you do not have to handle invalid inputs. The input may be the same number twice... | stackexchange_codegolf |
Definition
a(1) = 1
a(2) = 1
a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2 where n is an integer
Task
Given positive integer n, generate a(n).
Testcases
n a(n)
1 1
2 1
3 2
4 3
5 3
6 4
7 5
8 5
9 6
10 6
11 6
12 8
13 8
14 8
15 10
16 9
17 10
18 11
19 11
20 12
Reference
Obligatory OEIS A005185
| stackexchange_codegolf |
Introduction
If \$\newcommand{\fib}{\operatorname{fib}}\fib(x)\$ calculates the \$x\$th Fibonacci number, write a program that calculates \$\fib(\fib(m))\$ for any integer value of \$m \ge 0\$. (Of course, there will be practical limits based on the language, so lesser limits are acceptable. Also, it's okay to stop at ... | stackexchange_codegolf |
Define the (unnormalised) Willmore energy of a surface as the integral of squared mean curvature over it:
$$W=\int_SH^2\,dA$$
For surfaces topologically equivalent to a sphere \$W\ge4\pi\$, and \$W=4\pi\$ iff it is actually a sphere. Thus the energy quantifies how spherical a surface is.
In September 2020 I asked on Ma... | stackexchange_codegolf |
This is a very simple challenge.
Task
Whenever your code is run, your code should output the next sunset date and time in GMT for all capital cities on Earth. You should get the list of capitals from the below table. The dates and times should be outputted sorted by the name of the capital. You don’t need to output t... | stackexchange_codegolf |
The way points are assigned on a dice follows a regular pattern, the center dot is present if and only if the number is odd. To represent the even numbers, pairs of dots on opposite sides of the center are added, which will stay present for all successive numbers.
1:
O
2: 3: 4: 5: 6:
O O O O O O ... | stackexchange_codegolf |
You may know the game The Six Degrees of Kevin Bacon, based on the conjecture that every actor in Hollywood can be connected to Kevin Bacon by no more than 6 "co-star" relations, so Kevin Bacon is supposedly the "best-connected" node in that graph. Your task will be to find the Kevin Bacon of a graph.
We will use posit... | stackexchange_codegolf |
Given a string containing some parentheses and some other ASCII printable characters, like this: (abc((123))(k)) your task is to remove any sets of parentheses that are redundant.
A set of parentheses is redundant if:
It encloses another set of matching parentheses, like ab((123)), or
It encloses the entire string, li... | stackexchange_codegolf |
Each March in the United States, the NCAA holds a 68-team tournament for both men's and women's college basketball. Here's what the bracket looks like:
There are four regions, each with 16 teams seeded from 1-16.
Each region is seeded the same way, and across the four regions, the same matchups occur between seeds. Fo... | stackexchange_codegolf |
Easter Egg Hunt
Bot find egg before bunny find egg. Bot happy.
Overview
This is a king-of-the-hill challenge in honor of Easter and the Easter egg hunting tradition!
Your bot has a vision of two spaces in every direction, including diagonals, creating a 5x5 square around you that you can see. It is looking for eggs, an... | stackexchange_codegolf |
Given an integer n>0, write a program that will output an "isosceles" Triangle out of #'s of height n.
Examples:
n=3
#
###
#####
n=1
#
n=5
#
###
#####
#######
#########
This would be invalid:
#
###
#####
#######
#########
| stackexchange_codegolf |
Inspired by this post. For those marking this question as a duplicate I urge you to actually read the question to see that mine is a modification of the one linked. The one linked does not ask for an input and is to just print the alphabet diagonally.
The Challenge
Given an input between 1-26 inclusively, print the alp... | stackexchange_codegolf |
Your job is to create the longest period iterating quine, where the length of each program in the sequence is bounded by 500 bytes.
That is, if you repeat the following steps:
Start with your initial program
Run the current program
Go back to step 2
You will eventually get back to your original program. The number of... | stackexchange_codegolf |
Derived from this, now deleted, post.
Given a string, answer (truthy/falsy or two consistent values) if it constitutes a good Bishop password, which is when all the following conditions are met:
it has at least 10 characters
it has at least 3 digits ([0-9])
it is not a palindrome (identical to itself when reversed)
Y... | stackexchange_codegolf |
In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as f'(x), and these can sometimes be abbreviated to f and f'.
The derivative of the product of two functions fg is f'g + g'f. The derivative of three fgh is f'gh + fg'h + fgh'. In... | stackexchange_codegolf |
Left in sandbox for at least 3 days.
I want to verify if this inequality is true:
for \$n\geq4\$, if \$a_1,a_2,a_3,\dots,a_n\in R_+\cup\{0\}\$ and \$\sum_{i=1}^na_i=1\$, then \$a_1a_2+a_2a_3+a_3a_4+\dots+a_{n-1}a_n+a_na_1\leq\frac{1}{4}\$.
Challenge
Write a piece of program which takes an integer n as input. It does th... | stackexchange_codegolf |
It is Halloween and Jimmy (/o\) has gone into a mysterious neighborhood for trick-or-treating (ask himself why). Now some evil ghosts are chasing him. Can Jimmy escape the ghosts?
Challenge:
Input:
A board showing position of Jimmy, ghosts, solid objects and empty spaces.
An example 10x5 board, o is Jimmy (we needed a ... | stackexchange_codegolf |
Intro
So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are?
Left-most what?
A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes int... | stackexchange_codegolf |
When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions.
Let's take two proper fractions:-
$$
\frac{1}{2},\frac{2}{3}
$$
First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \$2,3\$ are \$6\$. T... | stackexchange_codegolf |
What is the shortest regular expression (REGEX) you can create for file extensions for all of the following image file formats (photographs, paintings, sketches, and drawings)?
.ACAD
.AFD
.AFP
.AOM
.AOMA
.APNG
.ASCII
.AVIF
.AVIFAV
.BMP
.BPG
.CABAC
.CDEC
.CDR
.CDRAW
.CGM
.CHEVC
.CIEC
.CIPA
.CMYK
.COLLADA
.CRT
.CWC
.DEEP... | stackexchange_codegolf |
Background
I have a bunch of square-shaped boxes of equal size, and since I'm a neat person, I want to arrange them all into a square formation.
However, their number is not necessarily a perfect square, so I may have to approximate the square shape.
I want you to find me the most aesthetically pleasing arrangement -- ... | stackexchange_codegolf |
A prime number is a positive integer that has exactly two divisors 1 and the number itself. For example number 7 is a prime since it is divisible by 1 and 7. Number 1 is not a prime since it has only one divisor. Write a program or function that produces all even prime numbers.
This is a code golf challenge, shortest a... | stackexchange_codegolf |
The basic idea is to write a program that twists itself, and the twisted version untwists itself. The first program will just be the twisting algorithm described here, and when given its own source code as input, outputs a program that reverses the twisting algorithm.
How strings are twisted
The twisting algorithm is v... | stackexchange_codegolf |
Last Thursday user @SpookyGengar delighted us with his/her first challenge about Making Squared Words. What if we double the number of sides?
The challenge
Take a string as input in any reasonable format you need (string, char array...) and output an octogonal representation of the input (also in any reasonable format:... | stackexchange_codegolf |
Alternate name: ChessMoveQ
Given a list of up to 32 elements, each consisting of 4 elements, and a second list with 4 elements, determine whether the move detailed in the second input is a valid chess move.
The first list indicates the position of all 32 pieces on the board. Each element will follow the structure <colo... | stackexchange_codegolf |
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:
AAA BBBB CCCC DDDD EEEEE FFFFF GGG H H
A A ... | stackexchange_codegolf |
Introduction
In mathematics, the hyperoperation sequence is an infinite sequence of arithmetic operations (called hyperoperations) that starts with the unary operation of successor (n = 0), then continues with the binary operations of addition (n = 1), multiplication (n = 2), and exponentiation (n = 3), after which th... | stackexchange_codegolf |
The flag of the United States of America contains, in its canton, 50 stars, representing the 50 states.
In the past, when there were fewer states, there were of course fewer stars, and they were arranged differently. For example, from 1912-1959 (after the admission of New Mexico and Arizona but before Alaska), there ... | stackexchange_codegolf |
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For example, []*T means "array of pointer to T" and *[]T means "pointer to array of T".
Let's call * and [] type modifiers. C has a way of ordering these modifiers tied to the evaluation order. []*T in C-style becomes T *[], and *[... | stackexchange_codegolf |
Inspired by George Gibson's Print a Tabula Recta.
You are to print/output this exact text:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLM... | stackexchange_codegolf |
Task
Given a positive integer n, output the joined compound of circles
The circles are of square of size n+2 but removing the corner edges and the middle, before finally overlapping n times of itself
E.g.
2
->
####
####
####
####
->
##
# #
# #
##
->
## ##
# # #
# # #
## ##
Testcases
1
->
#
# #
#
2
->
... | stackexchange_codegolf |
Given a string consisting of only upper and lower case letters, output an if it begins with a vowel, and a if not. For the purposes of this challenge, we'll ignore normal grammar rules, and use a very basic rule instead: if the input begins with a vowel (any of AEIOUaeiou), then output an. Otherwise, output a.
Your pro... | stackexchange_codegolf |
(based on this deleted question)
Take the English alphabet a b c d e f g h i j k l m n o p q r s t u v w x y z (spaces added for clarity), and split it into chunks of X width, padding any leftover lines with spaces if necessary for your language. For example, splitting it into width 4 results in
a b c d
e f g h
i j k l... | stackexchange_codegolf |
Introduction
Write a solver for integer linear programming.
Challenge
Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and the goal is to find the minimum or maximum of a linear function.
For example, for the inequa... | stackexchange_codegolf |
The beloved fish who swims through the code of ><> (an esoteric programming language) has been taken out of its natural environment. This change has rendered it incapable of moving around in the way it's used to: what used to be toroidal movement has been restricted to simple left-to-right movement. But ><> programs ar... | stackexchange_codegolf |
Challenge
Given an integer greater or equal to 4, n, print a rounded rectangle of as close as possible (with a gap of 1) sides and a perimeter of n characters.
Rules
n is always 4 or greater, because otherwise the output wouldn't be a square
The characters for the perimeter can be any non-whitespace character
The rect... | stackexchange_codegolf |
Introduction
All the possible moves and their combinations of a Rubik's Cube form a group. A group in general is a set with some binary operation defined on it. It must contain a neutral element with respect to this operator as well as inverses for every element of the set. For instance the integers \$\mathbb Z\$ with ... | stackexchange_codegolf |
A run ascending list is a list such that runs of consecutive equal elements are strictly increasing in length. For example [1,1,2,2,1,1,1] can be split into three runs [[1,1],[2,2],[1,1,1]] with lengths [2,2,3], since two runs are the same length this is not a run ascending list. Similarly [2,2,1,3,3,3] is not run as... | stackexchange_codegolf |
A set of dominoes consists of tiles with two numbers on them such that every combination of integers from 0 to N are represented. Examples below refer to N=6 out of convenience, but N=9 and N=12 are also common. The orientation of the tiles does not matter (they are usually printed with dots rather than digits), so [1-... | stackexchange_codegolf |
Based on this challenge, you must determine if a string is covfefey, that is, could it have been produced as output from a covfefifier?
The string will be composed of only alphabet chars (^[a-z]\*$, ^[A-Z]\*$ are possible schemes for input. change the regexs appropriately if using caps)
To do this, there are a few chec... | stackexchange_codegolf |
Plot contrivance
You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991.
You check the computer that you keep on the desk to see what time it is, but alas the positron interference from your quantum undetangler has fr... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.