instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Given a PPCG user's user ID, calculate how much times is their Each SE site reputation is from average reputation in the Stack exchange sites they have made accounts. Let me explain, If someone's total network reputation (Total reputation in the stack exchange sites he has participated) is 10k, and if he has participat...
stackexchange_codegolf
Here's a relatively simple challenge for you: Given a list of positive integers: Line them up in a grid, and sum each column. For example, if the input was [123, 7, 49, 681], the grid would look like this: 1 2 3 7 4 9 6 8 1 And the sum of each column would be [18, 19, 4]: 1 2 3 7 4 9 6 8 1 --...
stackexchange_codegolf
Challenge: Input: You take two inputs: - A string only containing printable ASCII (excluding spaces, tabs or new-lines) - A printable ASCII character Output: The first line will contain the string-input. Every i-modulo-3 first occurrence of this character will move in a South-East direction; every i-modulo-3 second occ...
stackexchange_codegolf
Can you decrypt me? Robbers Find any combination of \$n\$ working chars to change and what they should change into, where \$n\$ is chosen by the cop. You cannot change less than n chars, only exactly \$n\$. Example print(2) N is 1. Robbers' post: print(1) Scoring For the robbers, the user with the most cracks wins. ...
stackexchange_codegolf
Given two integers, s and e, print the title of Black Mirror series #s episode #e. Expected output is as below, case sensitive. Output for blank cells and invalid inputs is unspecified. e↓s→ 1 2 3 4 5 ...
stackexchange_codegolf
Goal Given a non-negative integer, create a function that returns the starting position of number of largest consecutive 1's in that integer's binary value. When given an input 0, return 0. If the number has multiple streaks of equal length, you must return the position of the last streak. Input An integer greater than...
stackexchange_codegolf
How can I shorten: p=gets.to_i a=gets b=gets.to_i If my input is an integer, followed by a string, followed by an integer?
stackexchange_codegolf
For this challenge you need to make a given word by concatenating "pieces" (a.k.a contiguous substrings) from other words. Given a word and a list of words as input, output the fewest number of pieces needed to create the first word. Rules Words consist of characters in the ASCII range 33 to 126. The word list may ha...
stackexchange_codegolf
Cops' Thread Your challenge is to find an uncracked, unsafe cop on the cops thread, and find an input value for which their code does not do as specified by the challenge. You must use values within the bounds specified by the cop and the challenge - if a float breaks their program but they specified integers only, it...
stackexchange_codegolf
My stovetop has 10 (0 through 9) different settings of heat and a very odd way of cycling through them. It always starts at 0 When I hit plus it increments the number, unless the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9. When I hit minus it decrements the number, unless t...
stackexchange_codegolf
Here is an easy-intermediate challenge for anyone interested! What is that? A thing me and brother do a bit too often is this: One of us has a problem and asks the other to explain how to do certain stuff. The other just says the following carelessly: How to <verb> in <n> easy steps! ...
stackexchange_codegolf
The Reuleaux triangle is the shape formed by the intersection of three circles, with each circle passing through the others' centers. Regardless of rotation, a Reuleaux triangle's width will always equal the radius of the circles: Image: Wolfram MathWorld Write a program that takes a width r as input and displays a Re...
stackexchange_codegolf
There's a little-known secret in Banjo-Kazooie that you can interleave the three Cheato codes on the Treasure Trove Cove Sandcastle floor and it will still recognize all of them. So you could, for instance, enter BLUREEGOLDDFFEEGEAATHTHEEGSRSRS, activating BLUEEGGS, REDFEATHERS, and GOLDFEATHERS all at once. Challenge ...
stackexchange_codegolf
The goal of radiation hardening is to make a program still work after you remove a byte. However, what if a skilled competitor is purposefully trying to mess with you? In this game, each bot will take turns removing one character from the next bot down the line. If the bot fails to produce valid output next turn you ga...
stackexchange_codegolf
I'm not even sure if this is even possible, but I think it's worth a shot. The Challenge Code/conceptualize a pseudo-random number generator that has the potential to produce results evenly spaced out with similar frequencies... with a twist. The random number generator has to 'loop' back after Foo iterations to its be...
stackexchange_codegolf
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this challenge, the Fibonacci numbers are the sequence \$F_n\$ defined as \$F_1 = 1\$, \$F_2 = 1\$, and \$F_n = F_{n-1} + F_{n-2}\...
stackexchange_codegolf
A few hours earlier, I got this puzzle: Suppose, you toss a coin n times, then what is the probability of getting m number of heads? ( where m belongs to the set of all prime numbers) For instance, take n = 2, then SS = { HH, HT, TH, TT } So, output is 1/4 (for HH case) Then, for n = 3, SS = { HHH, HHT, HTH, THH, HTT...
stackexchange_codegolf
Challenge Create a program that outputs a square grid showing visible and non-visible points \$(x, y)\$ from the origin based on their greatest common divisor (GCD). A point \$(x, y)\$ is considered visible from the origin \$(0, 0)\$ if the \$\gcd(x, y) = 1\$. Otherwise, it's non-visible. Input An integer \$n\$, repre...
stackexchange_codegolf
Pickleball doubles is a game where only the serving side can score. The server calls the score as a triple of numbers, the serving side's score, the receiving side's score, and \$1\$ or \$2\$ to indicate whether the server is the first or second of their side to serve. If the server's side wins a point, their score i...
stackexchange_codegolf
Rules No cell range references (A2:B3). Maximum 9 rows and 9 columns. No circular references or formula errors. Empty cells evaluate to 0. Data are numbers only, but may be taken as strings. Formulas are strings. Implementation choices You must state your choices in these matters: Require formulas to be prefix...
stackexchange_codegolf
It's 2050, and people have decided to write numbers in a new way. They want less to memorize, and number to be able to be written quicker. For every place value(ones, tens, hundreds, etc.) the number is written with the number in that place, a hyphen, and the place value name. "zero" and it's place value does not need ...
stackexchange_codegolf
We already have a challenge for computing the GCD of two Gaussian integers, but that challenge explicitly allows to choose any of the four possible values. Your task now is to bring the Gaussian integer computed by the GCD in the following normal form: The result differs from the original number by a factor of 1,i,-1 ...
stackexchange_codegolf
I hope this picture looks familiar to you. It's one of Pacman's ghosts in his "vulnerable" state, after Pacman has eaten a power pill. The challenge Picture our ghost in a little frame, using ASCII art. At normal scale (more about this later), each square in the above image should correspond to one character, and the ...
stackexchange_codegolf
Given two strings of letters, transfer the capitalization pattern of each string onto the other one. Fewest bytes wins. Input: CodeGolf xxPPCGxx Output: coDEGOlf XxppCgxx Both strings will be equal-length and nonempty, with only letters a..z and A..Z. You may output the two resulting strings in either order rel...
stackexchange_codegolf
Write an indefinitely-running program that reports how many instances of itself are currently running. Each instance of the program should also report the order in which it was opened out of all other currently-running instances. Example The user launches the program for the first time - we'll call this Instance 1. Ins...
stackexchange_codegolf
Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program. The Fibonacci Sequence is the well known sequence F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2) Write a program that takes some input n and outputs the nth fibonacci number in qui...
stackexchange_codegolf
Challenge Let's have a list L of n elements. The task is to swap every two elements in this list. Constrains the list L has at least two elements size of the list L is a multiple of two (i.e. number of elements is even) Example input: [1,2,3,4,5,6] output: [2,1,4,3,6,5] input: [0,1,0,1] output: [1,0,1,0] Rules ...
stackexchange_codegolf
You may know the game The Six Degrees of Kevin Bacon, based on the conjecture that every actor in Hollywood can be connected to Kevin Bacon by no more than 6 "co-star" relations, so Kevin Bacon is supposedly the "best-connected" node in that graph. Your task will be to find the Kevin Bacon of a graph. We will use posit...
stackexchange_codegolf
Task FizzBuzz, but instead of 3 and 5, you'll take the numbers and corresponding strings as input. You can assume all inputted numbers are coprime (and \$\ge 2\$). You'll receive one or more numbers, and a string to print with each of them. The normal FizzBuzz would be something like [[3, "Fizz"], [5, "Buzz"]], but you...
stackexchange_codegolf
Goal Write a function or a program that when given a string, for example "The quick brown fox jumps over the lazy dog", outputs: T h e q u i e r t h e c v k o l a b s z r p y o m g o d w u n ...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. You successfully route the laser into the sensor, but nothing happens. "What?" Frustrated, you flip the note from Santa. There's some more text: Calculate the number of ways to complete the laser puzzle, and enter it into the number p...
stackexchange_codegolf
Air balloons need a gas that is lighter than air. However, hydrogen is flammable, while helium is not sustainable, so we need a replacement! You must write code that determines whether any given gas is lighter than air. Input: a molecular chemical formula of a gas (ASCII) Output: true if the gas is lighter than air; f...
stackexchange_codegolf
Greetings, noble code golfers. Today you will resolve the most ancient and distinguished of debates - Emacs or Vim? Your challenge is to take two search terms as input, and output which of those terms has the most Google search results. (This is obviously completely fair. What do you mean, biased?) Here are some exampl...
stackexchange_codegolf
The "prime frog" is a strange animal that jumps between integers, until it arrives on 3 or 19... Your program should accept an integer n as input and output the result of the below algorithm (3 or 19). For a given integer n >= 2: Let f be the position of the frog. It is initially set to n if f = 3 or f = 19 : the fro...
stackexchange_codegolf
In set theory, the natural numbers \$\mathbb{N} = \{0, 1, 2, 3, ...\}\$ are usually encoded as pure sets, that is sets which only contain the empty set or other sets that are pure. However, not all pure sets represent natural numbers. This challenge is about deciding whether a given pure set represents an encoding of n...
stackexchange_codegolf
Knight is the Language of the Month for August 2022, and I noticed that it didn't have a tips page, so here it is! I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Knight (e.g. "remove comments" is not an answer). Please post only one tip per answer.
stackexchange_codegolf
A Web Crawler is a program that starts with a small list of websites and gets the source code for all of them. It then finds all the links in those source codes, gets the website it links to then puts them in a list. It then starts again but with the new list of websites.The main reason for a Web Crawler is to find all...
stackexchange_codegolf
Your task here is to write an AI for a simple robot battle. The class to be implemented is provided at the bottom of this post, and source of the controller can be found here. Requirements Write a class which implements the abstract Bot class, provided at the bottom of this post You must provide a 0-argument construct...
stackexchange_codegolf
In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in such a way that another program can uncompress and then run the code. A good caddie will compress golfed code to be much s...
stackexchange_codegolf
Related to, but not a duplicate of, this challenge. Basics This is a clock: ****** ** | ** ** | ** * | * * | * * | * * | * * | * * ...
stackexchange_codegolf
Problem statement Pólya is playing about with his urn again and he wants you to help him calculate some probabilities. In this urn experiment Pólya has an urn which initially contains 1 red and 1 blue bead. For every iteration, he reaches in and retrieves a bead, then inspects the colour and places the bead back in the...
stackexchange_codegolf
What am I? As a plant cell, your program/function/etc. must undergo photosynthesis: When the input is 6CO2+6H2O+light in any order, output C6H12O6+6O2 in any order. It does not have to be the same for each arrangement of the input. When the input is just r, replicate (i.e. output your own code). quine rules apply. Whe...
stackexchange_codegolf
The challenge is to golf a program that checks if a statement of propositional calculus/logic is a logical tautology (i.e. it is true for all possible values of the variables). Input Input formulas will use P, P', P'' ect. as variables. They can either be true or false. (P and P') means both P and P' are true. (P or P'...
stackexchange_codegolf
Write an \$n\$-bytes program \$AB\$ such that: it outputs an integer \$x,\ 0\lt x\lt n\$; both its \$x\$-byte prefix \$A\$ and \$(n-x)\$-byte suffix \$B\$, when run as programs, output \$AB\$. \$A, B\$ and \$AB\$ should: run in the same language not take any input use the same output method This is code-golf, so th...
stackexchange_codegolf
The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task Input The input will be a list of 4 digits numbers, where each digit represent a portion of decoration: EMBU |||| |||+-upper decoration ||+-bottom decoration |+-mouth/nose +-eyes Eyes: 0 - ° 1 - ¯ 2 - - 3 - ^ 4 - ...
stackexchange_codegolf
I want to write a function golf(C, A) that takes the height (C = 2*c) and the width (A = 2*a) of an oblate (left image) or prolate (right image) spheroid or a sphere as parameters and returns the volume V and the surface area S of the shape as tuple. The output must be rounded to two decimal places. All input and outp...
stackexchange_codegolf
This is kept fairly original: Write a program that creates a standard blackjack game: input "h" means hit or draw another card input "s" means stand, or take what you have already Rules: cards values are as follows: 2-9 = face value of card 10, J, Q, K = 10 aces = 11 unless player busts, then it's only a 1 if 2 or m...
stackexchange_codegolf
Create three programs, which we'll call Rock, Paper, and Scissors. Each program must be unique, and accept input. If a program gets any input which is not one of the programs Rock, Paper or Scissors, it must print itself. RPS style, the programs will each print one of the following four outputs: "win" if the running ...
stackexchange_codegolf
Given a non-negative integer skyline height list, answer how many uninterrupted 1-unit-high horizontal brush strokes are needed to cover it. [1,3,2,1,2,1,5,3,3,4,2], visualised as: 5 5 4 3 5334 32 2 53342 13212153342 needs nine brush strokes: 1 2 3 4 5555 66 7 88888 9999...
stackexchange_codegolf
I want you to make a gui window like this: * if you're thinking, the [quit] button closes the window in any language using minimum "different" characters.. AND remember that the gui window must use native widgets instead of custom icons and buttons like I have Windows 8, so my GUI window looks like this: If you didn'...
stackexchange_codegolf
In this challenge, bots must survive as long as possible. In each turn, the bot with the most HP is eliminated. This challenge is inspired by the Smallest unique number KoTH. Results After 100,000 rounds: Jack: 63390 The Follower: 4942 The Algorithm: 2452 The Randomiser: 140 Toe Tipping: 0 EZ: 0 The Average: 0 LowProfi...
stackexchange_codegolf
I have the following Haskell code to generate the the values of the Fibonacci sequence which are even as an infinite list: z=zipWith(+) g=z((*2)<$>0:0:g)$z(0:g)$(*2)<$>scanl(+)1g This works by starting with 0,2 and then defining every following term to be the sum of: twice all prior terms the previous term twice the ...
stackexchange_codegolf
This is the cops' post. The robbers' is here. You make a program and a regex. For most inputs, one of the following happens: the regex doesn't match, and the program returns a falsey value the regex doesn't match, and the program returns a truthy value the regex matches, and the program returns a truthy value But for...
stackexchange_codegolf
Here is my ungolfed Ruby code for a function I want to try and golf: Iter =-> k { str = "" (0..k).map{|m| str += "-> f#{m} {"} str += "f#{k}.times{f1 = f0[f1]};f1" (2..k).map{|m| str += "[f#{m}]"} eval(str + "}" * (k+1)) } The best I can do to golf this is essentially shortening variable names, rem...
stackexchange_codegolf
A simple one: Take a list of positive integers as input and output the numbers modulus their 1-based index in the list. If the input integers are {a, b, c, d, e, f, g} then the output should be {a%1, b%2, c%3, d%4, e%5, f%6, g%7} where % is the modulus operator. Test cases: 10 9 8 7 6 5 4 3 2 1 0 1 2 3 1...
stackexchange_codegolf
Introduction Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!). There's no room for such silliness nowadays, so we've decided to adopt the only sensible alternative: decimal days! That is to say, each day is considered 1 whole unit,...
stackexchange_codegolf
Input: from STDIN number of vertices in Graph \$2 \leq N \leq 100\$. Rules: [Code size] = max ([code length without spaces, tabs and newlines], [total code length divided by 4]) Math formulation: In the graph of N vertices, between each pair of vertices can be 3 road states: there is no road there is a road from A to ...
stackexchange_codegolf
Donald Trump is very impressed with the work of the people on this site. He saw how amazing of a job you did helping Ben Carson, so he even hired you to build his wall. He thinks you're terrific. Now he needs your help again. While he has successfully built his wall, now he needs the Mexican government to pay for it. H...
stackexchange_codegolf
Given a number x, find the sum of all primes up to that number. The input will always be a positive number, bigger than 2. An upper limit isn't defined, so data types can be ignored. Use whichever you want. This is a code-golf, so the shortest code in bytes wins. Example for 5: 2 + 3 + 5 = 10 Test cases: Input Ou...
stackexchange_codegolf
Your mission is to write a program that accepts a date in the formats 2014-02-27 (calendar date) and 2014-W09-4 (week date) from standard input and outputs the date in the format it wasn't entered in (to standard output with a trailing newline). The dates must conform to the standard ISO 8601, i.e. with weeks that star...
stackexchange_codegolf
I cannot believe that this hasn't been done before but I may be wrong. If so, just close as dupe. This challenge is very similar to Is it truthy or falsy? but, IMO, isn't close enough to be a dupe. That has predefined "falsy" variables that all languages must use, some of which aren't even falsy; this uses your own fal...
stackexchange_codegolf
Pip is an imperative golfing language with infix operators. It also borrows some features from functional and array programming. What general tips do you have for golfing in Pip? I'm looking for approaches and tricks that are commonly useful for code golf and are specific to Pip (e.g. "remove comments" is not an answer...
stackexchange_codegolf
Challenge Write a program that applies an injective function which takes an ordered pair of strings as input and one string as output. In other words, each input must map to a unique output. Specifics The input may be any two strings of arbitrary length, but will consist only of printable ASCII characters (codes \$[32...
stackexchange_codegolf
The code on this site is rapidly being depleted. We need to invest in renewable strings. So you must write a program that takes a string and converts it into a windmill. The Challenge Let's take a simple wind-mill string as an example. Take the string abc. The pivot is the center character, in this case b. Since the st...
stackexchange_codegolf
Imagine you are given an array/string containing \$5\$ letters of the English alphabet, with each letter having any value from A to Z (inclusive). Every day, each letter will perform a job, which can affect itself or other letters in the array. The letter's job is determined by the letter itself. Most letters are, due ...
stackexchange_codegolf
Given the sequence OEIS A033581, which is the infinite sequence, the n'th term (0-indexing) is given by the closed form formula 6 × n2 . Your task is to write code, which outputs all the subsets of the set of N first numbers in the sequence, such that the sum of the subset is a perfect square. Rules The integer N is g...
stackexchange_codegolf
Given two strings a and b, count how many times b occurs as a substring in a, but only when it overlaps with another instance of b. (This means that 1 will never be a valid output, because in order for the substring to be strictly overlapping, there must be at least one other instance for it to overlap with.) Test case...
stackexchange_codegolf
Divide the first quadrant (including the positive x-axis, the positive y-axis, and the origin) into 1x1 grids, with each grid labelled by the coordinates of its bottom-left corner, as demonstrated below: Note that each grid contains its boundaries and its vertices. Using mathematical symbols, the grid labelled (m,n) w...
stackexchange_codegolf
Golf Me An OOP! Two important components of object-oriented programming are inheritance and composition. Together, they allow for creating simple yet powerful class hierarchies to solve problems. Your task is to parse a series of statements about a class hierarchy, and answer questions about the hierarchy. Input A seri...
stackexchange_codegolf
The cosmic call is a message sent into space in 1999 and 2003. It's made of 23 127*127px monochrome bitmap images, as detailed here. Your mission is to write a program that displays the entire 127*2921px message, either as a text (made of zeros, ones and line breaks) or as an image (drawn on screen or saved on disk). T...
stackexchange_codegolf
Imagine you are given two lists of numbers which are to be interpreted as points on a circle of circumference 1000. Let us say circleA = [10, 24, 44, 175, 321, 579, 618, 841, 871, 979] circleB = [270, 283, 389, 406, 435, 457, 612, 684, 692, 732] To measure the distance between these two circles we do the following. F...
stackexchange_codegolf
April 5th is National Deep DIsh Pizza Day, the theme of this challenge. Given a positive integer n (n is greater than 0), create an ASCII deep dish pizza. Actual deep dish pizza shown: As you can see, there is a layer of crust on the bottom and surrounding the rest of the pizza. How to make the pizza The crust is mad...
stackexchange_codegolf
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 Given a string containing ...
stackexchange_codegolf
Challenge An ascii string is made 'dank' when exactly one space is inserted between any two consecutive letters and all capital letters are replaced with lowercase ones. In this challenge I would like you to write a program that takes a string (not necessarily 'dank') as input and outputs a 'dank' version of that strin...
stackexchange_codegolf
Specifically, Conway's PRIMEGAME. This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers: A B C D E F G H I J K L M N 17 78 19 23 29 77 95 77 1 11 13 15 15 55 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 91 85 51 38...
stackexchange_codegolf
Task The task is to tile polygons, given a vertex configuration. Scoring Your score is equal to the "complexity level" your submission reaches. Complexity levels are cumulative, meaning that to reach #3 you must also support #1 & #2. Submissions at an equal complexity level are distinguished by byte count; lowest wins...
stackexchange_codegolf
A problem I sometimes encounter is that when writing comments using LaTeX, the comment is too long. Today you will solve this, by writing code which, given a LaTeX math expression, will produce the shortest equivalent expression. To define equivalent expressions, we will need to specify a (simplified) parser for LaTeX:...
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
Write a program that prints the name of its source file. REPL environments are not allowed for this challenge. Your code must work in any file that your language's interpreter will accept. Your answer must also be a full program, not just a function. The source code's file extension must be printed. Leading or trailing...
stackexchange_codegolf
In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation possible with any other language. In this challenge, we'll be doing somewhat of the opposite, and finding the minimum numbe...
stackexchange_codegolf
IPv4 addresses are 32 bits wide, and thus the size of the address space is 232, or 4,294,967,296. However, this is only a theoretical upper-bound. It is not an accurate representation of all the addresses that may actually be used on the public internet. For the purposes of this challenge, it is assumed that all addr...
stackexchange_codegolf
Challenge You have a Chinese Checkers board looking like this: board = [ [''], ['', ''], ['', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', ''], ...
stackexchange_codegolf
Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot tell them apart. You have to pick a bean of a given color, and pray you have select a good one. So, write the shortest p...
stackexchange_codegolf
In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills. The skill you cast depends on the last sign used, and using two or more of the same sign makes the ninjutsu skill fail and puts a little bunny on your...
stackexchange_codegolf
Loading Circle Animation Challenge Write a full program that takes no input (or has an unused input) that displays exactly the following ASCII animation for as long as possible or only 8 frames. Frame 1: # # # # ## Frame 2: ## # # ## Frame 3: ## # # # # Frame 4: ## # # # # (Note that the line at the end...
stackexchange_codegolf
In some cases, often in physics, you have to sum graphs. Your challenge is to write, in a language of your choice, a program or function that takes multiple graphs as images, calculates all possible sums, and outputs the result. Graphs The graphs are images that contain a white (rgb(255, 255, 255)) background with a no...
stackexchange_codegolf
On the TV cooking show Guy's Grocery Games, the chefs cannot begin shopping until Guy Fieri, the show's host, says "Three, two, one, go!" However, the words do not have to be all together. He often "hides" the words in things like this (based on a real example, but not quoting verbatim): There are three of you here; a...
stackexchange_codegolf
I thought it'd be interesting to turn AoC day 3 puzzle into a Golfing Challenge, so here it is. Task Find the number of # you'd encounter in an 11x11 grid (consisting of # and .) that repeats itself (to the right side), starting at the top left corner, which is always a .. You will need to check the position that is \$...
stackexchange_codegolf
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here This Challenge Given a bunch of rectangles, figure out whether or not they fill a rectang...
stackexchange_codegolf
While doodling around on square-ruled paper the other day, I came up with the above negative-space font for digits. In case you haven't spotted it yet, the spaces between the above shapes yield the golden ratio 1.618033988749. In this challenge, your task is to take a number as input and render it exactly as the examp...
stackexchange_codegolf
Given a universe of \$v\$ elements, a Kirkman triple system is a set of \$(v-1)/2\$ classes each having \$v/3\$ blocks each having three elements, so that every pair of elements appears in exactly one block all classes are partitions of the universe. Kirkman's schoolgirl problem corresponds to the \$v=15\$ case. Fif...
stackexchange_codegolf
Given an input string, write a program that outputs the total number of lines and curves it has. The Challenge Take input from STDIN, or any other input method. Output to STDOUT, or any other output method, the total number of lines and curves contained in the string, in that order, based on the below table in the cod...
stackexchange_codegolf
Given a description of the base state of a recursive ASCII pattern, output an expanded state somewhere along the recursion steps. More specifically: Let the following be an example: ##.. ##.. ..__ ..__ Where # is filled, . is empty, and _ is recursive. This describes a pattern wherein the top left quarter is filled, t...
stackexchange_codegolf
The Premise: You are writing a C driver for a screen for use on an embedded system. The screen uses a tortured version of SPI that requires data to be sent LSb (least-significant-bit) first, but MSB (most-significant-byte) first. A fast way to do this (if you have the memory) is to use the integer value of each byte to...
stackexchange_codegolf
Inspired by this comment... Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it! This is the Cops' thread. For the Robbers' thread, go here In this challenge, you are tasked with running some code that makes it so that your language no longer...
stackexchange_codegolf
You met a 4-th dimensional being who challenged you to a game of dice. The rules are simple: each player rolls 3 6-sided dice and takes the sum of each combination of 2 dice. The player with the highest sum wins. If the first-highest sum is a tie, consider the second-highest sum, and so on. Your opponent's dice look no...
stackexchange_codegolf
Halloween is almost here, the holiday after which most people need to wean themselves off a hollow diet of sugar. Write a program that takes in a positive integer. If the integer is less than 31 (1 through 30), output this ASCII-art jack-o'-lantern, looking to the right as if looking forward to Halloween: _____I_____ ...
stackexchange_codegolf
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 inside or on the bord...
stackexchange_codegolf
The turtle wants to move along the grid to get to his food. He wants to know how many moves it will take for him to get there. As well since he is slow he has teleporters set up around his domain that he will utilize if it shortens his path. Or avoid them if it lengthens his path. Meet the turtle The turtle lives on a...
stackexchange_codegolf
Input A string of printable ASCII characters, for example: This is an example string. Output For every consonant (BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz) that is not followed by a vowel (AEIOUaeiou) add the last vowel before it, in lowercase. Consonants before the first vowel are left as-is: Thisi isi ana examapal...
stackexchange_codegolf