text
stringlengths
180
608k
[Question] [ Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, or other similar tricks. Your goal is to write a polyglot where the output for each language is the code...
[Question] [ Write a program that accepts a single lowercase word as input and outputs the number of pairs of letters that have the same number of letters between them in the word as in the alphabet. For example, in the word 'nature', we have 4 pairs: * nr: since there are three letters between them inside the word...
[Question] [ ## Background In some possible futures, the world will convert their numerical systems from decimal (base 10 or `b10`) to some other base (binary `b2`, octal `b8`, hexadecimal `b16`, or even unary `b1`, in which case we're screwed!). Thus, in preparation for this possible world-changing event, you deci...
[Question] [ This question is inspired by [this awesome answer](https://codegolf.stackexchange.com/a/17103/106710). The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation thereof, such that the character codes of that string add u...
[Question] [ While I was writing numbers I noticed after a while that my keyboard had the `Shift` key pressed and blocked and all I wrote was `$%&`-like characters. And even worse, I had been switching between the English and Spanish keyboard layouts so I don't know which one I used for each number. ### Challenge G...
[Question] [ ## Introduction: When we think about Ladybugs, we usually think of a red or dark orange bug with black spots. Although this isn't necessary true, since there are also [black with red/orange spotted ladybugs](https://kids.nationalgeographic.com/content/dam/kids/photos/animals/Bugs/H-P/ladybug-on-leaf.ng...
[Question] [ The video game [Transistor](http://en.wikipedia.org/wiki/Transistor_(video_game)) features a very interesting ability system. You collect 16 "Functions" which you can use in 16 different slots. What's interesting is that there are 3 types of slots and every Function behaves differently according to whi...
[Question] [ An [epicycloid](http://en.wikipedia.org/wiki/Epicycloid) is the curve a point on a circle makes as it rolls around another circle. A [cyclogon](http://demonstrations.wolfram.com/Cyclogons/) is the shape a point on a [regular polygon](http://en.wikipedia.org/wiki/Regular_polygon) makes as it rolls acros...
[Question] [ [![XKCD: Sandwich](https://imgs.xkcd.com/comics/sandwich.png)](http://xkcd.com/149/) Challenge: Write a makefile, which would lead to this behavior: ``` % make me a sandwich What? Make it yourself % sudo make me a sandwich Okay ``` Rules: 1. Should work on a Linux machine, where the user isn't root bu...
[Question] [ ## Input A non-empty binary matrix consisting of 3x3 sub-matrices put side by side. ## Task Your task is to identify valid dice patterns (as described below) among the 3x3 sub-matrices. Each valid pattern is worth the value of the corresponding dice. Invalid patterns are worth 0. ## Output The sum of t...
[Question] [ # The Challenge There are N cities aligned in a straight line. The i-th city is located `A[i]` kilometers to the right of the origin. No two cities will be in the same place. You are going to build an electrical grid with some power plants. Power plants must be built inside a city. However, you are onl...
[Question] [ # Your pyramid The pyramid I want you to build is made entirely of cubes. It has 24 layers, and the Nth layer from the top contains N2 cubes arranged in an N by N square. The pyramid looks like this: [![The pyramid](https://i.stack.imgur.com/ymtVx.png)](https://i.stack.imgur.com/ymtVx.png) To build the...
[Question] [ ## Introduction I have a room full of *magic mirrors*. They are mysterious artifacts that can duplicate any item, except another magic mirror. More explicitly, a duplicate version of the item will appear on the other side of the mirror, at the same distance. However, if there is another magic mirror in...
[Question] [ I was wondering if there are any esoteric or golfing languages which specifically target text output and ASCII art? For example, 05AB1E at least started by targeting base conversions. Are there any golfing languages targeting text output and text output art? If so, do they have tip pages here, and ar...
[Question] [ [![enter image description here](https://i.stack.imgur.com/D6JFs.png)](https://i.stack.imgur.com/D6JFs.png) The above image is called a hexa-glyph. Hexa-glyphs are some cool patterns I made up while doodling during my DiffEq class. Here's how you make one: 1. Consider the following set of points, shape...
[Question] [ You should write a program or function which given three positive integers `n b k` as input outputs or returns the last `k` digits before the trailing zeros in the base `b` representation of `n!`. ## Example ``` n=7 b=5 k=4 factorial(n) is 5040 5040 is 130130 in base 5 the last 4 digits of 130130 befor...
[Question] [ The [Koch snowflake](http://en.wikipedia.org/wiki/Koch_snowflake) (also known as the Koch star and Koch island) is a mathematical curve and one of the earliest fractal curves to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled "On a continuous curve without tang...
[Question] [ Similar in spirit to [Number of distinct tilings of an n X n square with free n-polyominoes](https://codegolf.stackexchange.com/q/194056/53884) and [Partition a square grid into parts of equal area](https://codegolf.stackexchange.com/questions/179074/partition-a-square-grid-into-parts-of-equal-area), t...
[Question] [ *Inspired by [Generate Keyboard Friendly Numbers](https://codegolf.stackexchange.com/questions/50047/generate-keyboard-friendly-numbers).* ## Background Many number pads have the following layout: `7``8``9` `4``5``6` `1``2``3` `0` We define a number's neighborhood as the set of cells orthogonally adjac...
[Question] [ OEIS [has a variation](https://oeis.org/A111439) (A111439) on [Golomb's sequence](https://oeis.org/A001462). As in Golomb's sequence, `A(n)` describes how often `n` appears in the sequence. But in addition, no two consecutive numbers may be identical. While building up the sequence, `A(n)` is always ch...
[Question] [ This challenge is in honor of the tacky Christmas lights at my in laws' house. --- **The challenge is to create a graphical output showing the decoration in "real time".** The video (gif or other format) will have **n-by-m** vertical and horizontal "lights". **5 <= m,n <= 40**. The frame size and resol...
[Question] [ According to the [Wikipedia page on the number 69](https://en.wikipedia.org/wiki/69_(number)), it is of note that \$69^2 = 4761\$ and \$69^3 = 328509\$ together use all decimal digits. The number **69** is in fact the lowest number that satisfies this property. For a similar reason, \$32043\$ is remark...
[Question] [ Make a snake fill any maze (until it gets stuck). ## The snake The snake starts at a given starting point, pointing **EAST**. It moves by always having a wall or a part of its body immediately to the **LEFT** of its head ("*left-hand rule wall follower*"), until it gets stuck because all four direction...
[Question] [ Write a program that will determine if a given matrix represents a quandle. A [quandle](https://en.wikipedia.org/wiki/Racks_and_quandles) is a set equipped with a single (non-commutative, non-associative) operation \$◃\$ which obeys the following axioms: * The operation is closed, meaning that \$a◃b = ...
[Question] [ ## Mash Up Time! This is instalment #5 of both my [Random Golf of the Day](https://codegolf.stackexchange.com/q/45302/8478) and Optimizer's [ASCII Art of the Day](https://codegolf.stackexchange.com/q/50484/8478) series. Your submission(s) in this challenge will count towards both leaderboards (which yo...
[Question] [ There are 88 [keys](http://en.wikipedia.org/wiki/Piano_key_frequencies) on a standard piano and 95 [printable ascii](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) characters (hex codes 20 through 7E): ``` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop...
[Question] [ In this challenge, we define a *range* similarly to Python's `range` function: A list of positive integers with equal differences between them. For example, `[1, 2, 3]` is a range from 1 to 3 with a skip count of 1, because there is a difference of 1 between each item, and `[4, 7, 10, 13]` is a range f...
[Question] [ Imagine this short function to clamp a number between 0 and 255: ``` c = n => n > 0 ? n < 255 ? n : 255 : 0 ``` Is this the shortest possible version of a clamp function with JavaScript (without ES.Next features)? P.S: Not sure if it's relevant but, the 0 and 255 are not random, the idea is to clamp a ...
[Question] [ The *Dirichlet convolution* is a special kind of *convolution* that appears as a very useful tool in number theory. It operates on the set of [*arithmetic functions*](https://en.wikipedia.org/wiki/Arithmetic_function). ### Challenge Given two arithmetic functions \$f,g\$ (i.e. functions \$f,g: \mathbb ...
[Question] [ # Landslides In this challenge, your job is to predict the extent of damage caused by a massive landslide. We use the following simplified two-dimensional model for it, parameterized by an *initial height* `h >= 0` and a *critical coefficient* `c > 0`. You start with a cliff of height `h`, and it is as...
[Question] [ ## Flavortext So...this is awkward. It seems I accidentally turned into a monkey last night after eating one too many banana sundaes. This has made many things inconvenient, especially typing. You see, monkeys only need the following characters: uppercase letters (`A-Z`), space, comma (`,`), exclamatio...
[Question] [ Try to create a simple ASCII art scissors animation! # Challenge All inputs will be integers -31 through 31. The output will be an animation (To be outputted *somewhere*, as long as the previous frame is replaced. GIFs are allowed.), separated by (approximately) 1 quarter of a second. If the input (`n`...
[Question] [ 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 ...
[Question] [ Your bird has been itching for some exercise and is sick of being stuck in static positions all the time. Write a program that will show a randomly dancing ascii bird, updating every 100ms\*n or 200ms\*n depending on the dance move. The bird always begins with the dance move `<(")>`. The program should...
[Question] [ # **Input:** A non-empty sequence of integers greater than zero, the length of which is greater than 1. # **Output:** The largest product of all elements of the longest subsequence between the minimum and maximum elements of sequence including themselves. ## Note: Because the minimum and maximum elemen...
[Question] [ The [permanent](https://en.wikipedia.org/wiki/Permanent_(mathematics)) of an \$n\$-by-\$n\$ matrix \$A = (a\_{i,j})\$ is defined as: $$\operatorname{perm}(A)=\sum\_{\sigma\in S\_n}\prod\_{i=1}^n a\_{i,\sigma(i)}$$ For a fixed \$n\$, consider the \$n\$-by-\$n\$ matrices whose entries are taken from \$\{...
[Question] [ ## Input: Two strings (NOTE: the order of input is important). ## Output: Both words/sentences start on lines with one empty line in between them. They 'walk' horizontally 'next to each other'. But when they have the same character at the same position, they cross each other, and then continue walking ...
[Question] [ Everybody has heard of the phrase "be there or be square". So I thought it was time for a challenge about it. ## Input You will take a full absolute directory address as text as input via STDIN or equivalent. ## Output If the directory address exists and is valid, your program will move itself to that ...
[Question] [ It is time to embark on a perilous quest to defeat the British Intelligence. The aim of this challenge is to write the shortest code that will solve a Nonogram. # What is a Nonogram? [![Nonogram Puzzle](https://i.stack.imgur.com/mdMjdm.png)](https://i.stack.imgur.com/mdMjdm.png) > > The rules are sim...
[Question] [ A [Gaussian integer](https://en.wikipedia.org/wiki/Gaussian_integer) is a complex number whose real and imaginary parts are integers. Gaussian integers, like ordinary integers, can be represented as a product of Gaussian primes, in a unique manner. The challenge here is to calculate the prime constitue...
[Question] [ ## Things to know: First, lucky numbers. Lucky numbers are generated like so: Take all the natural numbers: ``` 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20... ``` Then, remove each second number. ``` 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39... ...
[Question] [ # Background The Italian definite article (corresponding to English *the*) has seven different forms: *l'*, *il*, *lo*, *gli*, *i*, *la*, *le*. Which one to use depends on three variables: * Gender: masculine / feminine. * Number: singular / plural. * Initial letter of the subsequent word: vowel / cons...
[Question] [ Given a ragged list of positive integers, where the maximum depth is \$d\_\text{max}\$, return the same list, except for every element \$e\$, its depth is \$d\_\text{max}+1-d\_e\$ (where \$d\_e\$ is the depth of that element). Your output should contain the minimal number of brackets, and you can assum...
[Question] [ Alice is an intern in a company that uses Brainfuck as a primary language for both client-side and server-side development. Alice just has written her first code and she's a bit nervous as she's getting ready for her first code review. Alice wants to make her code properly formatted and look nice, but ...
[Question] [ > > Note: The title of this question should be "Loop It", but because title needs to be at least 15 characters, there are some invisible spaces. This note is such that the challenge can be searched for. > > > --- ### Challenge Given a finite list of unique integral points in the plane, find a poly...
[Question] [ This challenge requires a small amount of knowledge about [chess](/questions/tagged/chess "show questions tagged 'chess'"). A description of the details required can be found at the bottom if you are not familiar with chess or want a refresher. For a certain board configuration consisting only of queen...
[Question] [ Lonely primes (as I call them) are primes, where given a number grid with width `w ≥ 3`, are primes which do not have any other primes adjacent to them orthogonally or diagonally. For example, if we take this grid where `w = 12` (primes highlighted in bold): ``` 1 **2** **3** 4 **5** 6 **7*...
[Question] [ Do you remember [my mat properly grouped by colors](https://codegolf.stackexchange.com/q/148927/70347)? [![My mat properly grouped by colors](https://i.stack.imgur.com/8hWGAm.jpg)](https://i.stack.imgur.com/8hWGAm.jpg) Yesterday I was looking at it and realized that some letters fit inside others. Exam...
[Question] [ A number is in base-b simplified Goodstein form if it is written as ``` b + b + ... + b + c, 0 < c ≤ b ``` The simplified Goodstein sequence of a number starts with writing the number in base-1 simplified Goodstein form, then replacing all 1's with 2's and subtracting 1. Rewrite the result in base-2 ...
[Question] [ # Goal You're playing a computerised chess game. The display is in black and white only and the pixels are chunky. White pixels use a lot power compared to black pixels and you're concerned about your carbon footprint. Given a square and a piece in chess notation, return the number of white pixels disp...
[Question] [ I have always failed to give an answer for [kolmogorov-complexity](/questions/tagged/kolmogorov-complexity "show questions tagged 'kolmogorov-complexity'") challenges which require string compression, the main reason being that I don't know to use string compression tools *as effectively as I should*. ...
[Question] [ Starting with 1, output the sequence of integers which cannot be represented as the sum of powers of earlier terms. Each previous term can be used at most once, and the exponents must be non-negative integers. This sequence starts: ``` 1, 2, 6, 12, 25, 85, 194, 590, 1695, 4879, 19077, 83994, 167988 ```...
[Question] [ Here's an interesting sequence discovered by Paul Loomis, a mathematician at Bloomsburg University. From [his page](https://facstaff.bloomu.edu/ploomis/sequences.html) on this sequence: Define `f(n) = f(n-1) + (the product of the nonzero digits of f(n-1))` `f(0) = x`, with `x` as any positive integ...
[Question] [ ## Challenge Given a quark composition of a particle as input, output the corresponding hadron's name. Quarks will be represented by a capital letter and antiquarks by a lowercase letter. The quarks may be in any order, not necessarily the order given below. Built-in functions the access data about par...
[Question] [ ## Challenge: Given an NxN matrix where \$N\geq2\$ and one of eight distinct 'folding options', output a 2D array/list with the subtracted values. The eight folding options are: left-to-right; right-to-left; top-to-bottom; bottom-to-top; topleft-to-bottomright; topright-to-bottomleft; bottomleft-to-top...
[Question] [ # Introduction This challenge consists in finding the greatest number removing *y* digits from the original number *n* which has *x* digits. Assuming `y=2 n=5263 x=4`, the possible numbers removing *y=2* digits are: ``` [52, 56, 53, 26, 23, 63] ``` So, the greatest number is `63` which must be the outp...
[Question] [ *This is one of several challenges left for the community by [Calvin's Hobbies](https://codegolf.stackexchange.com/users/26997/calvins-hobbies).* Take a "family tree describing" file with lines of the form: ``` [ID] [mother ID] [father ID] [gender] [full name] ``` such as this which describes the first...
[Question] [ ![](https://i.stack.imgur.com/859Zsm.jpg) Picture of me drafting this challenge with my advanced drawing skills. ## Background The Stickman wars happened long ago, when Earth's dominant species was made of nothing but sticks. Historians regret the fact that there were no painters or cameras back the...
[Question] [ In Minecraft, pistons are blocks that can move other blocks. However, they can only move at most twelve blocks, and won't work at all if any obsidian is in the way. Also, slime blocks are sticky and stick to other blocks, except for obsidian. # Your challenge Take as input a 5x5 matrix or similar, cont...
[Question] [ # I see your BIDMAS and raise you a BADMIS ## Challenge Given a set of numbers with operators between them: "5 + 4 \* 9 / 3 - 8", return all the possible results of the expression for every permutation of the order of basic operations: [/, \*, +, -]. ## Rules * Standard loopholes forbidden * I/O + Inp...
[Question] [ This challenge is based on the following puzzle: You are given an `n` by `n` grid with `n` cells marked. Your job is to the partition the grid into `n` parts where each part consists of exactly `n` cells, each containing exactly one marked cell. # Example Here is a puzzle on the left and its (unique) s...
[Question] [ Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches *all* the nouns in one form and *none* in the other (easy, all English nouns end in `s` in plural form right?). ``` SINGULAR PLURAL --------- -------- ca...
[Question] [ Write a program that visualizes long division with ASCII art. Input consists of two integers, a numerator and a denominator, using the input format of your choice. **Examples:** 1234 ÷ 56: ``` 22 ---- 56|1234 112 --- 114 112 --- 2 ``` 1002012 ÷ 12: ``` 83501 ----...
[Question] [ My final-year project at the National University of Singapore is on Zarankiewicz's problem: > > What is the maximum number of 1s in an \$m×n\$ binary matrix (\$m\$ rows and \$n\$ columns) with no \$a×b\$ minor (intersection of any \$a\$ rows and any \$b\$ columns) being all 1s? > > > For example, t...
[Question] [ Art stolen from [What size is the digit?](https://codegolf.stackexchange.com/questions/68960/what-size-is-the-digit) --- 7-segment digits can be represented in ASCII using `_|` characters. Here are the digits `0-9`: ``` _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _...
[Question] [ Have you ever wanted to ask the compiler "Why?" Most of us have been frustrated when the code isn't working as it should. Mathworks has therefore implemented a nice little function, `why`, that answers the question. To give a few examples from MATLAB: ``` why The programmer suggested it. why To fool th...
[Question] [ # Introduction For many centuries, there has been a certain river that has never been mapped. The Guild of Cartographers want to produce a map of the river, however, they have never managed to succeed -- for some reason, all the cartographers they have sent to map the river have been eaten by wild anim...
[Question] [ ## Background This challenge is about the [Game of Go](https://en.wikipedia.org/wiki/Go_(game)). Here are some rules and terminology relevant to this challenge: * Game of Go is a two-player game, played over a square board of size 19x19. * One of the players plays Black, and the other plays White. The ...
[Question] [ This challenge is inspired by a talk about Schläfli symbols, etc that I gave in a Geometry seminar. While I was putting together this challenge, I saw that [Donald Knuth](https://en.wikipedia.org/wiki/Donald_Knuth) himself was interested in (some subset of) this problem. In October 2016, he [commented ...
[Question] [ [Sandbox](https://codegolf.meta.stackexchange.com/a/18353/71546) ### What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in th...
[Question] [ Given a number *n > 77*, write a program or function that finds a set of **distinct** positive integers such that the sum of the set equals *n*, and the sum of the reciprocals of the set equals 1. Example for 80: > > 80 = 2 + 4 + 10 + 15 + 21 + 28    ⟶     > 1/2 + 1/4 + 1/10 + 1/15 + 1/21 + 1/28 = 1 ...
[Question] [ It's back to school season! So for a part-time job, you're helping out at the school's library. The problem is, the head librarian has never even heard the words "Dewey Decimal," let alone implemented that system. Instead, the sorting system in use has grown "organically" as the library has expanded......
[Question] [ Write a [*GOLF*](https://github.com/orlp/golf-cpu) assembly program that reads an integer from stdin (followed by a trailing newline), and outputs its prime factors seperated by newlines, followed by a trailing newline on stdout. The prime factors need not be in a particular order. `1` is not a prime f...
[Question] [ I'm trying to read 4 ints in C in a golfing challenge and I'm bothered by the length of the code that I need to solve it: ``` scanf("%d%d%d%d",&w,&x,&y,&z) ``` that's 29 chars, which is huge considering that my total code size is 101 chars. I can rid of the first int since I don't really need it, so I ...
[Question] [ ## Premise So recently I was about half an hour early to an appointment, and decided to wait outside. I also determined that it would look strange if I just stood motionlessly in front of the house. Therefore, I decided to go on a quick walk, within a limited area. I also concluded that if I started wa...
[Question] [ Here is an image: ``` %%%%%%%%%%%%% % Hello, % % world! % %%%%%%%%%%%%% ``` But it is too confusing for our undersized brains to compute. So we average it like this: 1. Split it into 2 x 2 sections. If the picture ends before a section is complete, imagine that there are spaces there. 2. Average ...
[Question] [ I'm a [teacher](https://en.wikipedia.org/wiki/Suspension_of_disbelief "because I'm not really one"), and in a few days I have to give my students a test. Now, I'm always worried about my loveliest students being hurt by the least loveliest ones when they cheat, so I want to randomize the tests so no on...
[Question] [ ## Four integer sequences In this challenge, you will test four different properties of a positive integer, given by the following sequences. A positive integer **N** is 1. *perfect* ([OEIS A000396](https://oeis.org/A000396)), if the sum of proper divisors of **N** equals **N**. The sequence begins wit...
[Question] [ A fun pair of equivalences is *1 + 5 = 2 · 3* and *1 · 5 = 2 + 3*. There are many like these, another one is *1 + 1 + 8 = 1 · 2 · 5* and *1 · 1 · 8 = 1 + 2 + 5*. In general a product of *n* positive integers equals a sum of *n* positive integers, and vice versa. In this challenge you must generate all ...
[Question] [ A set of `n` positive numbers has `2^n` subsets. We'll call a set "nice" if none of those subsets have the same sum. `{2, 4, 5, 8}` is one such nice set. Since none of the subsets has the same sum, we can sort the subsets by sum: `[{}, {2}, {4}, {5}, {2, 4}, {2, 5}, {8}, {4, 5}, {2, 8}, {2, 4, 5}, {4, ...
[Question] [ Using the the ten inferences of [the Natural Deduction System](https://en.wikipedia.org/wiki/Natural_deduction) prove [DeMorgan's laws](https://en.wikipedia.org/wiki/De_Morgan%27s_laws). ## The Rules of Natural Deduction * Negation Introduction: `{(P → Q), (P → ¬Q)} ⊢ ¬P` * Negation Elimination: `{(¬P ...
[Question] [ ## Introduction Let's define a *ternary function* as a function from the three-element set `S = {0,1,2}` to itself: it associates to each element of `S` another element of `S`. One example of a ternary function `f` is ``` f(0) = 0; f(1) = 2; f(2) = 0 ``` There are exactly 27 different ternary functions...
[Question] [ `figlet` is utility that converts plain text to an ascii-art representation for use in banners and the like. For example: ``` $ figlet "CODE GOLF" ____ ___ ____ _____ ____ ___ _ _____ / ___/ _ \| _ \| ____| / ___|/ _ \| | | ___| | | | | | | | | | _| | | _| | | | | | |_ | |...
[Question] [ In this challenge you will write a program that takes two newline-separated strings, s1 (the first line) and s2 (the second line), as input (STDIN or closest). You can assume that the length of s1 will always be smaller than 30 and bigger than the length of s2. The program should then output each step ...
[Question] [ All those busy beavers made quite a mess. They wrote all over the tape. At this rate, our neighbour will stop lending us unbounded tapes. We need a new way to play the busy beaver game, one that doesn't ruin every tape we use. # The Rules Brainfuck only. Memory tape is unbounded both ways. Input instru...
[Question] [ Write a program that takes as input a string and an integer `n`, and outputs: 1. The string that was passed to the program `n` times ago; 2. A new program that will be used for the next invocation. You cannot store any data outside of the program, and your program cannot call previous programs in the c...
[Question] [ [Related](https://codegolf.stackexchange.com/questions/241609/is-this-continuous-terrain-part-ii) | [Related](https://codegolf.stackexchange.com/q/199540) --- Given an ASCII art with `|`, `_`, and , check if you can draw the art in one stroke. ## Description Your task is, if the ASCII art is representi...
[Question] [ The [λ-calculus](https://en.wikipedia.org/wiki/Lambda_calculus#Formal_definition), or lambda calculus, is a logical system based on anonymous functions. For example, this a λ-expression: ``` λf.(λx.xx)(λx.f(xx)) ``` However, for the purposes of this challenge, we'll simplify the notation: * Change `λ` ...
[Question] [ In Magic: the Gathering, mages (known as "planeswalkers") battle each other by casting spells. Spells cost mana. Five colors of mana exist: White, Blue, Black, Red, and Green, represented as {W}, {U}, {B}, {R}, and {G}, respectively. A spell's cost is slightly more complex. The cost can be any combinat...
[Question] [ Given an input of a note, output an ASCII drawing of the corresponding major key on the treble clef. Here are all the major keys (that don't include double-sharps or double-flats) and their corresponding key signatures: ![](https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Circle_of_fifths_delu...
[Question] [ # The Challenge Given a rectangular grid of characters ``` A B C D E F G H I J K L M N O P Q R S T ``` and a grid with the same dimensions of dots and spaces ``` . . . . . . . . . . . ``` Output the string which is generated by following the dots through the grid starting in the upper...
[Question] [ # **TASK** The goal is to write a program that rotates any two-dimensional list by 45 degrees, it must be able to do this up to 7\*45 (at once) before returning the list. The list will not necessarily be square or rectangular. You must include output for the examples in your answer. It must also work f...
[Question] [ ## Background Python 3 has many types of string literals. For example, the string `this 'is' an exa\\m/ple` can be represented as: ``` 'this \'is\' an exa\\\\m/ple' "this 'is' an exa\\\\m/ple" r"this 'is' an exa\\m/ple" '''this 'is' an exa\\\\m/ple''' """this 'is' an exa\\\\m/ple""" r'''this 'is' an ex...
[Question] [ Here is a very simple language definition: ``` A Variable is any string that does not contain ^, <, >, !, or ? The empty string is a valid variable identifier The value of every variable starts at 0. A Statement is one of (var is a Variable, P is a Program): var^ -> changes var to be equal to 1 m...
[Question] [ Hexagonal grids have been become a fairly popular twist for challenges about 2-dimensional data recently. However, it seems that the equally interesting triangular grids have been largely neglected so far. I'd like to rectify that with a rather simple challenge. First, how do we represent a triangular ...
[Question] [ The flag of the United States of America contains, in its canton, 50 stars, representing the 50 states. ![50-star US flag](https://i.stack.imgur.com/C0plR.png) In the past, when there were fewer states, there were of course fewer stars, and they were arranged differently. For example, from 1912-1959 (a...
[Question] [ Your task is to generate a valid juggling pattern by completing a given template. But first, you probably need to know how such a pattern is denoted. ![enter image description here](https://i.stack.imgur.com/0MfKH.gif) ## Introduction to Siteswap Siteswap is the established notation for juggling patter...
[Question] [ ### Background [PICASCII](http://picascii.com/) is a neat tool that converts images into ASCII art. It achieves different degrees of brightness by using the following ten ASCII characters: ``` @#+';:,.` ``` We'll say that these charxels (character elements) have brightnesses from 1 (at-sign) to 10 (sp...
[Question] [ This is not just another challenge asking you to color random maps... In this challenge, you are asked to write a program that is **actually used** in the formal proof of the Four Color Theorem. First I shall describe the challenge without any background or motivation, for the impatient. A **chromogram...
[Question] [ Input is an r by c matrix of non-negative integers (you may input r and c as other parameters if this helps with golf). This may be inputted as a 2D array or, if you prefer, a 1D array (though taking in r this time is necessary). Strings separated by spaces to distinguish rows and newlines to distingui...