instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given the battery level L in the range 0-5, your code should draw the following ASCII art.
When L=0:
############
# ###
# ###
# ###
############
When L=1:
############
### ###
### ###
### ###
############
When L=2:
############
##### ###
##### ###
##### #... | stackexchange_codegolf |
A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links.
The rule in this hotel is that residents should pay their rent every morning. The traveler comes to an agreement with the manager to pay one link of the golden chain for e... | stackexchange_codegolf |
Challenge
Given a valid goo.gl shortened link, output the original URL.
Example
goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i... | stackexchange_codegolf |
Some of your employees have broken capslock keys and you're too cheap to replace them. Help them out by creating the shortest program possible to correct their work! Simply convert each character in a given string from uppercase to lowercase and vice-versa... but there's a twist!
You're also very excited for Christmas!... | stackexchange_codegolf |
I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true any "rule" really is? Today you're going program a skeptic-bot
Challenge
Write a program or function which when given a ... | stackexchange_codegolf |
Introduction
In the wake of the left-pad npm package fallout, let's have a code golf for implementing left-pad.
The left-pad function consists of 2 default arguments and 1 additional argument, in the form string, length, (padchar). If the padchar is not given, this is standardized to a space character. Let's take an ex... | stackexchange_codegolf |
Does anyone have tips on how to golf in this language? Please one tip per answer and avoid posting simple and general tips such as "remove whitespace".
Here is the github link and here is the esolang page.
| stackexchange_codegolf |
The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other.
This task is simply to write code that determines if two strings have edit distance at most 3 from each other. The twist is that your code must run in l... | stackexchange_codegolf |
Problem statement
Pólya is playing about with his urn again and he wants you to help him calculate some probabilities.
In this urn experiment Pólya has an urn which initially contains 1 red and 1 blue bead.
For every iteration, he reaches in and retrieves a bead, then inspects the colour and places the bead back in the... | stackexchange_codegolf |
Here's an advanced version of the Count the Liberties challenge.
The definitions of the terms liberty and group are the same as the previous challenge, so have a look at the previous one for details, but briefly put,
A group is a group of stones that are connected horizontally or vertically.
Liberty is the number of e... | stackexchange_codegolf |
Write a function that contains five lines.
If you run the function as-is, it should return 0.
If you remove any one of the five lines and run the function, it should tell you which of the lines has been removed (e.g., if you remove the final line it should return 5).
Brevity, novelty, and elegance all deserve considera... | stackexchange_codegolf |
Credit to Geobits in TNB for the idea
A post without sufficient detail recently posited an interesting game:
2 children sit in front of an array of candy. Each piece of candy is numbered 1 to x, with x being the total amount of candy present. There is exactly 1 occurrence of each number.
The goal of the game is for the... | stackexchange_codegolf |
Task
Given a list of nodes representing a binary tree of positive integers serialized depth-first, return a list of nodes representing the same tree serialized breadth-first. To represent an absent child, you may use null, 0, 'X', Nothing, [], or any other value that is distinct from your representation of a node's val... | stackexchange_codegolf |
I am trying my hand at writing super small programs. I wrote a simple "tree" display program for showing a graphical representation of a folder hierarchy. I have made it small in all the ways I can think of. I was just wondering if you guys had more creative ways to "minify" it further. Here is the small version as wel... | stackexchange_codegolf |
The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task
Input
The input will be a list of 4 digits numbers, where each digit represent a portion of decoration:
EMBU
||||
|||+-upper decoration
||+-bottom decoration
|+-mouth/nose
+-eyes
Eyes:
0 - °
1 - ¯
2 - -
3 - ^
4 - ... | stackexchange_codegolf |
This challenge is simple: Take a path to an png image file as input and overwrite that file with a copy of itself rotated 90 degrees clockwise. You may assume that the file has dimensions of 128x128 pixels. You may not use image metadata modifications (like Exif) to rotate the image; the pixels themselves must be trans... | stackexchange_codegolf |
SOMe PEOPle lIkE tO TYpE iN A LoGiCAL MAnNER, WITh CapITals aT tHe bEGiNnIng Of ThE SENtENCE and smaLl LETTErS EVeRYWHErE eLsE. NOT Us. NOt Us. Your joB iS to tAkE A SenTEncE Of A
LL SMAlL LeTTeRS, And rANDOmly ChAnGe sOMe to caPiTAl. ThiS iS a Code gOLF so tHE SmaLleST coDE WIll win.
the input will always be small l... | stackexchange_codegolf |
Given an integer n > 9, for each possible insertion between digits in that integer, insert an addition + and evaluate. Then, take the original number modulo those results. Output the sum total of these operations.
An example with n = 47852:
47852 % (4785+2) = 4769
47852 % (478+52) = 152
47852 % (47+852) = 205
47852 %... | stackexchange_codegolf |
The program has an input of a and b, and outputs the sum of numbers from a to b, inclusive. Score is in bytes. As always, standard loopholes are disallowed.
If your input is in the format [a,b], +3 bytes
| stackexchange_codegolf |
Write the shortest possible program or function that will join a list of columnar strings.
For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines. Each character, except for the last one, is separated by a newline character. Some examples, separated by ---:
a
b
c
d... | stackexchange_codegolf |
The minimal power iteration of a number \$n\$ is defined as follows:
$$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$
That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(32)=32^2=1024\$ and \$\text{MPI}(1234)=1234^1=1234\$.
The minimal power root of a number \$n\$ is defined as the number o... | stackexchange_codegolf |
Your mission today is to create a vortex given a single parameter.
This parameter determines the length of each arm in characters.
Each "layer" of each arm contains one more character than the last.
Here's how the vortex will look, given the arm length:
0:
#
1:
#
###
#
2:
#
# #
###
# #
#
3:
## #
... | stackexchange_codegolf |
Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible.
From the tag wiki:
The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine, which usually means ... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red and green like this:
GRRRGRRGRG
GGRGGGRRGR
GRRGRGRGRG
GGRRGRGRGG
GRGGRGRGGG
RRGRGRGRRG
RRRGRGRGGG
RGGRGGRRRG
RGGGRRRRRG... | stackexchange_codegolf |
Given an \$m \times n\$ matrix of integers A, there exist a \$m \times m\$ matrix P, an \$m \times n\$ matrix D, and an \$n \times n\$ matrix Q such that:
\$A = P D Q\$.
P and Q are unimodular matrices (i.e. matrices which are invertible and whose inverses are also integer matrices);
D is diagonal;
each diagonal entry... | stackexchange_codegolf |
Introduciton
Some of you might have realised that I am a sloppy typer when using my phone. That's why I want you to write a program which corrects my typos.
Chalkrnge
Given a misspelled word, output all of the possible words which I meant to write.
Typso
The main cause of my typos is down to the fact that I hit the wro... | stackexchange_codegolf |
Your task is to accept as input two "ASCII Art"s, and align each piece of art next to each other horizontally.
For example, say you have two strings, "abc\ndef" and "123\n456". You need to align them horizontally to produce the string "abc123\ndef456". I'm calling this "aligning horizontally" because while the inputs, ... | stackexchange_codegolf |
Challenge
Given a positive integer \$n\$, count the number of \$n\times n\$ binary matrices (i.e. whose entries are \$0\$ or \$1\$) with exactly two \$1\$'s in each rows and two \$1\$'s in each column.
Here are a few examples of valid matrices for \$n=4\$:
1100 1100 1100
1100 0011 01... | stackexchange_codegolf |
Given a list of positive integers as input you are to determine if there is a way to pair up the elements such that:
All but one element is in a pair
No element is in more than one pair
Every pair is of equal elements
No two pairs have elements separated by the same distance in the original list
For example if the in... | stackexchange_codegolf |
When you leave, my challenges fade to grey, 0A0AE16, 0A0A0AE16...
A while ago, I made this programming language (https://esolangs.org/wiki/Dragostea_din_tei) which uses an interesting number system. It is base two for integers, but for decimals it divides a base two integer by a power of ten.
The input should be a floa... | stackexchange_codegolf |
We all love horoscopes, don't we? But I have a serious problem in this Horoscope App installed on my Smart Phone that it only displays the icon of the Zodiac Sign for each day's horoscope. Now, I do remember my horoscope, but its hard to remember others' whose horoscope I am interested in.
Challenge
So here is your cha... | stackexchange_codegolf |
I call this sequence "the Jesus sequence", because it is the sum of mod.</pun>
For this sequence, you take all the positive integers m less than the input n, and take the sum of n modulo each m. In other words:
$$a_n = \sum_{m=1}^{n-1}{n\bmod m}$$
For example, take the term 14:
14 % 1 = 0
14 % 2 = 0
14 % 3 = 2
14 % 4 =... | stackexchange_codegolf |
The Challenge
Given two strings containing only lowercase letters and no spaces, the result should be the shorter string, followed by an underscore, followed by the longer string with the first instance of a character removed for each character it contains that is in the shorter string.
You can assume the strings will... | stackexchange_codegolf |
Your challenge today is to take a multiline string, and output the biggest square contained within the string that includes the top left corner.
A square string is one where:
Each line has the same number of characters
The number of characters on each line is equal to the number of lines.
Consider the following poss... | 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 |
Is solving Sudoku too hard? Even the brute force version? Here's a coding exercise that's a little easier. I hope. :-P
Write the shortest function to implement bogosort. In specific, your function should:
Take an array (or your language's equivalent) as input
Check if its elements are in sorted order; if so, return th... | stackexchange_codegolf |
The title is an homage of the Natural Number Game, which is a nice interactive tutorial into proving certain properties of natural numbers in Lean.
The definitions used in Lv1 will be reused here. I've done some improvements:
Now it starts with import tactic, which means you can freely use powerful mathlib tactics.
I... | stackexchange_codegolf |
The Sequence
Everyone knows the only even prime number is 2. Ho-hum. But, there are certain even numbers n where, when concatenated with n-1, they become a prime number.
For starters, 1 isn't in the list, because 10 isn't prime. Similarly with 2 (21), and 3 (32). However, 4 works because 43 is prime, so it's the first ... | stackexchange_codegolf |
Introduction
Aron Nimzowitsch was a leading chess master and a influential chess writer.
In his book 'My System', the first chapter deals about the importance of the center and why you should dominate it. The simple reason is that your pieces have more possible direct next moves when being in the center which again giv... | stackexchange_codegolf |
What general tips do you have for golfing in Factor? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Factor (e.g. "remove comments" is not an answer).
| stackexchange_codegolf |
Your challenge is to write a program that constantly prompts for input, and when input is given, output that five seconds* later. However, your program must continue prompting for input during that time.
Since this is a bit confusing, here's a demo.
<pre id=x></pre><input id=h onchange='var k=this;(()=>{let a=k.value... | stackexchange_codegolf |
Introduction to Mahjong tiles
Mahjong (麻雀) is a board game that originates from China. Mahjong tiles used in this challenge are in Unicode points U+1F000 – U+1F021:
They are categorized as:
Winds (風牌): (East Wind), (South Wind), (West Wind), (North Wind)
Dragons (三元牌): (Red Dragon), (Green Dragon), (White Dragon)
Te... | 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 |
Given a binary number, your task is to create a 'branch' of that number, with a depth of 2.
For example, given 0 as input, you should output exactly this:
/000
/00
/ \001
0
\ /010
\01
\011
This should be fairly self explanatory of how the branches should be created. Depth 2 means we calculate branc... | stackexchange_codegolf |
Your program / function, etc. will take 2 inputs. The first will be a list of who came to my party and when. Example:
Kevin 13:02
Ruby 5
Sam 3
Lisa 6
Bob 12
What does that mean? It means that Kevin got to my party first (at 13:02, 24-hour time), then Ruby 5 minutes later, then Sam 3 minutes later, then Lisa ... | stackexchange_codegolf |
What tips do people have for golfing in TeX/LaTeX? Please post one tip per answer, each at least somewhat specific to TeX/LaTeX.
Context: I noticed this answer and that there is no tips question for TeX/LaTeX, so I'm creating this one. There's some overlap with the narrower question tips for golfing in TikZ (as TikZ i... | stackexchange_codegolf |
(Hopefully it's still Thanksgiving for you)
You got a turkey for your thanksgiving dinner but you don't know how to evenly distribute it. The problem is, some people eat more than others, so you need to find a solution
Input
There will be two inputs. The first will be an ascii art of various people.
o
o \|/
\|/ ... | stackexchange_codegolf |
Given a positive integer N, output the innermost N×N square of an ASCII art spiral made of -|/\ that spirals clockwise inward.
The - is used for horizontal portions, | for vertical portions, and / and \ for corners. The first character is - and the spiral proceeds left and down.
Specifically, when N is 1 the output is:... | stackexchange_codegolf |
Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that!
For clarification, I am talking about the Mesoamerican Long Count Calendar. Your program will have as input a date in the Gregorian Calendar, and as output the corresponding date from the aforementioned Meso... | stackexchange_codegolf |
Here's one for fans of Cabin Pressure. There is an episode in which the characters devise a new version of Fizz Buzz, which is simplified to contain absolutely no mathematics.
It has these rules:
If someone says "fizz", you say "buzz".
If someone says "buzz", you sing "'ave a banana"
If someone says your name, you say... | stackexchange_codegolf |
You should write a program or function which receives a string as input and outputs or returns if the input is an ASCII tree.
_
\/ /
\_/
|
|
ASCII trees consist of characters / \ | _ spaces and newlines.
The non-whitespace characters connect two edge points of their cells by a line segment:
/ connects the bot... | stackexchange_codegolf |
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoretically possible.
The... | stackexchange_codegolf |
When using Markup, like on the SE network, an indentation of four spaces before a line of text denotes it as part of a code block, as I hope you know. If you don't, here's an example (with . representing a space):
....Code
....More code
results in
Code
More code
The problem is, when you copy-paste code into an answer,... | stackexchange_codegolf |
Input:
An integer
Output:
Sum of the input itself + the length of the input + each individual digit of the input.
nr + nr-length + {sum of digits} = output
Examples:
Input: 99
Output: 99 (nr) + 2 (nr-length) + (9 + 9) (digits) → 119
Input: 123
Output: 123 + 3 + (1 + 2 + 3) → 132
Challenge rules:
The input can also co... | stackexchange_codegolf |
The Prisoner's Dilemma, but with 3 choices, and the payoffs are random!
Each round, your bot recieves a 3x3 grid and chooses a row to play. The grid might be this:
4 5 7
3 1 9
9 9 0
Each number in the grid is between 0 and 10 (inclusive). Your score for the round is grid[your_play][their_play], and your oppone... | stackexchange_codegolf |
Play the Fruit Box Game
Intro
Fruit Box is a game consisting of a 10x17 grid of numbers, each between 1 and 9, where the goal is to clear as many numbers as possible in a two-minute time window. In order to clear numbers, one selects a rectangle aligned with the grid, and if the numbers inside of it sum to 10, they are... | stackexchange_codegolf |
Challenge:
Given the input array l with a list of strings, only keep the elements in the sequence that have a letter that's repeated at least 3 times. Like 'lessons' has 3 s letters, so it should be kept in the sequence. But, 'lesson' has only two s letters, so it should be removed.
Notes:
l will always be a sequence,... | stackexchange_codegolf |
Challenge
Display Inky the ghost from Pac-Man using only ANSI escape codes.
Here's a text representation of the image
B B B B B C C C C B B B B B
B B B C C C C C C C C B B B
B B C C C C C C C C C C B B
B C W W C C C C W W C C C B
B W W W W C C W W W W C C B
B E E W W C C E E W W C C B
C E E W W C C E E W W C C C
C C W... | stackexchange_codegolf |
This is a 3x3 ASCII jigsaw puzzle:
_____ _____ _____
| _| |_ |
| (_ _ _) |
|_ _|_( )_|_ _|
| (_) |_ _| (_) |
| _ _) (_ _ |
|_( )_|_ _|_( )_|
| _| (_) |_ |
| (_ _) |
|_____|_____|_____|
This is also a 3x3 ASCII jigsaw puzzle:
_____ _____ _____
| |_ _| |
| _ ... | stackexchange_codegolf |
I did the IMC this year. Did anyone else here do it?
In a UKMT Intermediate Maths Challenge paper, there are twenty-five questions. The first fifteen questions give you five marks if you get them right. For the other ten questions, you get six marks for getting them right. In the last ten questions, you lose marks if y... | stackexchange_codegolf |
Introduction
Finding the closest power to a number is a common enough problem. But what if you need both the next-highest and next-lowest power? In this challenge you must find the closest powers to a given number - the 'power sandwich' if you will, where the given number is the filling and the powers are the bread. Mm... | stackexchange_codegolf |
Yesterday I asked this question about riffle shuffles. It seems that yesterdays question was a bit too hard so this question is a related but much easier task.
Today you are asked to determine if a permutation is in fact a riffle shuffle. Our definition of riffle shuffle is adapted from our last question:
The first ... | stackexchange_codegolf |
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's.
For any given input I would like the resulting L33T speech as an output.
I don't want to go to far down the rabbit hole so let's start simple.
Consider the following replacements:
B or b = 8
E or e = 3
I or i = 1
S or s = 5
Let... | stackexchange_codegolf |
I am trying to write a solution to the following problem using as few characters as possible (to meme my friend and introduce him to golfing). Can any improvements be done to my code?
So the problem requires us to write a function called navigate in Python 3.6 (language of the judge, sorry, no walruses) that takes two ... | stackexchange_codegolf |
Given an integer n, output the smallest prime such that the difference between it and the next prime is at least n.
For example, if n=5, you would output 23, since the next prime is 29, and 29-23>=5.
More Input/Output Examples
1 -> 2 (3 - 2 >= 1)
2 -> 3 (5 - 3 >= 2)
3 -> 7 (11 - 7 >= 3)
4 -> 7
5 -> 23
6 -> 23
7 -> 89
8... | stackexchange_codegolf |
You will create a program that generates the stereographic projection of polyhedra.
In particular, to keep things simple, we'll only focus on n-chamfered dodecahedron.
Given a natural number n as input, and also a natural number d your program will output an d pixels by d pixels image which is the stereographic project... | stackexchange_codegolf |
Challenge
Given an array of integers, received from stdin, function arguments, program arguments, or some other method:
Output only the minimum and maximum numbers in the array, through a return value, stdout, or other fitting methods.
Example session
> minmax( {0, 15, 2, 3, 7, 18, -2, 9, 6, -5, 3, 8, 9, -14} )
-14 18... | stackexchange_codegolf |
Here's an interview question I've seen on a few sites. People claim that an O(n) solution is possible, but I've been racking my brain these last 2 days and I couldn't come up with a solution, nor find one anywhere on the web.
Given an array of integers, find two disjoint, contiguous subarrays such that the absolute dif... | stackexchange_codegolf |
This is a quine variation.
Introduction
We all write short code, because some obscure reasons, but whatever we do, the'll take up at least 144 pixels/byte (with a 12px font). But what would happen, if we would encode our code in images? This is your task today.
Challenge
You task is to read in your own source code (non... | stackexchange_codegolf |
Background
Bathroom Etiquette, when pertaining to the available urinals, states that the next urinal to be filled in should be the one that minimizes the total discomfort. The total discomfort equation is given by the following set of equations:
dist(x,y) = linear distance between person x and person y in Urinal Units... | stackexchange_codegolf |
Zeroless numbers are numbers that do not contain 0 as one of their decimal digits.
Given an integer K, return the Kth zeroless number. K will be non-negative if you choose 0-indexing, or positive if you choose 1-indexing instead. Note that this is OEIS A052382.
This is code golf, so the shortest code in bytes wins.
Tes... | stackexchange_codegolf |
Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check whether after any number of operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrary index.
Here is the definition of a ba... | stackexchange_codegolf |
The string 2123132133 has the property that no subsequence of length 3 is the same as any other subsequence of length 3.
Your task is to build a program that will output as long of a string as possible that satisfies this property for sequences of length 9 with the characters from 1 to 9.
The source code of your progra... | stackexchange_codegolf |
Problem
Given a positive integer n where n < 100
Output a diamond pattern as follows:
Input n=1
/\/\
\/\/
Input n=2:
/\ /\
//\\/\/\//\\
\\//\/\/\\//
\/ \/
Input n=3:
/\ /\
//\\ /\ /\ //\\
///\\\//\\/\/\//\\///\\\
\\\///\\//\/\/\\//\\\///
\\// \/ \/ \\//
\/ ... | stackexchange_codegolf |
Challenge
Given a string with any characters a-z or A-Z, return an 'encrypted' string, where all characters are replaced by the character next to it (assuming a QWERTY keyboard).
Case (uppercase, lowercase) does not matter.
The input will only have characters a-z and A-Z.
Shortest code in bytes wins.
Example Input a... | stackexchange_codegolf |
I like to save time quite literally, by wearing three watches on my wrist... Problem is they each give a different time. One watch is x minutes behind the actual time. One watch is x minutes ahead of the actual time. The last watch shows the actual time.
Problem is, I can't tell which watch has the correct time...
Fro... | stackexchange_codegolf |
Challenge
Given an integer n (where 4<=n<=10**6) as input create an ASCII art "prison door"* measuring n-1 characters wide and n characters high, using the symbols from the example below.
Example
╔╦╗
╠╬╣
╠╬╣
╚╩╝
The characters used are as follows:
┌───────────────┬─────────┬───────┐
│ Position │ Symbol │ Char ... | stackexchange_codegolf |
How do I remove all duplicates from list and order it based on count?
s = ["foo", "this", "lem", "foo", "lem"]
s = ["foo", "ebh", "wosv", "wosv", "ebh", "4whcu"]
#should return
>>> ["foo", "lem", "this"]
>>> ["ebh", "wosv", "foo", "4whcu"]
Rules:
Must be shorter than the below code in terms of byte size.
Order must b... | stackexchange_codegolf |
The Euclidean algorithm is a widely known algorithm for calculating the greatest common divisor (GCD) of two positive integers.
The algorithm
For the purpose of this challenge, the algorithm is described as below:
Display the two input as adjacent lines of a certain character
e.g. an input of 3,4 can be represented by... | stackexchange_codegolf |
Today, you're going to be writing Polish. No, not Polish notation—Polish, the actual language spoken in Poland.
Given a number and a noun, output a Polish sentence telling me that there are that many of that thing, using the appropriate template below.
The input consists of an integer in the range from 0 to 200, and a ... | stackexchange_codegolf |
Quarterstaff repo here with additional quarterbf interpreter: rather bereft of documentation, however, but it does contain the two interpreters
you can go to https://tio.run/#quarterstaff to run quarterstaff programs online. however, the TIO BF implementation seems to have limited cells, according to the documentation
... | stackexchange_codegolf |
This is the Robbers' thread. Cops' thread is here.
Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) A... | stackexchange_codegolf |
So, normally, this is a forbidden loophole to fetch the desired output from an external source. But this challenge is an exception ! In this challenge you will have to fetch data from the internet and output it to the SDTOUT.
The task
For the purpose of this challenge, you'll be the owner of the imaginary a.pi domain!... | stackexchange_codegolf |
I'm looking out of my attic window into my neighbor's yard. They have a dog chained to a post in the center of the yard. The dog runs around the yard but is always on the end of its chain, so it ends up leaving a track in the dirt. Normally this track would be perfectly circular, but my neighbors have some other pole... | stackexchange_codegolf |
Description
Write a program or function that takes in a positive integer \$n\$ as input and outputs all Sophie Germain primes that are safe primes less than or equal to \$n\$. A prime number \$p\$ is a Sophie Germain prime if \$2p+1\$ is also a prime. A prime number \$p\$ is a safe prime if \$p=2q+1\$, where \$q\$ is a... | stackexchange_codegolf |
Given a number n, Output an ordered list of 1-based indices falling on either of the diagonals of an n*n square matrix.
Example:
For an input of 3:
The square shall be:
1 2 3
4 5 6
7 8 9
Now we select all the indices represented by \, / or X (# or non-diagonal positions are rejected)
\ # /
# X #
/ # \
The output sha... | stackexchange_codegolf |
Alphabet Rain
The Task:
The basic premise is to print out the input string and then repeat each character vertically, based on it's (0-indexed) position in the (case-insensitive) alphabet A-Z. A is at location 0 so is not repeated, e is at position 4 so is repeated 4 times, P is at position 15 so is repeated 15 times, ... | stackexchange_codegolf |
Word equations, but not as you know it! Given a sentence which will include two numbers, numerically, and a spelt operator, in the order seen in the examples, your goal is to give the numerical answer
The operators will be spelt as: "add", "minus", "times" and "divide"
Any real number integer may be used, as suggested ... | stackexchange_codegolf |
You are given a string of unknown length that contains a varied amount of (, {, [ and their respective closing parentheses (in this context all referred to as brackets).
With one exception, all the brackets are all balanced, meaning an opening one has a corresponding closing one somewhere afterwards in the string.
The ... | stackexchange_codegolf |
This is an answer-chaining challenge relating to the OEIS.
Oh, the justification for this is because a company needs one program to print out their OEIS sequences real bad and they have every language.
The answer-chaining format works in the following way:
Someone posts the first answer, from which all further solution... | stackexchange_codegolf |
Background
A question wanted to solve a problem in a way that made it unreasonably complex: https://stackoverflow.com/a/31551257/29347
The problem in the original question is:
Take a list of (key, value) and produce a dict such that {key: sum(value)}
My Problem
I want to use dict compression with list.count or str.c... | stackexchange_codegolf |
What if we have a corridor comprised of two parallel mirrors?
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Now, we shine a laser down it...
| \ |
| \ |
| \ |
| \ |
| \ |
| \ |
| \ |
| ... | stackexchange_codegolf |
I was playing around with cellular automaton and I found one that had some interesting behavior. Here's how it works:
It reads a binary string from left to right, if it encounters a 1 followed by 2 other values it will append a 0 to the result and continue reading. If it encounters a 0 (or there are less than 3 value... | stackexchange_codegolf |
Given 2 random circle sections, return how many times they intersect. Rules/clarifications are as below.
You are provided 10 total values,
The center (x,y) of the circle section
Angles of the circle (i.e. (0,90) would be a quarter circle "facing" the top-right corner.
The radius of the circle section
The circle s... | stackexchange_codegolf |
Determining whether a Language is Turing Complete is very important when designing a language. It is a also a pretty difficult task for a lot of esoteric programming languages to begin with, but lets kick it up a notch. Lets make some programming languages that are so hard to prove Turing Complete that even the best ... | stackexchange_codegolf |
Given a linear equation mx+n, return n and m. However, the equation may be in any of the following formats:
5x+2 -> 5 2
5x-2 -> 5 -2
5x -> 5 0
-2 -> 0 -2
x -> 1 0
Here are the formats, where each ? stands for a positive integer written without leading zeroes
?x+?
?x-?
-?x+?
-?x-?
x+?
x-?
?
-?
?x
-?x
x
All of t... | stackexchange_codegolf |
"nimi ale lon toki pona" is a song by YouTuber jan Misali which lists 137 common words in the constructed language Toki Pona. This challenge is not a duplicate of "How high can you count?" or "Alphabet printing challenge" because instead of numbers or single characters, it outputs random (to many programming languages)... | stackexchange_codegolf |
It's the election! The area which we are in implements the system of voting called instant runoff (sometimes called alternative vote or preferential voting). Each voter orders each candidate from most preferred to least preferred, marking a "1" for their most preferred candidate,
a "2" for their second candidate, and s... | stackexchange_codegolf |
Dowker notation is a common way of representing mathematical knots.
Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium):
We will label each of the \$n\$ intersections with two numbers whose absolute value is on the range \$1, \dots 2n\$ (one odd one ev... | stackexchange_codegolf |
The challenge:
Assuming you have \$ X \$ collections, each collection \$ C_i \$ has a name \$ N_i \$ and a capacity \$ N_i \$ of elements - Determine which collection will be overflowed first while counting the occurrences of the names in a cyclic list. Also print how many cycles of the list occurred.
Example:
4 Collec... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.