text
stringlengths
180
608k
[Question] [ Currently at my work we moved to a new building. It's supposed to be state of the art and has automatic lights, automatic roll-down shutters, and is now known as the most eco-friendly building in this town. However, it doesn't really work all that well.. The roll-down shutters sometimes go down on cl...
[Question] [ What general tips do you have for golfing in [Retina](https://github.com/mbuettner/retina)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Retina (e.g. "remove comments" is not an answer). Please post one tip per answer. For reference, ...
[Question] [ # Task Your task is to write a program that will output ASCII boxes at the locations specified by the input. ## Input You will be given a list of numbers. The format here is a bit flexible, in that you can use any deliminator you want (e.g. `1,2,3,4`, `1 2 3 4`, `[1,2,3,4]`). The list is in groups of 4...
[Question] [ What general tips do you have for golfing in Forth (and its clones)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Forth (e.g. "remove comments" is not an answer). [Answer] ## Avoid explicit loops at all costs Forth has two loopin...
[Question] [ ## Background The **Rearrangement Inequality** is an inequality that is based on rearranging numbers. If I have two lists of numbers of the same length, x0, x1, x2...xn-1 and y0, y1, y2...yn-1 of the same length, where I am allowed to rearrange the numbers in the list, a way to maximize the sum x0y0+x1...
[Question] [ Write two code fragments, which we will call s\_zero and s\_one. Program (l, n) consists of l copies of s\_zero and s\_one corresponding with the digits of n in binary, padded with s\_zero on the left. For example, if s\_zero = `foo` and s\_one = `bar` then Program (4, 0) = `foofoofoofoo` Program (...
[Question] [ ### The Challenge: In this question: [Name the poker hand](https://codegolf.stackexchange.com/questions/6494/name-the-poker-hand) you had to take a five card poker hand and identify it. This question is similar, with two twists: First, the output will be in all lower case. This allows for more golfing,...
[Question] [ Any positive integer can be obtained by starting with **1** and applying a sequence of operations, each of which is either **"multiply by 3"** or **"divide by 2, discarding any remainder"**. **Examples** (writing f for \*3 and g for /2): `4 = 1 *3 *3 /2 = 1 ffg` `6 = 1 ffggf = 1 fffgg` `21 = 1 fff...
[Question] [ I have a weakness for 3d nets which when cut out and folded allow you to make 3d shapes out of paper or card. The task is simple, written the shortest program you can that draws nets for the 13 Archimedean solids. The output should be an image file in any sensible format (png, jpg). All thirteen shape...
[Question] [ Often a task requires real arrays. Take for instance the task to implement Befunge or ><>. I tried to use the `Array` module for this, but it's really cumbersome, as it feels like I'm coding much too verbose. Can anybody help me how to solve such code-golf tasks less verbose and more functional? [...
[Question] [ ## How to play the duck game **This is a 2-player game.** First, we start with a line of blue rubber ducks (represented here as circles): > > > ``` > 🔵🔵🔵🔵🔵🔵🔵 > > ``` > > Now, in each turn, the current player can turn either one blue duck or two adjacent blue ducks red. So, a v...
[Question] [ [Wheat Wizard](https://codegolf.stackexchange.com/users/56656/wheat-wizard) has once tried to come up with [a parsing problem](https://codegolf.stackexchange.com/q/233453/78410) unsuitable for regex, but it failed due to [Anders Kaseorg's Perl regex answer](https://codegolf.stackexchange.com/a/233465/7...
[Question] [ [Gaussian integers](https://en.wikipedia.org/wiki/Gaussian_integer) are complex numbers \$x+yi\$ such that \$x\$ and \$y\$ are both integers, and \$i^2 = -1\$. The norm of a Gaussian integer \$N(x+yi)\$ is defined as \$x^2 + y^2 = |x+yi|^2\$. It is possible to define a [Euclidean division](https://en.w...
[Question] [ The brainiacs at *New Scientist* tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (<https://twitter.com/newscientist/status/1379751396271124480>) This is of course correct...
[Question] [ The goal of this challenge is to extend the On-Line Encyclopedia of Integer Sequences (OEIS) sequence [A038375](https://oeis.org/A038375). > > Maximal number of spanning paths in tournament on n nodes. > > > A [tournament](https://en.wikipedia.org/wiki/Tournament_(graph_theory)) on \$n\$ vertices i...
[Question] [ In a challenge of CodingGame, there is a challenge that ask you to decode a string composed by reversed words ('Hello world' > 'olleH dlrow') then each characters converted into ascii value separeted by space: ``` >>> decode('111 108 108 101 72 32 100 108 114 111 119 32 41 58') Hello world :) ``` The c...
[Question] [ # A guess the word game The [agreed dictionary](https://gist.github.com/lesshaste/775f70d4da6778807ff9a8a42c293169#file-agreeddict-txt). 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 t...
[Question] [ We have many challenges based on base 10, base 2, base 36, or [even base -10](https://codegolf.stackexchange.com/q/105992/60043), but what about all the other rational bases? # Task Given an integer in base 10 and a rational base, return the integer in that base (as an array, string, etc.). # Process I...
[Question] [ **Standard ML** (or golfier: SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. (from [Wikipedia](https://en.wikipedia.org/wiki/Standard_ML)) Though you almost certainly will never win a code golf challenge with SML, (ab-) using it fo...
[Question] [ Consider the following 3x3 blocks which the [marching squares algorithm](https://en.wikipedia.org/wiki/Marching_squares) would identify for every cell (with 0-based labeled ID): ``` 0: ... ... ... 1: ... ... \.. 2: ... ... ../ 3: ... --- ... 4: ..\ ... ... 5: /.. ... ../ 6: .|. .|. .|. 7: /.. ... ... 8...
[Question] [ Your task is to slowly calculate exponentiation, with the following steps: Given two inputs (in this example, 4 and 8), you must calculate the exponentiation by calculate the equation bit by bit. You would do `4^8`, have a greater base value (4) and a smaller exponent (8). You can do this using more ex...
[Question] [ The Wythoff matrix is an infinite matrix consisting of the [Grundy numbers](https://en.wikipedia.org/wiki/Sprague%E2%80%93Grundy_theorem) of each square on a chessboard in [Wythoff's game](https://en.wikipedia.org/wiki/Wythoff%27s_game). Each entry in this matrix is equal to the smallest nonnegative nu...
[Question] [ # Introduction I found [this question](https://codegolf.stackexchange.com/questions/35727/calculate-the-riemann-zeta-function) that was closed because it was unclear, yet it was a nice idea. I'll do my best to make this into a clear challenge. The [Riemann Zeta function](https://en.wikipedia.org/wiki/R...
[Question] [ I have a chocolate bar and I need help eating it so you'll be writing a program just to do that. ## Explanation The first line is the input. Examples are separated by an empty line. ``` 7 ____ __|__| |__|__| |__|__| |__|__| 6 _______ |__|__| |__|__| |__|__| 5 ____ __|__| |__|__| |__|__| 0 1 ...
[Question] [ ## Introduction to [Bézout's identity](https://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity) The GCD of two integers A, B is the largest positive integer that divides both of them leaving no remainder. Now because of Euclid's property that each integer N can be divided by another integer M as follows...
[Question] [ ## Background Inspired by [this Unix.SE question](https://unix.stackexchange.com/questions/250740/replace-string-after-last-dot-in-bash) (and of course [my own answer](https://unix.stackexchange.com/a/250808/34061)). When an IP address is specified for an interface, it is often given in this dotted-dec...
[Question] [ Relevant links [here](https://en.wikipedia.org/wiki/Kronecker_symbol) and [here](http://mathworld.wolfram.com/KroneckerSymbol.html), but here is the short version: You have an input of two integers \$a\$ and \$b\$ between negative infinity and infinity (though if necessary, I can restrict the range, bu...
[Question] [ [Prelude](http://esolangs.org/wiki/Prelude) is an esoteric programming language, which has very few, but unusual, restrictions on what constitutes a valid program. Any block of printable ASCII text ("block" meaning that lines of printable ASCII are separated by newlines - 0x0A) is valid provided that: ...
[Question] [ Quines are fun. Polyglots are fun, too. Polyglot Quines exist, but we can raise the bar even higher. Write a file that contains a valid program for languages α, β, and γ. When the file is executed (possibly after compiling it) as a language α or β program, the program's output shall be of the same form...
[Question] [ The knight is a chess piece that, when placed on the `o`-marked square, can move to any of the `x`-marked squares (as long as they are inside the board): ``` .x.x. x...x ..o.. x...x .x.x. ``` Eight knights, numbered from 1 to 8, have been placed on a 3×3 board, leaving one single square empty `.`. They...
[Question] [ Given integer `n`, calculate a set of `n` random unique integers in range `1..n^2` (inclusive) such that the sum of the set is equal to `n^2` Random, in this case, means *uniformly* random between valid outputs. Each valid output for a given `n` must have a uniform chance of being generated. For exampl...
[Question] [ If you have ever had any exposure to Japanese or East Asian culture you will have surely encountered the Amidakuji game: [![enter image description here](https://i.stack.imgur.com/TCkPr.jpg)](https://i.stack.imgur.com/TCkPr.jpg) As [Wikipedia explains](https://en.wikipedia.org/wiki/Ghost_Leg), it is a ...
[Question] [ As per [Luke's request](https://codegolf.stackexchange.com/questions/68678/tic-tac-toe-with-only-crosses#comment168138_68678) and [Peter Taylor's addition](https://codegolf.stackexchange.com/a/69097/34388) to this challenge. ### Introduction Everyone knows the game tic-tac-toe, but in this challenge, w...
[Question] [ There are many ways to generate random words. You can take random syllables from a set, you can use n-tuples, *probably* neural networks (what can't they do?), alternating between consonants and vowels, etc. The method this challenge is based off of is by far the worst. It uses a Markov chain to genera...
[Question] [ On Github, there is a list [of the 10,000 most common passwords.](https://github.com/neo/discourse_heroku/blob/master/lib/common_passwords/10k-common-passwords.txt) I've also generated [my own list of random passwords](https://gist.github.com/nathanmerrill/0cb670ad52548ee56738). Your job is to identify...
[Question] [ # Background I have a bunch of square-shaped boxes of equal size, and since I'm a neat person, I want to arrange them all into a square formation. However, their number is not necessarily a perfect square, so I may have to approximate the square shape. I want you to find me the most aesthetically pleas...
[Question] [ Counting the amount of triangles in a picture is a task commonly used in brain tests. You are given a picture that contains shapes consisting of triangles. You then must find all possible triangles in the picture. # Task You are given a list of lines in a format of your choice. You must then output a l...
[Question] [ Inspired from the assortment of other 'Tips for golfing in language xyz'. As usual, please only suggest tips that are specific to OCaml and not programming in general. One tip per answer please. [Answer] ## Use functions instead of match ``` let rec f=function[]->0|_::t->1+f t ``` is shorter than ...
[Question] [ The code should take text from standard input: ``` The definition of insanity is quoting the same phrase again and again and not expect despair. ``` The output should be a PNG file containing the [word cloud](http://en.wikipedia.org/wiki/Tag_cloud) corresponding to that text: ![enter image description ...
[Question] [ As in [this challenge](https://codegolf.stackexchange.com/questions/262032/vertices-of-a-regular-dodecahedron), the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is ...
[Question] [ Your goal is to write a program or function that takes in as input a string representing the path to a file, and outputs a truthy value if that file is not empty and contains no non-null bytes -- i.e., all bits are 0 -- and a falsey value otherwise. I realize it is a very simple problem and I guess I c...
[Question] [ It's Christmas in July, so what better way to celebrate than a virtual white elephant gift exchange! For this King of the Hill challenge, you must create a bot that plays in a [White Elephant exchange](https://en.wikipedia.org/wiki/White_elephant_gift_exchange) simulation, trying to get the highest-val...
[Question] [ ## Introduction Today's challenge is all about teeth. Specifically, how long it takes to brush from one tooth to another. Your challenge is, given the locations of two teeth, output the shortest amount of time possible to brush from the first to the second. ## Challenge For this challenge we will be us...
[Question] [ [Inspiration](https://szkopul.edu.pl/problemset/problem/t5FLaUejqAvkMfX7RnLzfEI_/site). Consider a list `l`, consisting of numbers. Define a block operation at index `i` on the list `l` to be the act of moving 3 consecutive elements starting from `i` in `l` to the end. Example: ``` l, i (1-indexing) ->...
[Question] [ # Executive summary Given input representing two vectors and their respective "weights", produce output that also represents the weighted sum of those vectors. # Challenge The input will consist of one or more lines of the following characters: * exactly one occurrence of the digit 0, which represents ...
[Question] [ ## Context [Straw Poll](http://strawpoll.me/) is a website that is meant for the creation of simple/informal polls. Provided with a list of options, the user can select their choice(s), and the votes are tallied up. There's two very important features of a Straw Poll: * It is possible to view the curre...
[Question] [ ## Task Read the contents of a table given a set of coordinates. ## Table formatting Tables will be in this basic format: ``` |[name]|[name]| --------------------- [name]| [val]|[val] | [name]| [val]|[val] | ``` Column names are always unique *within columns*. Row names are also unique *within ro...
[Question] [ This challenge is based on Downgoat's [Adjust your chair](https://codegolf.stackexchange.com/questions/66994/adjust-your-chair). ## Challenge You just adjusted your new chair! It fits you perfectly. However, the wheel is squeaky and you know the repair people will change the adjustment. Problem is, you...
[Question] [ Joe is your average BF developer. He is about to check in his code changes to their repository when he gets a call from his boss. "Joe! The new client's machine is broken! The brainfuck interpreter sets all the cells to random values before program execution. No time to fix it, your code will have to d...
[Question] [ *99* is a programming language I invented earlier this week for my challenge [Write an interpreter for 99](https://codegolf.stackexchange.com/q/47588/26997). (Invented but never needed to implement thanks to half a dozen of you. ;) ) The full language spec is in that challenge so I'm not bothering to r...
[Question] [ I am trying to golf down some C++. Is it possible to make this condition shorter? `X > 3 & X - Y > 1` (Apart from removing whitespace, of course.) So, `X` is at least `4` but `X >= Y + 2`. `X` and `Y` are integers in the [0,5] interval. I have tried to find some bitwise formula but failed. [Answer...
[Question] [ Contest (!): In the language of your choice, write a program that will traverse the directory tree of a given directory and output a tree (i.e., an array of arrays) corresponding to it. Assume the directory is a predefined variable D. Smallest character count wins. **Rules:** * You must use recursion *...
[Question] [ The task of this challenge is as following: Write a program that reads a file of reasonable size (let's say <16 MB) from stdin or anywhere else (however you like, but must not be hardcoded), and put's the compressed output onto stdout. The output must be a valid gzip compressed file and if the compress...
[Question] [ # Introduction One question that I have come across recently is the possibility of dissecting a staircase of height 8 into 3 pieces, and then re-arranging those 3 pieces into a 6 by 6 square. Namely, is it possible to dissect the following into 3 pieces: ``` x xx xxx xxxx xxxxx xxxxxx xxxxxxx xxxxxxxx ...
[Question] [ ## Background We will be using a 3x3 cube for this challenge. Rubik's cubers have their own notation for movements on the cube: * Each of the 6 faces has a clockwise turn notated with a single capital letter: `UDLRFB`. There are three additional letters `MES` denoting the three center slices. * Counter...
[Question] [ ## Description You are given the results of a range function where every element has been rounded down to the nearest whole number. Your goal is to recover the original list. For example, the following function (in Python3) will produce an input for your program: ``` from numpy import arange, floor def...
[Question] [ > > In the beginning there was NCSA Mosaic, and Mosaic called itself **`NCSA_Mosaic/2.0 (Windows 3.1)`**, and Mosaic displayed pictures along with text, and there was much rejoicing. > > > ***15 years later...*** > > And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and...
[Question] [ Golf the leaderboard of this question (id=111735). Your program should issue **one** HTTP or HTTPS request to StackExchange API, parse it and present to user in form similar to a typical [Leaderboard Snippet](http://meta.codegolf.stackexchange.com/questions/5139/leaderboard-snippet) Sample output (for ...
[Question] [ **ISO Paper Sizes Defined:** The A series paper sizes are defined by the following requirements: ``` The length divided by the width is the square root of 2. The A0 size has an area of 1 unit. Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides. ``` [![enter image d...
[Question] [ Partition an `n X n` square into multiple non-congruent integer-sided rectangles. `a(n)` is the least possible difference between the largest and smallest area. ``` ___________ | |S|_______| | | | L | | |_|_______| | | | | | |_____|___| |_|_________| (fig. I) ``` The largest rectangle (`L`) ...
[Question] [ Given consecutive side lengths `s1, s2, s3... s_n` of an n-gon inscribed in a circle, find its area. You may assume that the polygon exists. In addition, the polygon will be convex and not self-intersecting, which is enough to guarantee uniqueness. Built-ins that specifically solve this challenge, as w...
[Question] [ [Elixir](http://elixir-lang.org/) is a relatively new functional language, which I've taken a deep interest in. I'd like to get general tips about golfing in Elixir and learn techniques that can be applied to code-golf problems that are somewhat specific to Elixir in general. --- *Based on so many simi...
[Question] [ ## Introduction The LaTeX typesetting system uses macros for defining accents. For example, the letter ê is produced by `\hat{e}`. In this challenge, your task is to implement an ASCII version of this functionality. ## Input Your input is a non-empty string of printable ASCII characters. It will not co...
[Question] [ **Revised formatting and instructions** Given a list of moves for a [Cracker Barrel peg board game](http://www.memory-improvement-tips.com/pegs.html), or as @Steveverrill stated, Peg Triangle Solitaire: ``` Game 1 Game 2 Game 3 1: 0 ,-1, -1 C, -1, -1 4, -1, -1 #starting point 2: ...
[Question] [ ## Introduction The number 101 is a palindrome, since it reads the same backwards and forwards. The number 105 is not. However, 105 in base eight is written as 151, which *is* palindromic. On the other hand, 103 is not a palindrome in *any* base from 2 to 101. Hence, 103 is **[strictly non-palindromic]...
[Question] [ Our new bank needs a teller transaction system but there is a problem. There is only a few hundred bytes of space left on our server, so you will have to write very compact code. ## Database Thankfully our database is very simple (it was built by the schoolboy son of our bank president), and we only ha...
[Question] [ # Pigpen Cipher Encryption Your mission is simple: to write a program which receives text as input and outputs an ASCII representation of it in the [Pigpen Cipher](http://en.wikipedia.org/wiki/Pigpen_cipher). ## Input ASCII-only (no Unicode) characters. You must be able to handle at least 16384 charact...
[Question] [ # Objective I have a nice picture that I want to hang on my wall. And I want it to hang there in a spectacular way, so I chose to hang it on `n` nails where `n` is any positive integer. But I'm also indecisive, so if I change my mind, I don't want a lot of trouble taking the picture down. Therefore, re...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 8 years ago. [Improve this quest...
[Question] [ Which values of x and y will cause a crash with some C compilers? ``` int f(int x, int y) { return (y==0) ? 0 : (x/y); } ``` [Answer] -2147483648 (INT\_MIN) and -1 ``` #include <stdio.h> #include <limits.h> int f(int x, int y) { return (y==0) ? 0 : (x/y); } int main() { int r = f(INT_M...
[Question] [ Pretend you have an arbitrary text file (which you may choose). Give the sequence of keystrokes that is most destructive (\*) if it was intended to be inserted to the text, but instead was entered in normal mode (i.e. `i`/`a` was not pressed). You may not enter visual mode and not quit Vim. Destructive...
[Question] [ Dealing with equations in the absence of a good equation editor is messy and unpleasant. For example, if I wanted to express an integral and its solution, it might look something like this: Integral[x^3 e^(-m x^2 b /2), dx] = -((2 + b*m*x^2)/(b^2\*e^((b*m*x^2)/2)\*m^2)) At [integrals.wolfram.com](http:...
[Question] [ You are given an encrypted string, encrypted using a very simple substitution cipher. **Problem** You do not know what the cipher is but you do know the ciphertext is English and that the most frequent letters in English are *etaoinshrdlucmfwypvbgkqjxz* in that order. The only allowed characters are u...
[Question] [ **Party time!** All of your guests are sitting around a round table, but they have very particular seating requirements. Let's write a program to organize them automatically! Guests are represented by letters: Female guests are uppercase, males are lowercase. Couples have the same letter, one lower and...
[Question] [ We already have challenges dealing with simulating vanilla [Conway's Game of Life](https://codegolf.stackexchange.com/q/3434/110698), [Wireworld](https://codegolf.stackexchange.com/q/9292/110698) and [rule 110](https://codegolf.stackexchange.com/q/34505/110698), but so far none corresponding to a ([spe...
[Question] [ During [the 49 days](https://en.wikipedia.org/wiki/Counting_of_the_Omer#Kabbalistic_interpretation) between [Passover](https://en.wikipedia.org/wiki/Passover) and [Pentecost](https://en.wikipedia.org/wiki/Shavuot), Jewish [liturgy](https://shulchanaruchharav.com/halacha/summary-of-laws-counting-the-ome...
[Question] [ ## Introduction: You're a key maker, and want to access something from a safe that has a lock. Unfortunately, the key to that lock is lost, so you'll have to make a new one. You have access to a bunch of [blank keys](https://i.postimg.cc/6p0WbWCj/blank-key.jpg), to which you can add notches to turn it ...
[Question] [ Two Deterministic Finite Automata or [DFAs](https://en.wikipedia.org/wiki/Deterministic_finite_automaton) can be checked to see if they accept same set of strings in polynomial time. See [section 3.3 of this](https://scholarworks.rit.edu/cgi/viewcontent.cgi?article=7944&context=theses) for a long list ...
[Question] [ # The objective Given a string of Hangul syllables, sort the characters in North Korean dictionary order. # Introduction to Hangul syllables Hangul(한글) is the Korean writing system invented by Sejong the Great. Hangul syllables are allocated in Unicode point U+AC00 – U+D7A3. A Hangul syllable consists ...
[Question] [ This question has a similar set up to [Find an array that fits a set of sums](https://codegolf.stackexchange.com/questions/174252/find-an-array-that-fits-a-set-of-sums) although is quite different in its goals. Consider an array `A` of length `n`. The array contains only positive integers. For example ...
[Question] [ Your challenge is to write a program to solve a 3x3x3 [Rubik's Cube](https://en.wikipedia.org/wiki/Rubik%27s_Cube). This challenge is based on [this one](https://codegolf.stackexchange.com/q/10768/61563) from 2013, rewritten to adhere to current [community standards](https://codegolf.meta.stackexchange...
[Question] [ Your challenge is to compute the [Lambert W function](https://en.wikipedia.org/wiki/Lambert_W_function). \$W(x)\$ is defined to be the real value(s) \$y\$ such that $$y = W(x) \text{ if } x = ye^y$$ where \$e = 2.718281828...\$ is [Euler's number](https://en.wikipedia.org/wiki/E_(mathematical_constant)...
[Question] [ I somewhat miss those old demos showing the capabilities of computers when they were called x86 instead of i3, i5 and i7. One of the first I watched in my 386 was the [Unreal demo from Future Crew](https://youtu.be/VjYQeMExIwk) that is now celebrating its 25th anniversary. At [minute 0:43](https://yout...
[Question] [ 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: # # # ### # # ...
[Question] [ [TetraVex](https://en.wikipedia.org/wiki/TetraVex) is a tile-based edge-matching game that was originally coded by Scott Ferguson for the Microsoft Entertainment Pack 3 back in 1990. The game consists of a grid upon which square tiles are placed. The tiles have numbers or letters on each edge, and the ...
[Question] [ I recently read up on graph theory, especially [hypercubes](http://mathworld.wolfram.com/HypercubeGraph.html) and thought about interesting ways to construct paths on them. Here's what I came up with. As you might know, you can construct an n-dimensional hypercube by taking all n-tuples consisting of `...
[Question] [ What general tips do you have for golfing in [D](https://dlang.org)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to D (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] Look, no parens! D's function...
[Question] [ In this challenge, you will write a program to output how many decimal places are in the input *string* and trim the input if needed. ## Examples ``` -12.32 2 32 0 3231.432 3 -34.0 0 -34 023 0 23 00324.230 2 324.23 10 0 00.3 1 0.3 0 0 -04.8330 3 -4.833 ``` ## Rules * Input will be a string which can be...
[Question] [ ## Objective Given input `r` and `n` find the first `n` natural numbers `x` such that if we rotate the first digit to the last place we obtain `x/r`. You may assume that `2 <= r <= 9` and `1 <= n <= 65535`. You may write a program which takes input from stdin or command-line arguments; or you may write...
[Question] [   ![](https://i.stack.imgur.com/eoidS.jpg) **[Project Euler](http://projecteuler.net/)** is another fun programming challenge site to compete (well, play) on. Early problems start off gently, but then explode in difficulty beyond the first hundred or so. The first few problems have some commonality b...
[Question] [ The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! # The Challenge Your challenge is to implement a program that will input a list of numbers and output a box plot of the data, *in as many programming languages as pos...
[Question] [ **This question already has answers here**: [Is it a vampire number?](/questions/218772/is-it-a-vampire-number) (13 answers) Closed 3 years ago. *EDIT:* In the interest of increasing the complexity, i've added more to the challenge. > > In mathematics, a vampire number (or > true vampire numbe...
[Question] [ The task here is simple: given a target location on an XY grid, and a rectangle on that grid, find the length of the shortest path from the origin to the target which does not intersect the rectangle. All parameter values are integers. You can assume that neither the target point nor the origin is insi...
[Question] [ Imagine that there are \$n\$ different types of objects \$O\_1,O\_2,O\_3,\ldots,O\_n\$ and they each have a conversion factor \$k\_1,k\_2,k\_3,\ldots,k\_n\$. You can, for any \$1\le i\le n\$, convert \$k\_i\$ amount of \$O\_i\$ into \$1\$ of any **other** type of object. # Task Your objective is to out...
[Question] [ 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 lis...
[Question] [ Basically the [tron light-cycle game](https://www.youtube.com/watch?v=Vpr5DtZ9_AA) as a king of the hill competition! [![Picture of an online version of the tron light-cycle video game](https://i.stack.imgur.com/R6OLg.jpg)](https://www.youtube.com/watch?v=Vpr5DtZ9_AA) ## Leaderboard **Updated as of 202...
[Question] [ ## The challenge Find the smallest feedforward neural network such that, given any 3-dimensional input vector \$(a,b,c)\$ with integer entries in \$[-10,10]\$, the network outputs the largest (i.e., "most positive") root of the polynomial \$x^3+ax^2+bx+c\$ with error strictly smaller than \$0.1\$. ## A...
[Question] [ The [Blow-up](https://en.wikipedia.org/wiki/Blowing_up) is a powerful tool in algebraic geometry. It allows the removal of *singularities* from *algebraic sets* while preserving the rest of their structure. If you're not familiar with any of that don't worry, the actual computation is not difficult to...
[Question] [ [Paterson's worms](https://en.wikipedia.org/wiki/Paterson%27s_worms) are a kind of cellular automaton that exist on an infinite triangular grid and, every step, they turn in some direction and move one unit. Their defining properties are that they can never go over the same spot twice, and whenever the...
[Question] [ The game of [xiangqi](https://en.wikipedia.org/wiki/Xiangqi), also known as Chinese chess, is a chess-like game popular in China, Vietnam, Taiwan, and other East Asian countries. The colours of the two sides in xiangqi are red and black. There are 16 black pieces in xiangqi: the 1 general (G), 2 adviso...