instruction stringlengths 34 53.1k |
|---|
The challenge
How well can you gerrymander North Carolina into 13 voting districts?
In this challenge, you use the following files to draw different maps for Republicans and Democrats.
File 1: NC_2016_presidential_election.csv
File 2: NC_county_adjacency.csv
File 1 gives county-level voting data from the 2016 president... |
Convert a large int (e. g. 1234567890) into a string containing the usual decimal prefixes k, M, G, T, etc. for kilo, mega, giga, tera, etc. The result shall be groups of three digits, interspersed by the prefixes (e. g. 1G234M567k890), so that it is easy to glance the order of magnitude of the number without counting... |
One of the Klarner-Rado sequences is defined as follows:
the first term is \$1\$
for all subsequent terms, the following rule applies: if \$x\$ is present, so are \$2x+1\$ and \$3x+1\$
the sequence is strictly increasing
This is A002977.
The first few terms are:
1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, ...
(\$3\$ ... |
Inspired by this lumosity mini game, Pinball Recall
We start with a rectangular grid (viewed from above) with several bumpers as follows. Entrances/exits are numbered counter-clockwise starting from the leftmost of the bottom of the grid, as number 0.
24 23 22 21 20 19 18 17 16 15
25 . . . . . / . . . . 14... |
The Hadamard transform works similarly to the Fourier transform: it takes a vector and maps it to its frequency components, which are the Walsh functions. Instead of sine waves in the Fourier transform, the Walsh functions are discrete "square waves" so to speak. This makes it easier to compute.
The size of a Hadamard ... |
We all know the age-old debate - should strings be length-prefixed or should they be null-terminated? Well, you've run into a blob of binary data and apparently whoever made it decided that the best solution would be a compromise and length-terminated their strings.
For the purposes of this challenge, a length-terminat... |
How can we depict a turned shape simply and nicely using ascii characters in 3D space?
I suggest this method :
Instead of a circle we use a square rotated by 45° for the cutting section so that we only need '/' and '\' characters to draw it.
/\
/ \
\ /
\/
And we use '_' character for the profiles: upper, lower ... |
In this challenge you will write a piece of text which when viewed from two different angles will create two different programs.
Your string as viewed from above must take a string containing only characters ASCII 10, 32 - 126 and output it as viewed from above. Additionally your program when viewed from the left must... |
When translating DNA into proteins, the ribosomes read the sequence of DNA nucleotides 3 by 3. Each set of 3 nucleotides is called a codon, and each codon encodes for an amino acid, with some redundancies. Here's the conversion table used by most organisms (table is read left, top, right):
Humans and most other organi... |
The flag of Tennessee is specified by chapter 498 of the Public Acts of 1905.
An oblong flag or banner in length one and two thirds times its width, the large or principal field of same to be of color red, but said flag or banner ending at its free or outer end in a perpendicular bar of blue, of uniform width, running... |
Write a program which, when every nth character is skipped, it prints n. For example, if every 2nd character is skipped, it prints 2.
Example
n=0
foobar
Output:
0
n=1
foa
Output:
1
n=2
fobr
Output:
2
Rules
If n=0 (no characters are skipped), 0 must be returned.
Must print to STDOUT.
Standard loopholes are forbid... |
I'm sure this is going to spark some controversy, but let's do a practical demonstration.
The objective of this is simple, using the new code of conduct and no input, print out my pronouns ( "he/him", "he him" is also acceptable).
Here's the challenge. This is a classical polyglot contest!
This means that the first... |
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... |
The Objective
Build a random number generator whose range is \$\left[0,1\right) \cap \mathbb{Q} .\$
This is, build a random number generator that can produce any value that's:
at least \$0 \,;\$
not \$1\$ or greater; and
expressible as the ratio of two integers.
What's the fuss?
This RNG is weird. Its range is nowhe... |
(Essentially the inverse of Find the needle in the haystack)
Given two tuples, (w, h) and (x, y), generate a haystack composed of a single random printable ASCII character of w width and h height with a needle made of a different random printable ASCII character at (x, y) when measured from the upper-left.
For example,... |
Your task is to create a plain hunt (a bell ringing pattern) with n bells. An example with 6 bells:
123456
214365
241635
426153
462513
645231
654321
563412
536142
351624
315264
132546
123456
Each number "bounces" off the side of the grid. From Wikipedia:
Each bell moves one position at each succeeding change, unless ... |
If we assign each letter a respective integer, starting from 1, then a is 1, b is 2, c is 3, and so on. After z, the letters loop back around, but with a in front (aa, ab, ac). It then goes to ba, bb, bc... After this is completed, as you may have figured, another letter is added (aaa, aab, aac). "Prime letters" would... |
I have a bunch of ASCII art that I have recovered from a failed hard drive. Unfortunately, all of the newlines were stripped out, and I don't know the resolution of the original artwork. I do know that each one was originally rectangular, but to make matters worse, all the white space at the beginning and end was strip... |
Well, you know it's Snow White, and the evil Queen is at it again. Will Snow White be saved? Will she fall asleep once again? Will the Prince find her?
Challenge:
Given an arbitrary number (>= 2) of possibly duplicated hexadecimal color values (ranging from #000000 to #FFFFFF) and paired strings, calculate the followin... |
Inspired by this challenge from puzzling.SE.
Polyominoes are fun - you can fill all sorts of shapes with them. But as soon as you have limits on what polyominoes you can use, you sadly start running into shapes you can't fill.
Today we'll be looking at the L tromino - a shape made up of three conjoined squares, in such... |
Input
_ _ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|| |
||_ _| | _||_| ||_| _||_|
output
1234567890
Rules
Code golf - shortest code wins.
Input will be given as a 3-line string with each line separated by a newline, or as 3 separate strings. Each line is guaranteed to be a multiple of 3 characters lo... |
This is the inverse of negative seven's question.
Write a program or function which, given any single, possibly-empty string of printable ASCII (codes \$[32,126]\$) outputs or returns two strings of printable ASCII.
For any two ordered, possibly empty strings \$s_1\$ and \$s_2\$, there must be third string \$s_0\$, whi... |
A wave of power \$k\$ is an infinite array that looks like \$1,2,\dots,k,k-1,\dots,1,\dots,k,\dots,1,\dots\$, and so on.
For example, a wave of power 3 starts with \$1,2,3,2,1,2,3,2,1,...\$, and repeats indefinitely. A wave of power 1 is an infinite array of ones. They happen to be beautifully expressed as $$w_k[t] = k... |
Create a program which prints the amount of characters its source has in English words.
If your program is nine letters long it should print "nine".
Capitalization is ignored: in case you're printing "one" (somehow) you can print "one", "oNe", "ONE" or anything else.
Base ten is required.
Proper spacing is also require... |
Write a program that outputs Hell0 W0rld!. It must match this output exactly, including capitalization, zeroes instead of o's, exactly one space, etc. Trailing new lines are allowed.
Lowest score wins. Scoring is based on the sum of the values of each character in the language's code page - otherwise Unicode values ... |
The world has been invaded by aliens. They are everywhere killing people and taking over the world. You are hiding with your friend.
They have one weakness - the high pitched sounds.
You can't go yell at them, because you'd get caught before, so you remember the state had a conveniently made machine that emits a high p... |
This is the Grid Game:
It's a game based on cellular automata, where the aim is to remove all of the pieces belonging to your opponent.
How it works:
There are two kinds of piece in the game, cities and walkers.
Each player starts with one city (marked with C and a number, which is it's health), which will regularly ... |
This challenge is inspired by my earlier challenge "Create a program that prints the amount of characters it has, in words".
This challenge's rules are simple: make a program that prints its character count, in words, which works in as many languages as possible.
Each programming language the program works in must make... |
I'm surprised this hasn't been done yet, but here we go.
Create a program which prints some number of 1s (ideally as large as possible) before halting.
The rules are simple:
Your program is bounded to 50 bytes in size.
Your output must only be a continuous row of 1s (plus trailing newline if it has to be added), withou... |
This is a simple challenge: given n in any way practical (Function arg, stdin, file, constant in code) output the internal angles
(NOT the sum of the internal angles, just one) of a regular polygon with n sides. The output can be in degrees, gradians or radians, and can be displayed in any way practical (Function retu... |
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... |
Introduction
Every number can be represented as ASCII. For example, \$0\$ comes in ASCII is \$48\$, \$1\$ is \$49\$, and so on. Using this method of translating numbers to other numbers, it is possible to infinitely expand a number, by replacing all its digits with their ASCII values and doing the same for the result. ... |
Back again, stealing another question from stackoverflow.
You are given a list of integers >= 0. Generate in order square 1-matrices where the side length is given by the list entry of the current index and fill the rest with 0s.
So given a list 2,4,1,3 print this to stdout:
1 1 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
0 0 ... |
Let's consider a list \$L\$ (initially empty) and a pointer \$p\$ into this list (initialized to \$0\$).
Given a pair of integers \$(m,n)\$, with \$m\ge 0\$ and \$n>0\$:
We set all uninitialized values in \$L\$ up to \$p+m+n\$ (excluded) to \$0\$.
We advance the pointer by adding \$m\$ to \$p\$.
We create a vector \$[... |
This is a problem that the Hacker Cup team made for the 2018 Facebook Hacker Cup, but we ended up not using it (though Ethan struggles through a variety of other challenges). Normally code size isn't a factor in the Hacker Cup, but we thought this would make for an interesting code golf challenge. We look forward to se... |
(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... |
Your goal is to write a program that prints the string abc in two languages. However, while the full code will print abc in one language (we'll call it Language 1), the other one (Language 2) must print abc if (and only if) every other character is skipped starting from the second character. If the full code is run in ... |
Without taking any input, output this exact text:
A
B A
C B A
D C B A
E D C B A
F E D C B A
G F E D C B A
H G F E D C B A
I H G F E... |
Introduction
Every string has an "alphabet", composed of the characters that make it up. For example, the alphabet of \$abcaabbcc\$ is \${a, b,c}\$. There are two operations you can do with alphabets: getting the alphabet of a string, and seeing if another string has a given alphabet.
Challenge
Given two strings, you m... |
There are 4 regular polygons that we can construct using ASCII art:
. . .
. . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . .
... |
A Hamiltonian path in a graph is a path that visits each vertex exactly once; a Hamiltonian cycle is a Hamiltonian path that is a cycle – the path forms a simple closed loop. In this challenge the graph will be a n x n grid, where n is an even number greater than 2.
Here is an example of a Hamiltonian cycle on 12x12 re... |
Story
In an unnamed company, some people use Java and some use C++. This was always a nuisance, and they kept on arguing which single language they should all be using. To settle the dispute, the management decided that they'll buy a translator program that will be able to rewrite their C++ programs to Java and vice ve... |
Introduction
We all know prefixes and suffixes. But there are other types of affixes that exist too. Such as circumfixes, a type of affix that has two parts, one of which is a prefix and another of which is a suffix. Figuring out whether some string is a prefix or a suffix of some other string is easy, but what about f... |
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 ... |
You are given a matrix of forward and back slashes, for instance:
//\\
\//\
//\/
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the same examp... |
This challenge will give you an input of a degree sequence in the form of a partition of an even number. Your goal will be to write a program that will output the number of loop-free labeled multigraphs that have this degree sequence.
Example
For example, given the input [3,3,1,1], you should output the number of label... |
I have a hardware that has a 32-bit input register. The register has the following characteristics:
The 32-bit register consists of eight 4-bit fields.
Each 4-bit field holds a value in signed-magnitude; it can hold an integer between -7 and +7 inclusive, including -0 and +0 (signed zeroes).
For example, the hexadeci... |
You want to find the length shortest path between two points, on an 2d ASCII "map". The roads are made up of + characters, and the two endpoints are represented by #s (not counted in the length). This road can be arranged in any way, and any other characters can be ignored. You can assume the endpoints will always conn... |
Very recently, I changed my SE username because I made this account some years ago and wanted to get back into asking questions. However, I’m still planning to post questions and potentially earn votes. We can imagine a site that has some issues dealing with name changes. The problem: given a list of names, reputation ... |
"Set" is a card game played with a deck of 81 cards, twelve of which are pictured below:
Each card has four attributes, each of which may assume three values:
Number: the number of symbols, either 1, 2, or 3
Shape: the shape of the symbol, either squiggle, diamond or oval
Colour: either purple, red or green
Shading: ... |
In this challenge, you play chess without seeing any of your opponent's pieces or moves. Or your own pieces. Or whether your own moves succeeded. You send only a stream of moves, with no feedback. If your move is legal (when it is your turn) it will be played, otherwise it is silently discarded.
I/O
The only input is t... |
Introduction
This is a web scraping Code Golf challenge that attempts to take stock Name and price columns from the 'Most Active' list on this New York Times URL.
Why is this challenge interesting?
Challenge:
Scrape these figures from this NYT page and turn it into a data frame using the smallest number of bytes possib... |
When playing Rock-Paper-Scissors-Lizard-Spock, your robot reflexes let you see your opponent's throw before they make it. You just need to choose a throw that beats theirs, in as few bytes as possible of course.
There's always two winning throws, and either one will work.
Input -> Possible outputs
----------------... |
Follow the Path
I got directions to my friend's house, but it looks like his map might have some mistakes. He's expecting me soon, so I need some short code to figure out if I can get there.
The Challenge
The code should, when given an ASCII representation of a path as input, traverse from the start to the end, and out... |
Introduction
Little Jimmy is going trick or treating. He lives in an odd neighborhood: some houses give out candy, and some give out toothbrushes. Now, Jimmy does not want to get too many toothbrushes. He wants candy! You must help him get some.
Challenge
Each street in Jimmy's neighborhood has a number. Each house on... |
Today is Halloween and it's time to carve some pumpkins!
&
((^.^))
Given an input integer, string, list of integers, etc., output the corresponding pumpkin. The input will always be of the form Stem, Eyes, Mouth, Width. For example, 2331 would be a valid input.
The pumpkin takes the form:
S
((EME))
where S is t... |
Have you been shooting gallery? We are recently.
In our shooting gallery cans and aluminum cans from under various drinks hang and stand. More precisely, they hung and stood.
From our shots, banks dangled from side to side on a rope, were torn off, rang, crumpled. This is not for you to shoot from your fingers.
Each ... |
The (slightly harder, but still easy) sequel of Generate input for this hardware.
Background
I have a hardware that has a 32-bit input register. The register has the following characteristics:
The 32-bit register consists of eight 4-bit fields.
Each 4-bit field holds a value in signed-magnitude; it can hold an integer... |
Toki Pona is a linguist's code golf: A minimalist language with a vocabulary of around 120 words. Because of this, it has very few grammatical irregularities found in other languages, making it ideal for a code golf challenge.
Your task is to take the most simple form of a Toki Pona sentence and translate it into Engli... |
To interpret a positive integer very literally, write it in English words (without "and"), replace hyphens with spaces, replace each resulting word with its number value, and concatenate the results into a single number.
To write a positive integer more than 99 but less than 1000 in English words, prefix its last two d... |
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:
1) Increment the number by 1.
2) Reverse the integer (remove leading zeros after reversing)
Input: n=42
Output: 1>2>3>4>5>6>7>8>9>10>11>12>13>14>41>42 **... |
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... |
Introduction
A quine is a program that takes no input and produces a copy of its own source code as output. Writing a quine is a standard test of a programming language. Most quines operate using strings of characters: that is what the source code is made of, after all! However, this quine is slightly different.
Challe... |
Given two real numbers (postive or negative) in the limits of float pointing number data types, i.e., (\$-3.4e38\$ to \$3.4e38\$) not inclusive, you should output the max of the two reversed numbers.
TEST CASES
Example
Input:
135
210
Output:
531
\$531\$ is \$135\$ reversed, which is greater than \$012\$, i.e., \$210... |
Given an array where each number represent a color. After iterating each item in the array (for each item in the iteration the pointer can also point to the second-item-to-the-right), and the two colors in the iteration is the same, do the following checking:
If there is a different color between the pointed colors, th... |
I have some JavaScript code in a <script> HTML tag I'd like to golf, while still remaining in the tag. How can I golf that code, if at all? Here's the code:
<script>document.write`<font color=#40e0d0 face=arial>YOU ARE IN THE BEDROOM.<br>YOU SEE CRAB NICHOLSON.<br>HE HAS NO MITTENS.<br>HIS CLAWS ARE... |
WARNING: This challenge may need 128 bit floats.1
The task is to perform numerical integration. Consider the following three functions.
\$
f(x) = cx^{c - 1}e^{-x^c}
\$
\$
g_1(x) = 0.5e^{-x}
\$
\$
g_2(x) = 5 e^{-10 x}
\$
We will have that \$c \geq 0.2\$. Your code should be correct for any value between 0.2 and 1.0.
... |
You probably know what a Turing Machine is but do you know what is a Turning Machine (lathe)?
Ok you already know.. and what about a Golf Turning Machine ??
Ok I tell you..
A Golf Turning Machine is a full program or function taking a list/array (or any convenient method) representing the Profile (P) of a turned piece ... |
Input
This task takes no input.
Output
Your code should compute and print (or return)
\$\pi^y\$ for all \$y = \frac11, \frac12, \frac13, \frac14, \frac15, \frac16, \frac17, \frac18, \frac19, \frac1{10}, \frac1{11}, \frac1{12}\$. The first 20 digits of the output (truncated and without any rounding) should be correct i... |
Fermat's Last Theorem, mod n
It is a well known fact that for all integers \$p>2\$, there exist no integers \$x, y, z>0\$ such that \$x^p+y^p=z^p\$. However, this statement is not true in general if we consider the integers modulo \$n\$.
You will be given \$n\$ and \$p\$, which are two positive integers with \$n>1\$. Y... |
Your task is to write a program or function that checks if a string is a valid phone number.
Given a string (or list of characters/codepoints) input, you will output a truthy value if the input is a valid phone number. If it is not, output a falsey value. An input string is considered a valid phone number for this chal... |
Notation and definitions
Let \$[n] = \{1, 2, ..., n\}\$ denote the set of the first \$n\$ positive integers.
A polygonal chain is a collection of connected line segments.
The corner set of a polygonal chain is a collection of points which are the endpoints of one or more of the line segments of the chain.
Challenge
T... |
In convolutional neural networks, one of the main types of layers usually implemented is called the Pooling Layer. Sometimes, the input image is big (and therefore time consuming especially if you have a big input set) or there is sparse data. In these cases, the objective of the Pooling Layers is to reduce the spatial... |
Introduction
Bob runs a deli. His deli serves sandwiches to its customers. However, it is a bit unusual. At Bob's deli, instead of telling Bob what they want, customers show Bob an ASCII art drawing of their sandwich. Bob must find the pattern in their sandwich so he knows what ingredients to prepare. However, Bob does... |
Background
A spanning tree (Wikipedia) of an undirected graph is a subgraph that is a tree which includes all of the vertices of the original graph. The following is an example of a spanning tree of a 4-by-4 grid graph.
Task
Given two positive integers w and h, output any valid spanning tree of the grid graph which ha... |
Not a new one:
Input
N, being n, 0 ≤ n ≤ 5.
Output
N times "Hello World."
Example:
Input
3
Output
Hello World.
Hello World.
Hello World.
These 2 are my best solutions:
First
public class Out
{
public static void main(String[] a) throws Exception
{
java.io.OutputStream o = System.out;
... |
Gah! It's a shame that Pokémon Sword and Shield won't introduce a new eeveelution. Let's mourn them with a code golf.
The objective is to, when given a type name as the input, output the name of the corresponding eeveelution.
When given Water, output Vaporeon.
When given Electric, output Jolteon.
When given Fire, outp... |
Today's challenge:
Given an ordered list of at least 3 unique integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear.
A polygon is rectilinear if every interior angle is a right angle. The edges do not necessarily have to be purely vertical or horizontal (parallel to the x or y axis), ... |
Description
Given an object (json), write code to extract all the keys from it. This is a question that I really wanted to ask everybody for a long time ago but I did not have time to write it up. It can be helpful in some cases in your daily work.
Rule:
You can use any parse function to get the JSON object, it does n... |
Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$.
Examples
If the input \$=0\$:
_/|
| |\/
|_ |/\
\|
If the input \$>0\$ and \$<33\$:
_/|
| |\
|_ |/
\|
If the input \$\ge33\$ and \$<66\$:
_/| \
| |\ \
|_ |/ /
\| /
If the input \$\ge66... |
Let's say we have some arbitrary number:
For example 25. We also have some "tokens" (poker chips, money, something similar) with different values.
Values of tokens are
2; 3; 4; 5.
"Tokens" are limitless
You need to achieve number 25 using exactly n tokens (for example, 8) and to output all possible ways of doing so.
F... |
Shikaku is a 2D puzzle. The basic rundown of it is that a rectangular grid has some numbers in it, and you want to partition the grid into rectangular components such that each component contains exactly one number which is the number of grid squares in that component.
This challenge involves a 1D simplification of thi... |
You are starting up a cryptocurrency exchange website which supports conversion from USD to two currencies, foo-coin and bar-coin. Write a program that takes the exchange rate for each coin to USD as arguments and outputs the maximum value of USD that cannot be completely divided into the two currencies (assuming these... |
Your task is to write a program, function, or snippet that will output one value if run forward, and another if run backward. The program must run without errors.
The output can be any two distinct values, of the same data type. For example, 1 and 3, true and false, or 't' and 'f'. In languages without a concept of dat... |
Introduction
The Fibonacci sequence is a mathematical sequence in which each term is the sum of the \$2\$ terms before it; the first two terms are \$0\$ and \$1\$. The first few terms are \$0, 1, 1, 2, 3, 5, 8, 13\$. However, it is possible to make variations of this sequence, where each term is the sum of the, say \$3... |
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... |
Your task is to write a program or function which takes a pure brainflak program as input (assume it contains only balanced ()[]{}<>), and output a visually mirrored copy of it.
If you reversed a brainflak program as a string, say ({}()) (add one to an input), you would get ))(}{(, which is not valid.
Instead, you shou... |
Your challenge is to create the longest run of characters with incrementing Unicode codepoints in a pristine program as you can. To keep things simple, I'll abridge the definition for this challenge to be "any program which produces no errors but will error if any one character is removed".
Let's define a codepoint run... |
Print the ASCII version of a random grid.
################################################################################
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # ############# # # ... |
Your challenge is to parse nonsensical text and output a "congruous phrase" - which I shall define here to be text with any contiguous characters in between, and including, a given set of like symbols removed.
The given set of like symbols (ignore all brackets and commas here, they're only for notation) are: {(< >), (^... |
Challenge
Construct n strings, each with three distinct letters, chosen randomly with equal probability.
Print the proportion k/n where k is the number of strings such that all three characters are in ascending order. Print also those k strings.
Input
The only input is n (and thus it must be a positive integer).
Ou... |
Background
Set is a card game. The deck consists of 81 unique cards that vary in four features: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple).
For convenience, let's write a card as a 4-tuple of numbers from 1 to 3, e.g.
111... |
Given a description of the base state of a recursive ASCII pattern, output an expanded state somewhere along the recursion steps.
More specifically: Let the following be an example:
##..
##..
..__
..__
Where # is filled, . is empty, and _ is recursive.
This describes a pattern wherein the top left quarter is filled, t... |
Today is November 11th, which for many regions is Remembrance Day.
If you don't know anything about the history or context of Remembrance Day, you can read about it in the wiki page, but it's not relevant for this challenge.
In Flanders Fields is a poem that is pretty well-known relating to this day. It opens like so:
... |
Introduction
I have an even number of bottles, all of different sizes. Unfortunately, I only know the size of the smallest bottle: 300ml.
I also know the following:
Half of the bottles are twice the size of the other half, meaning that the smallest small bottle and the smallest large bottle are in a ratio of 2:1.
The... |
I have a piece of paper whose shape is a regular n-gon with side length 1. Then I fold it through some of its diagonals. What is the area of the shape formed by the (former) edges of the regular polygon?
Illustration
Suppose n = 8, i.e. an octagon-shaped paper. Let's name the vertices from A to H (left picture). Then I... |
In some parts of the world, phone numbers are fixed-length, apparently. That sounds boring, though.
For this challenge, your task is to take the digits of a what is presumed to be a valid phone number, and format it based on some simplified rules around what a phone number looks like.
Input format
Your input will consi... |
Challenge
Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy.
Rules
The accuracy of the solution should be measured against this CSV file (which countains syllable counts for all the 52,439 entries in the CMU Pronounc... |
A guess the word game
The agreed dictionary. All words are 6 letters long with all letters distinct
Rules: This is a game of two players and the task will be to implement Player 2.
Player 1 chooses a word from the agreed dictionary
Player 2 repeatedly guesses a word from the agreed dictionary.
At each turn, Player 1 ... |
At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for this task, I've obtained a permit (legal, I assure you) for dynamite charges of military grade, along with enormous dyna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.