instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Key Links Dwarf question Chat room Game Controller Interface Troll league table <script src="https://ajfaraday.github.io/Thud/dist/data/tables.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><table> <thead> <tr> <th>Client</th> <th>Wins</th><th>Loses</th> <th>Sc...
stackexchange_codegolf
My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button...
stackexchange_codegolf
Challenge Imagine a hexagonal grid as shown below. Let's call such a grid has size \$n\$ if it has \$n\$ dots on one side. The following is one of size 3: - - - - - - - - - - - - - - - - - - - Then, pick as many dots as possible on the grid so that no two dots are adjacent. For size 3, the maximum is 7 dots: -...
stackexchange_codegolf
What you need to do is create a Boolean parser. Boolean expressions, in case you haven't heard of them yet, have two inputs and one output. There are four 'gates' in boolean arithmetic, namely OR (represented by |), AND (represented by &), NOT (which are used a bit like brackets : / and \ note, I could have used !, bu...
stackexchange_codegolf
I could not think of a better title. This is a tips question. I'm asking for tips on golfing my code. I recently took part in a code golf competition in C. The competition ended and I lost. The problem is: Input a line with a number n. Then input n lines, each line contains only a set of cards in descending order, e. ...
stackexchange_codegolf
Task Your task is to take a character in: AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz and turn it into a characters in: AAAAABCCDEEEFGHIIJKLMNOOOOPQRSTUUVWXYZaaaaabccdeeefghiijklmnoooopqrstuuvwxyz by the obvious operation: dropping the accents in the letters. Input A character in any se...
stackexchange_codegolf
In many image-processing challenges, the post contains images, which must be saved to a file in order to be able to work on the problem. This is an especially tedious manual task. We programmers should not have to be subjected to such drudgery. Your task is to automatically download all the images contained in a Code ...
stackexchange_codegolf
Print, on STDOUT, a pattern which shows in what direction a bouncing ball will take. The following assumptions are made: The ball starts at the top left corner: 0, 0 with zero initial velocity. Gravity is 9.8ms^-2 exactly, towards the floor (y positive.) The ball weighs 500g exactly. The ball bounces at 45 or 135 deg...
stackexchange_codegolf
Given integers 0<x<10106 and 0<n<106, work out x(1/n) under 15 seconds(TIO or your computer), 1GB memory. You can assume the result is integer smaller than 50000. Shortest code in bytes in each language win. Sample: x n result 121 2 11 123 1 123 1024 10 2 A larger sample can be seen here
stackexchange_codegolf
Given a textual representation (case-insensitive full name or 3 character abbreviation) of a month return the number of days in the month. For example, december, DEC, and dec should all return 31. February can have either 28 or 29 days. Assume the input is a month in one of the correct forms.
stackexchange_codegolf
Sometimes it is useful to run a math problem with multiple inputs. The goal of this challenge is to make a program that eases this task. Number-generating expressions You must support 3 types of expression: Single number generator: Very simple, just a literal number Multi-number generator: A tad more complicated. Thee...
stackexchange_codegolf
Having a function f that takes arguments x1, x2, …, xn                                                – ie.  f : X1 × X2 × … × Xn → Y – currying redefines f as a function taking a single argument a1 which maps to yet another function. This technique is useful for partial application, for example with a curried pow func...
stackexchange_codegolf
Introduction The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle. It first starts like this: _ / \ Then, each line is replaced with a rotated version of the first one: _ / \ \ / _/ \_ Next: _ / \ \ / _/ \_ / \ \_ _/ _ \ / _ / \_/ \_/ \ Your task Given a ...
stackexchange_codegolf
Your very own "for" instruction Assuming you have the following input : a, b, c, d Input can be in one-line using any format "a/b/c/d" or "a,b,c,d" etc.. You can also have 4 inputs. You must code the following behaviour (pseudo-code here) : var i = <a> while (i <b> <c>) print i i = i + <d> print "\n" Here ...
stackexchange_codegolf
This is the robbers' post. The cops' is here. Your challenge is to take a cop's post and find an input that the regex matches but the program returns a falsey value. Once you have cracked a cop's post, comment in a link to your crack. (If you don't have enough rep to comment, please say so, and someone will do it for y...
stackexchange_codegolf
...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order. From Wikipedia. Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed t...
stackexchange_codegolf
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-topright; bottomright-t...
stackexchange_codegolf
Write a program that takes a United States aircraft registration number and returns a 24-bit ICAO hex code corresponding to that registration and vice-versa. An aircraft registration number always begins with an N and is followed by 1 to 5 characters: 1 to 5 digits and then 0 to 2 uppercase letters. That is, one of the...
stackexchange_codegolf
This challenge takes place on the snub square tiling. Start by choosing any triangle, and color it \$c_1\$. Next, find all tiles which touch this triangle at any vertex, and color them \$c_2\$. Next, find all tiles which share a vertex with any \$c_2\$-colored tile, and color these \$c_3\$. Continue this process ad inf...
stackexchange_codegolf
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. ...
stackexchange_codegolf
proposed by @Adám in chat Given an even number of finite points return a line \$y=mx+b\$ that evenly splits the points on both sides. Specs Take a list of distinct points \$(x,y)\$ (or a list of x-coordinates and a list of y-coordinates), output a possible \$(m,b)\$ pair Half of the points should be true for \$y>mx+b\...
stackexchange_codegolf
Introduction Let's take the number 180. This is an interesting number because the sum of digits of this number is equal to: 1 + 8 + 0 = 9 And the squared version of this number, or: 180² = 32400 > 3 + 2 + 4 + 0 + 0 = 9 These are both 9. The sum of digits of the original number and the squared number are the same. Of ...
stackexchange_codegolf
Given a number \$n\$, write a program that finds the smallest base \$b ≥ 2\$ such that \$n\$ is a palindrome in base \$b\$. For example, an input of \$28\$ should return the base \$3\$ since \$28_{10} = 1001_3\$. Although \$93\$ is a palindrome in both base \$2\$ and base \$5\$, the output should be \$2\$ since \$2<5\$...
stackexchange_codegolf
The winner (pretty obviously) is Dennis ♦, who used Jelly with 10 bytes! This challenge will still be up here, however results won't be taken anymore. The powertrain of a number is a concept by John Conway (who is also notable for making Conway's Game of Life, but that's not the point). It is defined as so: For any nu...
stackexchange_codegolf
Introduction In geometry, the Peano curve is the first example of a space-filling curve to be discovered, by Giuseppe Peano in 1890. Peano's curve is a surjective, continuous function from the unit interval onto the unit square, however it is not injective. Peano was motivated by an earlier result of Georg Cantor that ...
stackexchange_codegolf
Related puzzle: Pathfinder (available on Puzzle Picnic) Background A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The robot can move to a horizontally or vertically adjacent cell in one step, and it picks up one gem from the cell it steps on....
stackexchange_codegolf
zipwith is a functional construct that takes three arguments: one binary function and two lists of the same length, and returns a single list where each element is constructed by applying the binary function to each pair of elements from the two lists: zipwith (a+b) [1,2,3] [4,5,6] = [5,7,9] You are to take a black-bo...
stackexchange_codegolf
This is an easy one. Anagrams are words which have the same characters but in different order. All you have to do is to figure out if two strings are anagram or not. Rules: Take two strings as a function argument, command-line argument or from standard input. Write a function or program which returns truthy value if s...
stackexchange_codegolf
Given a date, output the X and Y position of the current day of the date on a digital calendar. The digital calendar is sort of the calendar that gets shown when you click on your computers clock (at least on windows), and it looks something like this: If we assume that the given date is 25.09.2017, the result would b...
stackexchange_codegolf
Bibi-binary is a numeric system invented by Boby Lapointe in order to represent numbers in letters which pronunciation seems funny. Your task is to convert decimal numbers into Bibi-binary! Conversion A number is converted to base 16 (hexadecimal) and each character is replaced by its Bibi-binary name: 0 = HO 1 = HA 2 ...
stackexchange_codegolf
Challenge In this simple challenge, you have to print the public IP address of google.com. Rules You have to output either the IPv6 or IPv4 address, and do it by somehow using internet. Output does not strictly need to be the IP address, your answer will be valid if the correct IP address is somewhere in the output, ...
stackexchange_codegolf
Sandbox Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a. Examples Definitions: true = is a multiple of b, false = is not a multiple of b. f(1,3) = 3 because 1 is false, 1+1 is false, but 1+1+1 is true. Therefore 3 is returned. f(5,3) = 6 because 5 is false, but...
stackexchange_codegolf
;# is a very simple language. It has 2 commands: ; will increment the accumulator # outputs the accumulator modulo 127, and then resets the accumulator ;$ is also very simple and is very similar (and also does not yet exist). It has 2 commands: ; will increment the accumulator $ outputs the accumulator modulo 127. H...
stackexchange_codegolf
Rules Given an ISO3166-1-Alpha-2 country code your task is to decide on the traffic direction for that country: Input will be a valid country code (valid as in it's an element of the two lists provided) Input may be a list of two characters instead of a string if it helps You may choose to take input in lowercase You ...
stackexchange_codegolf
Intro So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are? Left-most what? A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes int...
stackexchange_codegolf
I decided to learn J so that I could better take part in code golfing. Starting it off relatively simple, I tried writing a solution to this problem: Find the sum of all the multiples of 3 or 5 below 1000. After a bit of tinkering, I came up with the following J code that solves it: x=:i.1000 +/x#(0=3|x)+.0=5|x Basi...
stackexchange_codegolf
Your task is to generate a random digit following these steps: First, generate 10 random digits to make a binary number, 50% 0, and 50% 1: 010011001 If it is all zeros, generate a new one. Convert this to decimal: 153 For each digit, write that amount of alternating 0s and 1s (first digit = 1s, second digit = 0s, thi...
stackexchange_codegolf
Rotonyms 1 ROT13 ("rotate by 13 places") is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. So, A becomes N, N becomes A, B <-> O, and so on to M <-> Z. ROT13('abcdefghijklmnopqrstuvwxyz') == 'nopqrstuvwxyzabcdefghijklm' A "Rotonym" is a word (pair) that ROT...
stackexchange_codegolf
Last challenge (Pixel-art, episode 1: display Super Mario) was just a training... (and you completed it in amazing ways, thanks!) This time, you have to work a little bit more. You have to display all the first overworld map of Super Mario bros on NES, without enemies, and without Mario. Your program or function must d...
stackexchange_codegolf
You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called...
stackexchange_codegolf
In Conway's Game of Life, a cell is in a state of either on or off, depending on the on-and-off state of the eight cells surrounding it. We can simulate this using a logic gate network with some sort of clock signal that updates every cell all at once. Your task in this problem is to build the logic gate network for a ...
stackexchange_codegolf
Lots of people like to play music for fun and entertainment. Unfortunately, music is pretty difficult sometimes. That is why you're here! Task It's your job to make reading music much easier for those struggling with it. You need to write a program or function that takes as input a musical staff, and outputs the names ...
stackexchange_codegolf
Context After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking you to compute a specific coefficient from polynomial division. Polynomial division Let us establish an analogy with inte...
stackexchange_codegolf
As the title says, given a valid chess move in algebraic notation, produce the string describing the move. Example: fxg8=Q+ -> Pawn takes g8 promotes to Queen check Bb7# -> Bishop to b7 mate Here is a list of all the keywords and their respective notation R -> Rook x -> takes N -> Knight ...
stackexchange_codegolf
Background Skip to "Task" if you are familiar with Tic-Tac-Toe (I think most are!) Tic-Tac-Toe is a famous two-player game. It consists of a 3x3 board that is filled gradually by two players (clarifications below); The first player uses the character X and the other one uses O. The winner is the first to get 3 consecut...
stackexchange_codegolf
Your task Take a list of strings as the input, and output the maximum average ord. Example Given the list ['hello', 'world', 'bye']: The average ord of 'hello' is: (ord(h) + ord(e) + ord(l) + ord(l) + ord(o)) / len('hello') = 106.4 The average ord of 'world' = 110.4 The average ord of 'bye' = 106.7 The maximum ave...
stackexchange_codegolf
I don't know about you all but I'm not preparing for Halloween––never did never will––but, my neighbor is, so we'll help her out. She needs help figuring out which brand of candy she has, but she has so much candy she would not be able to finish before Halloween. She has: Snickers KitKat Starburst GummyBears Twix Inp...
stackexchange_codegolf
Draw this Ascii coffee cup: o o o __________ / \__ | J | \ | A | | | V | | | A |__/ \__________/ Brownie points for coffee-script or java :) Shortest code in bytes, function or program, trailing newline or white space is acceptable, drink up!
stackexchange_codegolf
We don't have enough (semi-)easy challenges for beginners. More and more of the easy ones are already taken. So I tried to come up with something that might be achievable by beginners, but that isn't a duplicate. Input: A single string separated with your OS new-line (i.e. \r\n), or an array with multiple strings. Outp...
stackexchange_codegolf
A company is arranged in a heirarchical structure, with a layer of workers at the bottom. Each worker is managed by a manager. Consequently, each manager is managed by another manager until there is a company "boss". Each manager is restricted to managing, at most, x workers. For a company of size y calculate the numbe...
stackexchange_codegolf
The spoak laugh For those who don't know, in Brazil some people laugh on chats like this: aposkpaoskaposkaposkpaokspaoskpaoksa. So here is the challenge: To make a program that generate this laugh in a natural way. How to produce this laugh programatticaly? When you laugh like this, you use one hand on the (a, s) part ...
stackexchange_codegolf
You're looking at an avenue, and someone has left the trash out! You need to write a program to help fix the problem, by putting the trash into trashcans. The task The avenue is made up of a string of printable ASCII characters, e.g.: [[](dust)[]] car ((paper)vomit) (broken(glass)) [[] (rotten) fence (dirty) Some of t...
stackexchange_codegolf
* and don't have a word processor with top-left align support :D Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be taken as a space-padded matrix of characters. Squash it upwards, then squash it left. Output this, with any amount of trail...
stackexchange_codegolf
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...
stackexchange_codegolf
This isn't as much a "challenge" as "a unique problem that there are no built-in functions to solve." Basically, you need to do this: Read some lines of numbers from stdin. These lines may contain trailing or preceding whitespace, and there may be empty lines. No lines will contain "just whitespace" other than a newli...
stackexchange_codegolf
Computers like binary. Humans like base 10. Assuming users are humans, why not find the best of both worlds? Your task is to find the first n terms in the sequence A008559 where each term is the binary representation of the previous number interpreted as a base 10 number. Input An integer greater than 0. Note that the ...
stackexchange_codegolf
Taking in Input Define a function f as follows: IF x < 0: f(x) = -√|x| ELSE: f(x) = √x In your programs/functions, each point (x, y) given as input will correspond to the point (f(x), f(y)). For example, if the points (4, -2) and (-1, 5) are given as input, your program will be dealing with the points (2, -√2)...
stackexchange_codegolf
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically. This is a code-golf challenge so shortest code wins! Input A single line containing values l and h, representing the length and heigh...
stackexchange_codegolf
I have encountered this type of puzzle, that usually involves apples, several times. It goes as follows: There is a certain number of apples in a basket. Ava takes a third of the apples. Bob takes a quarter of the apples that are left. Finally, Dennis takes one-sixth of the apples left. In the end, there are 10 leftov...
stackexchange_codegolf
You are an evil wizard, doing evil wizard business, when suddenly your crystal ball alerts you of a hero on their way to defeat you. To crush their hopes and dreams, you decide to trap the hero in a maze. You could just make a big maze but where would be the fun in that? Instead, you decide you want to make the maze as...
stackexchange_codegolf
Your program has to have an year like 1957 to be the input and then output the century of that year. For example: In: 1946 Out: 20 In: 1705 Out: 18 In: 1900 Out: 19 In: 100 Out: 1 In: 2001 Out 21 because 1946 is in the 20th century. Keep in mind that 2000 should be 20th century or 1900 should be in 19th century. There...
stackexchange_codegolf
Imagine you have two boxes B(x) and B(y), each containing an unknown bit - 0 or 1, and a machine F that can X-ray them and produce a third box for B(x^y) (xor). F can also compute B(x*y) (and). In fact, those are just special cases of the the single operation the machine can perform - inner product each, denoted with F...
stackexchange_codegolf
Related: Read a crossword Task Given a completed Crossword puzzle, extract the words in it with their respective clue numbers, with "across" (horizontal) and "down" (vertical) words grouped and ordered like a real crossword puzzle. The words are numbered in the row-major order of their first letters. If an "across" wor...
stackexchange_codegolf
It's all in the title... Take as input a positive integer n>=12 and... do what the title says. Yes, this is on OEIS A187924. Some test cases 12 -> 912 13 -> 11713 14 -> 6314 15 -> 915 16 -> 3616 17 -> 15317 18 -> 918 19 -> 17119 20 -> 9920 40 -> 1999840 100-> 99999999999100 This is code-golf. Short...
stackexchange_codegolf
The partition function: In number theory, the partition function p(n) represents the number of possible partitions of a positive integer n into positive integers For instance, p(4) = 5 because the integer 4 has five possible partitions: 1 + 1 + 1 + 1 1 + 1 + 2 1 + 3 2 + 2 4 Your task: Accept an input (let's call i...
stackexchange_codegolf
The problem has 3 inputs. L: a list of all numbers size: the size each set can be max: the max sum amongst each set The challenge is as follows: Given L, size and max, construct as many sets from L such that the number of elements is size and the sum of each of the elements does not exceed max. Examples: func(L=[1,2,3,...
stackexchange_codegolf
Fairy Chess is a sort of generalized chess that allows unconventional pieces. The eight queens puzzle is a classic problem where you have to put 8 queens on a chess board such that no two queens threaten each other. This challenge is sort of a generalized combination of the two. Challenge Given a list of fairy chess pi...
stackexchange_codegolf
From Quine central: Write a quine that takes as input the name of a language and outputs the same thing implemented in the input language. The source article has something you can work from, but as the author says this is much harder. Obviously you only need to support a limited set of languages. The choice is yours th...
stackexchange_codegolf
Create a bot to choose the smallest unique number. (Based on a psychology experiment I heard about many years ago but haven't been able to track down again.) Rules Each game will consist of 10 randomly selected bots playing 1000 rounds. Each round, all bots select an integer from 1 to 10 (inclusive). Any bots that ch...
stackexchange_codegolf
Here's a simple challenge, so hopefully lots of languages will be able to participate. Given a positive integer \$n\$, output \$A076039(n)\$ from the OEIS. That is, start with \$a(1)=1\$. Then for \$n>1\$: $$a(n)=\left\{ \begin{array}{ll} n\cdot a(n-1), & \text{if } n>a(n-1) \\ \lfloor a(n-1)/n \rfloor, & \text{otherw...
stackexchange_codegolf
Tomorrow, November 23rd, is Thanksgiving Day in the United States. To prepare, you need to cook up some ASCII turkeys. However, since you're late in planning, you need a program (or function) to help you with how many birds you need to prepare. .---. _ .' './ ) / _ _/ /\ =(_____) (__/_/== ======...
stackexchange_codegolf
Plot contrivance You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991. You check the computer that you keep on the desk to see what time it is, but alas the positron interference from your quantum undetangler has fr...
stackexchange_codegolf
Here's yet another Steenrod algebra question. Summary of the algorithm: I have a procedure that replaces a list of positive integers with a list of lists of positive integers. You need to repeatedly map this procedure over a list of lists and flatten the output until you reach a fixed point. Then for each sublist, if i...
stackexchange_codegolf
Given two positive integers \$n\$ and \$b\$, such that \$n > 2\$ and \$n > b > 1\$, count the trailing zeros when converting \$n\$ to base \$b\$. Your program should be able to handle any value of \$b\$ within your integer maximum. The digits of \$n = 18\$, \$b = 3\$ are \$[2,0,0]\$, so the correct output is \$2\$. T...
stackexchange_codegolf
I don't like strings with more than three vowels in a row. Can you write a program that removes all the vowels I don't want from words? You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest altern...
stackexchange_codegolf
I like anagrams. I like programs that reference their own source code. So this challenge combines them! Input. The input to the program could be anything, including letters, numbers, symbols, you name it. Output. A truthy value if the input's characters can be rearranged to give the source code, and a falsy value if th...
stackexchange_codegolf
What general tips do you have for golfing in 1+? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to 1+ (e.g. "remove unnecessary whitespace" is not an answer). Please post one tip per answer.
stackexchange_codegolf
This is a challenge to write bots to play the 1st and 2nd players in the following simple poker game. Rules of the poker game There are two players, A and B. Each antes $10 into the pot, and is dealt a card, which is a real number in the range [0, 1). Player A goes first, and may pass or bet. If A passes, then there is...
stackexchange_codegolf
Do you love watching cool timelapses of constructions or other massive work done in minutes? Lets make one here. We will be looking at an excavator digging quarry, making pictures each day to see whole progress. And your task is to show us this process! Quarry is defined by the width of its first layer. Excavator is de...
stackexchange_codegolf
Specifications Given a number n, output an ASCII "meme arrow" (greater-than symbol, >) of size n. n will always be a positive integer, greater than 0. Examples n = 2 \ \ / / n = 5 \ \ \ \ \ / / / / / Sample code Here is a sample program, written in Crystal, that returns the correct results. Run...
stackexchange_codegolf
Oops, Auto-correct. You have a word. But it's wrong. You wonder what word it would be. Thankfully, being a code golfer, You can make a code to take a rough guess. I/O You will be given a (wrong, all lowercase) word, and a '(All lowercase)Dictionary list'. You have to output the word with the least Levenshtein distanc...
stackexchange_codegolf
The event scheduler is a recurrent theme in event-driven architectures: something triggers an event that needs to be checked in the future one or more times. I has particular use in trading where you want to correlate one market event with price movements in the future at several time deltas (1ms, 100ms, 1s, 1 min, etc...
stackexchange_codegolf
Concept In what ways can you scramble the English alphabet so that it can still be sung to the tune Twinkle Twinkle Little Star without ruining the tune? Rules Swapping Let's just assume the letters contained in each of the following sets can be swapped freely by default without ruining the tune: { A, J, K } { B, C, ...
stackexchange_codegolf
It's a funny accident that this world happens to have just 1 time dimension, but it doesn't have to be like that. It's easy to imagine worlds with 2 or more time dimensions, and in those worlds you could build computers and run software on them, just like in this one. The System Here is a system for running Brainf*ck p...
stackexchange_codegolf
[This is a partner question to Calculate a probability exactly ] This task is about writing code to compute a probability exactly and quickly. The output should be a precise probability written as a fraction in its most reduced form. That is it should never output 4/8 but rather 1/2. For some positive integer n, consid...
stackexchange_codegolf
An angry bird is shot at an angle \$β\$ to the horizontal at a speed \$u\$. The ground is steep, inclined at an angle \$α\$. Find the horizontal distance \$q\$ that the bird traveled before it hit the ground. Make a function \$f(α, β, u)\$ that returns the length \$q\$: the horizontal distance that the bird traveled b...
stackexchange_codegolf
Chameleon challenges are a bad thing, apparently. Too bad, chameleons are beautiful creatures. Time for a change! As we all know, many chameleons posses a remarkable ability to blend in with their surroundings by changing the color of their skin. Which is also the objective of this challenge. Challenge Imagine a squar...
stackexchange_codegolf
You are to create a program that creates exact clones of itself infinitely until stopped. Whatever is in the original program must be in the clones. In other words, the clones and original program are the same in every way except for that the clones don't have to be in the same type of file as the source code (they can...
stackexchange_codegolf
Your task is to take a positive number as input, n, and output the length of the longest rep-digit representation of n in any base. For example 7 can be represented as any of the following 111_2 21_3 13_4 12_5 11_6 10_7 7_8 The rep-digits are 111_2 and 11_6, 111_2 is longer so our answer is 3. This is a code-golf ques...
stackexchange_codegolf
I started a CodeWars kata in Python, just two days ago, related to code golf. Task: Given two congruent circles a and b of radius r, return the area of their intersection rounded down to the nearest integer, in less than 128 chars. Has to be a one-liner. Version: Python 3.6 External libraries: You may import NumPy as ...
stackexchange_codegolf
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 exa\\m/ple''' r"""this 'is' ...
stackexchange_codegolf
You have your very heavy cubical box on a flat floor at position (0,0). All you can do with it is roll it in four cardinal directions (east, north, west, south). Your task is to bring it to a target position, such that the side facing up is the same as before your manipulations. Make a program or function which receive...
stackexchange_codegolf
Challenge For a given positive integers range, find the first and last prime number entirely composed of prime number digits, exceptionally including 0 (for the digits, a range of 0-2 should output 2-2). The range is inclusive. If no number is found, the expected output is 0. If there is only one such number, the expec...
stackexchange_codegolf
I don't like curry. Help me reverse the effects of this evil question - Make me some curry - by uncurrying functions. Task Given a blackbox curried function, output its uncurried equivalent. The curried function will take a single argument and output either another curried function or a value of another type. The uncu...
stackexchange_codegolf
Skat I'm a fan of anagrams, so given two strings s1 and s2 write a program or function that outputs a truthy value if s2 is an anagram of s1, and a falsey value otherwise (not accounting for spaces and capital letters). For example: Input: s1 = "Anagram"; s2 = "Nag a ram" true Input: s1 = "stack overflow"; s2 = "fewe...
stackexchange_codegolf
I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question Introduction Your challenge today is to output the lyrics of "99 bottles of beer": 99 bottles of beer on the wall, 99 bottles of beer. Take one down...
stackexchange_codegolf
Step one In a new google sheet insert an image into cell A1 with Insert > Image > Image In Cell Step two Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing) Rules Only vanilla formulas are allowed. The shortest code in bytes wins.
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. While other Elves are busy carrying air blowers, Fen comes and shouts, "I've got a spell for this job!" To recap, a chimney is modeled as a rectangular grid. The number in each cell represents the amount of smoke in the region. The lef...
stackexchange_codegolf
Introduction Write a program to output the outgoing spiral of the famous pangram following given rules. Challenge A pangram is a sentence using every letter of a given alphabet at least once. One of the most famous pangrams is the one used extensively in Windows font viewer, namely "The quick brown fox jumps over the l...
stackexchange_codegolf
ProSet is a classic card game that is played normally with 63 cards. One card has 6 colored dots on it, like below The rest of the cards are missing some of these 6 dots, but each card has at least 1 dot. Every card in the deck is different. Below are some example valid cards. A ProSet is a nonempty set of cards such...
stackexchange_codegolf