instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Based off a Scratch project The pen extension in Scratch has a set pen color to () block. The () is normally a color dropdown, but you can also use the join()() block. In the join()() block, normally a hex value is in the first input, but the second is just an empty string. However, many new Scratchers that want to t...
stackexchange_codegolf
Schlosberg Numbers In issue 5 of Mathematical Reflections, Dorin Andrica proposed the problem of characterising the positive integers n such that is an even integer. Eight people submitted correct solutions showing that these are the integers n for which is even. The published solution was by Joel Schlosberg, so I c...
stackexchange_codegolf
Cyclically self-describing lists A list \$L\$ of positive integers is cyclically self-describing, if the following conditions hold. \$L\$ is nonempty. The first and last elements of \$L\$ are different. If you split \$L\$ into runs of equal elements, the element of each run equals the length of the next run, and the e...
stackexchange_codegolf
Challenge Return the full contents of your program, but inverted. How do your invert something? Well, Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g A becomes z, and p becomes J. Digits: Subtract from 9. E.g 6 becomes ...
stackexchange_codegolf
The goal here is to simply reverse a string, with one twist: Keep the capitalization in the same places. Example Input 1: Hello, Midnightas Example Output 1: SathginDim ,olleh Example Input 2: .Q Exmaple Output 2: q. Rules: Output to STDOUT, input from STDIN The winner will be picked 13th of July on GMT+3 12:00 (One...
stackexchange_codegolf
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, playing as few matches as possible. Output the minimum win streak that you need. Assume the current win streak is at \$...
stackexchange_codegolf
Introduction The current coronavirus disease is officially named COVID-19, from the 3 words corona virus disease, and the year 2019. (Technically it's coronavirus, making 2 words, but whatever...) Given this example, we can apply this naming convention to name other potential diseases. Challenge You will be given 3 wor...
stackexchange_codegolf
Given an integer N as input, output the Nth permutapalindromic number. A permutapalindromic number is a strictly positive integer such that there is at least one permutation of its digits that results in a palindrome (i.e. a number that is its own reverse). For example, 117 is a permutapalindromic number since its digi...
stackexchange_codegolf
What is the shortest sequence of moves that, from the solved state of the cube, creates a pattern that meets the following criteria: 6 colors on each face at most 2 facelets of the same color no adjacent facelets of the same color EDIT: I made up the name of the pattern. I asked this question in 2018 on Mathematics S...
stackexchange_codegolf
Robbers thread Cops Understanding slicing Remember, slices are zero-indexed. Take this slice: [2:]. If the string is "abcde", the result is "cde" because the slice basically means "get all elements with an index greater than 2." Let's try [1:3]. If there is an end slice, the end slice is not included. (excluded) Theref...
stackexchange_codegolf
Your task is to write a program that, given a number n, returns a list of all valid, halting Smallfuck programs of length n, in any order. Actually, we're using a variation of Smallfuck called F2, which is just Smallfuck with a right-unbounded tape. For the purposes of this challenge, a program that moves left from the...
stackexchange_codegolf
Introduction On 30 May 2020, NASA and SpaceX launched a crewed rocket to the international space station on the SpaceX Demo 2 mission. This is the first time humans have been launched into orbit from American soil since the retiring of the Space Shuttle in 2011, and the first time ever that a private company has launch...
stackexchange_codegolf
Happy New Year 2024! 2024 is a tetrahedral number. A tetrahedral number is a number that can be represented in the form \$n(n+1)(n+2)/6\$ for some positive integer \$n\$. Or, equivalently, they are the sum of the first \$n\$ triangular numbers. They are also the number of objects in a triangular pyramid which has \$n\$...
stackexchange_codegolf
Introduction - What is a necklace? A necklace is something that OEIS people are obsessed with. The OEIS challenge has like 5 necklace sequences. A binary necklace of length n is a loop with n beads that are either 0 or 1. Two necklaces are the same if one can be rotated to become the other, and two reversible necklaces...
stackexchange_codegolf
You decided to organize a rock-paper-scissors championship to find out who is the best. You don't want to let luck to decide the winner so everyone has to give you his or her tactic in writing before the competition. You also like simple things so a move of a competitor (showing rock, paper or scissors) has to be based...
stackexchange_codegolf
For example, given 3 sets of parenthesis, you have: ()()() ((())) ()(()) (())() (()()) = 5 possible combinations. Challenge Program must: • Take 1 number as an input • Return one output, the number of possible combinations of parenthesis sets Shortest number of bytes wins
stackexchange_codegolf
Imagine a countable infinite amount of empty rooms. When an infinite amount of guests come, they occupy the 1st, 3rd, 5th...(all odd) empty rooms. Therefore there's always an infinite amount of empty rooms, and occupied guests needn't move when new guests come. - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - 1 - 1 - ...
stackexchange_codegolf
Let's say that we are programming a game that lets you play Scrabble®. We have a board with tiles placed on it, and empty cells are either normal or have multiplier properties (double or triple the points for a word or for a single letter). Each tile has a value and blank tiles have no value. Thee goal here is to wri...
stackexchange_codegolf
This challenge is based on this video. I recommend that you watch it before trying this challenge. First we define a function. This function (OEIS) takes a integer n as input and outputs the number of letters in the English representation of n (without spaces or hyphens). For example "three" has 5 letters so 3 maps t...
stackexchange_codegolf
We'll define the N-exponential potential of a positive integer M as the count of prefixes of MN that are perfect N-powers. The prefixes of an integer are all the contiguous subsequences of digits that start with the first one, interpreted as numbers in base 10. For example, the prefixes of 2744 are 2, 27, 274 and 2744....
stackexchange_codegolf
Consider a form of binary where digits can be any of \$1\$, \$0\$ and \$-1\$. We'll still call this "binary" because we convert the digits from base two. For example, $$\begin{align} [1, 0, -1, 1]_2 & = 1 \times 2^3 + 0 \times 2^2 + -1 \times 2^1 + 1 \times 2^0 \\ & = 8 - 2 + 1 \\ & = 7 \end{align}$$ We'll call a repre...
stackexchange_codegolf
Input: A list of integers (which will never contain a zero) Output: A list of the same size with counts based on the following: If the current item is negative: Look at all items before this item, and count how many times the digits occurred in those other numbers If the current item is positive instead: Look at all i...
stackexchange_codegolf
There are currently nine feature length films in the core Fast & Furious/The Fast and the Furious media franchise, a series of films about bald men scowling and driving cars very fast. The names of the films, as can be seen, follow a completely logical and sensible convention: The Fast and the Furious 2 Fast 2 Furious...
stackexchange_codegolf
Introduction Suppose we have a network of railroads. Each junction in the network is controlled by a switch, which determines whether an incoming train turns left or right. The switches are configured so that each time a train passes, the switch changes direction: if it was pointing left, it now points right, and vice ...
stackexchange_codegolf
What if we have a corridor comprised of two parallel mirrors? | | | | | | | | | | | | | | | | | | | | Now, we shine a laser down it... | \ | | \ | | \ | | \ | | \ | | \ | | \ | | ...
stackexchange_codegolf
Task In this challenge, your task is to write a program or function which takes an array of paths with an additional boolean indicating it is a file or directory and outputs a file/directory tree in any reasonable format. Remarks Some directories can end with a forward slash ("/") but this is not always the case A par...
stackexchange_codegolf
Just last night I was reading a book which had a chapter on the Partition Problem; the Partition Problem is basically about splitting a set of numbers into two smaller sets of equal size. To visualize it, the book contained the following picture: It shows how, given an input of k boxes, each with height n, you can cre...
stackexchange_codegolf
Specification Write the shortest possible code in any language that does the following: It takes two arguments, x and y, and generates x + y lines of text. The first x lines should consist of y nested pairs of square brackets separated by a space surrounding a single digit, which cycles from 1 to 9, then 0 to 9, etc. f...
stackexchange_codegolf
Task: Your challenge is, given previous submissions and itself as input, output the language that they're written in, in the following format: Say the first program is in Ruby. It must output 1, because Ruby is the 1st language used in this challenge. An example program is: a=gets puts 1 When given itself as input, it...
stackexchange_codegolf
Six is a number perfect in itself, and not because God created all things in six days; rather, the converse is true. God created all things in six days because the number six is perfect. I am fascinated by numbers. As were Sophie Germain and Marin Mersenne. To be more specific, these two were fascinated by primes: a ...
stackexchange_codegolf
Very interesting background Comcoins are a currency like any other. The residents of Multibaseania (an economically robust system of city-states with very few residents in a galaxy far, far away) use Comcoins to conduct transactions between themselves. Comcoins are represented by unique codes on special not-paper slips...
stackexchange_codegolf
Task Basically you have an array of random integers e.g. I() = [1, 4, 3, 2, 5, 3, 2, 1] and you have to create another array of the same length with the numbers 1 to the size of the array in place of the smallest to largest numbers respectively, e.g. O() = [1, 7, 5, 3, 8, 6, 4, 2] For duplicates, the first occurrence...
stackexchange_codegolf
Task Given is a square matrix of any dimension and any integer n. Output all possible matrices(without duplicates) by removing columns and rows from the input matrix such that the determinant of these new matrices is n. Rules Output should include original if determinant of original is n. Output should be all the chopp...
stackexchange_codegolf
Little Chandler is sad. Draw him a cloud to cheer him up. Note: Drawing a cloud won't actually cheer him up. A circle can be defined as a 3-tuple (x,y,r) where x is the x position of the circle on a Cartesian plane, y is the y position of the circle on a Cartesian plane, and r is the radius of the circle. x and y may b...
stackexchange_codegolf
Seven countries lay official claims to parts of Antarctica: Argentina, Australia, Chile, France, New Zealand, Norway, and the United Kingdom. We will focus only on the claims of the main Antarctic landmass south of 60° S, which are: Chile: between 90° W and 53° W United Kingdom: between 80° W and 20° W Argentina: betw...
stackexchange_codegolf
From the subreddit r/SpeedOfLobsters: Edit the text of an image to create a new phrase This meme format/style is pretty self-explanatory. Simply have a browse through the subreddit if you need more examples. However, when coming up with ideas, it can be quite difficult to decide exactly which letters to keep and whic...
stackexchange_codegolf
Draw a simple ASCII art image containing a straight line. It's similar to this and this but with different specifications. Input You can modify this input format to suit your code. integer width integer height integer x0 integer y0 integer x1 integer y1 Output A filled ASCII art image of the specified width and heigh...
stackexchange_codegolf
Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy value if it is the masculine version. For example, hen is the feminine version for chicken and rooster is the masculine...
stackexchange_codegolf
Parenthetical names Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, Sonic the Hedgehog is converted to Sonic (the Hedgehog). Rules: Around every the that passes the following rules, an opening parentheses will be added before the the and a corresponding closing...
stackexchange_codegolf
All variables in this question are integer valued. Input 4 integers w, x, y, z. They can be positive or negative and will be less than 1048576 in absolute value. Output The general solution to the equation. \$ aw+bx+cy+dz = 0 \$. The variables \$a, b, c, d\$ must all be integer values. Output format Your output should ...
stackexchange_codegolf
Related: Interquine Program A outputs program B's code when run, and B outputs C's source, and C outputs A's source. This time you can't exchange two characters and exchange again :) Requirements: Only one language across all programs Standard loopholes restrictions apply All programs are different. One program th...
stackexchange_codegolf
Peano numbers represent nonnegative integers as zero or successors of other Peano numbers. For example, 1 would be represented as Succ(Zero) and 3 would be Succ(Succ(Succ(Zero))). Task Implement the following operations on Peano numbers, at compile time: Addition Subtraction - You will never be required to subtract a ...
stackexchange_codegolf
Introduction We know that the factorial notation is valid for all natural numbers. However, Euler had extended it for all positive real numbers, as well as for complex numbers by defining a function, which is known as the Gamma Function. It is represented by Γ. Challenge You will be given a non-negative floating point ...
stackexchange_codegolf
Write a function that accepts a rectangular grid of ids in any reasonable format, for example a multi-line string: IIILOO ILLLOO and a string or list of box drawing charcters such as: ' ═║╔╗╚╝╠╣╦╩╬' or [0x20, 0x2550, 0x2551, 0x2554, 0x2557, 0x255a, 0x255d, 0x2560, 0x2563, 0x2566, 0x2569, 0x256c'] (see below for more...
stackexchange_codegolf
Your task is to output a spaceship of size n with shooters/guns and n bullets of character - (with spaces in between each bullet) for each gun Rules If n is odd, you must output the guns every even numbered row If n is even, you must output the guns every odd numbered row All rows with guns must have n+1 # character...
stackexchange_codegolf
This was related to a program I am writing. Although the title is simple, the challenge is a lot more complicated. Your challenge You must write a program that takes an input, and your answer must match the sample outputs in this question. What the program should be is that you must output "HelloWorld" with the length ...
stackexchange_codegolf
Inspired by this Stack Overflow question: Sorting a list: numbers in ascending, letters in descending. Your task is to solve the following problem and, as this is code-golf, you should do so in as few as bytes as possible. You should take a list of objects as input containing letters (any reasonable form: string, char,...
stackexchange_codegolf
Given a UTF-16 string, test its endianness. Rules: As long as the input is in UTF-16 without BOM, its type doesn't matter. In C++ on Windows, it can be std::wstring or std::u16string. In Haskell, it can be [Int16] or [Word16]. The endianness is tested by noncharacters. If the input contains a noncharacter, it is in wr...
stackexchange_codegolf
Submit a well-formed program or function with usual I/O rules which satisfy the input, output, and algorithm conditions below. Shortest submission (in bytes) wins. As always, standard loopholes are forbidden. In short: Two distinct 8-bit integer inputs must produce two 8-bit integer outputs so that all four numbers are...
stackexchange_codegolf
Given a list of Integers greater than zero, Sort each of the unique values in ascending order, then repeat the process on the remaining duplicate values and append. Example: [1,5,2,2,8,3,5,2,9] ==> [1,2,3,5,8,9,2,5,2] [8,5] ==> [5,8] [2,2,2] ==> [2,2,2]
stackexchange_codegolf
Write the shortest code you can solving the following problem: Input: An integer X with 2 <= X and X <= 100 Output: Total combinations of 2, 3, and 5 (repetition is allowed, order matters) whose sum is equal to X. Examples: Input: 8 Output: 6, because the valid combinations are: 3+5 5+3 2+2+2+2 2+3+3 3+2+3 3+3+2 Inp...
stackexchange_codegolf
Challenge : Given a word, check whether or not it is an isogram. What : An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram. Examples : "Dermatoglyphics" ---> true "ab" ---> true "aba" ---> false "moOse" ...
stackexchange_codegolf
...and real golf for my code friends. This is a challenge based on a one year old XKCD comic which consists mostly of toasts (parodies of the first in the comic) following a distinct pattern, but with some slight variation. Your task is to write a program (or function) that takes the first half of any toast from the ...
stackexchange_codegolf
As a programmer, you've probably heard of forward slashes and backward slashes. But have you heard of downslashes? That's when you take a bunch of slashes, connect their ends and draw them going down. For today's challenge, you must write a program or function that takes a string consisting purely of slashes, and outpu...
stackexchange_codegolf
A family of sets is called laminar if for any two sets \$A\$ and \$B\$ in the family one of the following is true: \$ A \subseteq B \$ \$ A \supseteq B \$ \$ A \cap B = \emptyset \$ Or less mathematical: A laminar set is a list of lists that satisfies the following condition: If two elements of the top level list hav...
stackexchange_codegolf
Based on a chat message The Challenge Given an input number \$n > 9\$, construct its reverse, ignoring leading zeros. Then, construct a list of all prime factors that the number and its reverse don't have in common. Multiply those factors together to create the Uncommon Factor Number of the input. Or, to put it another...
stackexchange_codegolf
Task Given an integer \$n\in[0,10^{12})\$ in any convenient format, return the number of strokes needed to write that character in simplified Chinese. Background Chinese numerals are expressed in base 10 with a system of digits and places, with an important distinction that digits are in groups of four, rather than thr...
stackexchange_codegolf
Introduction: A Dutch BSN (BurgerServiceNummer) is valid when it complies to the following rules: It only contains digits. The length should be either 8 or 9 in length. When the digits are indexed as A through I, the result of the following sum: 9xA + 8xB + 7xC + 6xD + 5xE + 4xF + 3xG + 2xH + -1xI (NOTE the -1 instead...
stackexchange_codegolf
The goal is to create a generator generator [...] generator generator comprehension. The generator must be created via generator comprehension. The following expression must be valid for any number of nestings: next(next(next(next(next(generator))))). The winner is whoever achieves this with the fewest number of byte...
stackexchange_codegolf
Introduction I began studying the Collatz Conjecture And noticed these patterns; 0,1,2,2,3,3...A055086, and 0,1,2,0,3,1...A082375, in the numbers that go to 1 in one odd step, 5,10,20,21,40,42...A062052 Related like so; A062052()(n) = ( 16*2^A055086(n) - 2^A082375(n) ) /3 The formula for A055086 is $$\lfloor\sqrt{4...
stackexchange_codegolf
Note, challenge copied from question asked at math.stackexchange. Recently, I attained quite some skill at blowing bubbles. At first I would blow bubbles like this: But then things started getting strange: After a while, I was blowing some pretty weird bubbles: After blowing hundreds, maybe even thousands of such bu...
stackexchange_codegolf
We all know true and false, but what do speakers around the globe say? +----------------------+------------+------------+ | Language | True | False | +----------------------+------------+------------+ | Arabic | sahih | zaif | | Armenian | irakan | kelc ...
stackexchange_codegolf
Introduction Let's observe the string abc. The substrings that can be made from this are: a, ab, abc, b, bc, c We now need to align them under the initial string, like this: abc a b c ab bc abc The order of the string doesn't matter, so this is also perfectly valid: abc a ab abc b bc c So, the substring is p...
stackexchange_codegolf
I tested the waters on this sort of question with python, but now I get to the real question I want to ask. restricted-source challenges are uniquely rewarding in Haskell because of Haskell's strict rule set. Type coercion which is the bread and butter for other languages in these sort of challenges is arguably non-ex...
stackexchange_codegolf
There are numerous reasons for trying to obfuscate input. These include preventing decompiling, and being a nuiscance. With this in mind your challenge should your choose to accept it is to write a meta-obfuscator. Your code must in some Language X receive input as a String, and output a program in language X that out...
stackexchange_codegolf
Your challenge is to write a routine, in x86 assembly, which takes a buffer containing 32-bit signed integers and writes a sorted list of the prime values to another buffer, then returns the number of values written to the output buffer. The winning solution is the one that uses the least instructions. Here's a pseudo-...
stackexchange_codegolf
You're writing your favorite language and you want to display the following string: abcdefghijklmnopqrstuvwxyz to your happy customer. Unfortunately, your keyboard is broken and you can now only type symbols !+-*/[](). You must submit a code that evaluates to be the string abcdefghijklmnopqrstuvwxyz or print the string...
stackexchange_codegolf
Given a ragged list of positive integers find the size of the largest list contained somewhere in it. For example: [1,[1,[8,2,[1,2],5,4,9]],2,[],3] Here the answer is 6 because one of the lists has 6 elements and all other lists have fewer. [1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ^ ^ ^ The length doesn't ca...
stackexchange_codegolf
Hold up..... this isn't trolling. Background These days on YouTube, comment sections are littered with such patterns: S St Str Stri Strin String Strin Stri Str St S where String is a mere placeholder and refers to any combination of characters. These patterns are usually accompanied by a It took me a lot of time to m...
stackexchange_codegolf
The challenge given to me is comparatively easy, and specific to MySQL only. I'm given a table expressions which have mathematical calculations done by a kid. Basically, I've to select all the right calculations! The table have the following properties, a : an integer, the left operand. b : an integer, the right opera...
stackexchange_codegolf
Write a function which takes in a list of positive integers and returns a list of integers approximating the percent of total for the corresponding integer in the same position. All integers in the return list must exactly add up to 100. You can assume the sum of integers passed in is greater than 0. How you want to r...
stackexchange_codegolf
Do you have any code-golf tips for writing in SOGL, a golfing language created by dzaima? Your tips should be at least somewhat specific to SOGL. Please post one tip per answer.
stackexchange_codegolf
The Challenge In this challenge, you are supposed to write a program or function that takes in a String, which will contain the simplified Markdown-like Markup, and outputs the corresponding HTML Markup. The Input You can take input in whatever way you wish to. The type of the input should be String. The Output You c...
stackexchange_codegolf
You'll be given the name of one of the 20 biggest objects in the Solar System. Your task is to return an approximation of its radius, expressed in kilometers. This is a code-challenge where your score consists of the length of your code (in bytes) multiplied by a penalty ratio \$\ge 1\$, based on your worst approximati...
stackexchange_codegolf
Out Steganograph Me As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them. The Challenge Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image...
stackexchange_codegolf
In my last challenge, you were asked to find all rectangles given a m x n grid of them. However, it turned out to be very trivial as there actually was a mathematical formula I did not even know about to solve the problem! So now, for a little bit more of a challenge, how about calculating the number of unique rectangl...
stackexchange_codegolf
You will be given a string s. It is guaranteed that the string has equal and at least one [s and ]s. It is also guaranteed that the brackets are balanced. The string can also have other characters. The objective is to output/return a list of tuples or a list of lists containing indices of each [ and ] pair. note: The s...
stackexchange_codegolf
Objective Write a full program that works exactly like the flow chart below. Each output, which is an integer, shall be through stdout, followed by a line feed. Each input shall be a line of string fed through stdin, and shall be judged to a predicate you choose for branching. The same predicate must be used for all br...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. challenge idea by emanresu A Santa has a bunch of presents wrapped in cuboid boxes of various sizes. As his sled flies above a chimney, a stack of presents will be automatically dropped through it. Santa wants to carefully choose the p...
stackexchange_codegolf
Given a list of math expressions that all hold true and consist of modulo remainder calculations with two numbers and a result, your task is to yield the first n numbers that hold true for all the statements in the list. For example: [m % 3 = 0, m % 4 = 1, m % 5 = 3], where % is the modulo operator. For n = 3, the fir...
stackexchange_codegolf
Given a non-empty list/vector of positive integers, write a function to check the following conditions in as few bytes as possible. Take the first integer (the key, or k1) and check that the next k1 values have no duplicate values, excluding instances of k1. Take the last integer (the second key, or k2) and check tha...
stackexchange_codegolf
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966): If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!\$ constitute the integer \$A\$. Challenge Your challenge is given some \$A \geqslant 1\$ find a corresponding \$N \ge...
stackexchange_codegolf
Laguerre polynomials are nontrivial solutions to Laguerre's equation, a second-order linear differential equation: \$xy''+(1-x)y'+ny=0\$. For a given value of \$n\$, the solution, \$y\$, is named \$L_n(x)\$. To avoid trivial solutions, the polynomials are non-constant except for \$n=0\$. The polynomials can be found wi...
stackexchange_codegolf
Task Continuously print a random character (a-z, A-Z, 0-9) not separated by a newline (\n). Expected output b7gFDRtgFc67h90h8H76f5dD55f7GJ6GRT86hG7TH6T7302f2f4 ... Note: output should be randomised. Requirements/Rules Output must be continuous (i.e. never ending), Output may not comprise of newlines, Output must b...
stackexchange_codegolf
We're back! And this time with an objective scoring criteria! This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two functions combine and separate with respective types Str...
stackexchange_codegolf
Challenge You must write a program which correctly identifies the language a passage is written in. Rules The passage will be a string passed to your program either via STDIN or function arguments. You may not use any external sources except for a local text file with words. The length of the text file must be included...
stackexchange_codegolf
The Challenge Create a function that, when given an input of ASCII art (directing a path that may eventually loop), outputs the length of the loop (if there is one) and the length of the "tail" leading into the loop in one of the forms below. Input Your input must be passed to a function. Below is an example of a simp...
stackexchange_codegolf
NOTE: Some terminology used in this challenge is fake. For two integers n and k both greater than or equal to 2 with n > k, n is semidivisible by k if and only if n/k = r/10 for some integer r. However, n may not be divisible by k. Put more simply, the base 10 representation of n/k has exactly one digit after the decim...
stackexchange_codegolf
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible to end up in a scenario where there are multiple valid answers and you may o...
stackexchange_codegolf
This was inspired by Apply gravity to this matrix Your challenge is to input a matrix with non-negative one-digit integers and drop down the 1's down 1 column, the 2's down 2 columns, the 3's down 3 columns, and so on. Once a number has been moved down and there is no number to take its original place, replace that slo...
stackexchange_codegolf
Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). If the source code is duplicated the output must remain the same. The tricky part is that if the source code is typed three times (triplicated?) the output will be multiplied by 3. Rules You must build a full pr...
stackexchange_codegolf
Solve a Tron Game Tron is a great game, and if you haven't played it the internet has MANY online versions available. A fun challenge is to try to write an AI that plays Tron, which is normally much better than any human, thanks to their frame perfect dodging. Even with their perfect dodging of walls, they still get th...
stackexchange_codegolf
Inspired by this. No avocados were harmed in the making of this challenge. Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for Observe this ASCII art avocado: ###### # # # #### # # # p# # ## #### # # # ###### This avocado consists...
stackexchange_codegolf
Consider the following triangle. 1 23 456 7891 01112 131415 1617181 92021222 324252627 2829303132 33343536373 839404142434 4454647484950 51525354555657 585960616263646 5666768697071727 37475767778798081 As you probably noticed, the first row is of length 1, and each row thereafter is 1 digit longer than to the previo...
stackexchange_codegolf
Introduction It was just a normal day, here at your military base. Suddenly, you looked up to see a bomb falling down from the sky! You need to create a program to predict where it will fall, and tell you the location. Challenge You will be given a bomb in the form of Start-X Start-Y X-velocity Y-velocity. You can assu...
stackexchange_codegolf
The reverse-then-add (RTA) sequence is a sequence obtained by adding a number to its reverse, and repeating the process on the result. For eg., $$ 5 + 5 = 10 \Rightarrow 10 + 01 = 11 \Rightarrow 11 + 11 = 22 \Rightarrow 22 + 22 = 44 \Rightarrow\text{ }... $$ Thus, 5's RTA sequence contains 10, 11, 22, 44, 88, 176, et...
stackexchange_codegolf
It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwards compatible wit...
stackexchange_codegolf
A Latin square of order n is text which is arranged as a square of n lines by n columns, contains n different characters, and each character appears once in each line and column. For example, here is a Latin square of order 9: Code gOlf ode gOlfC de gOlfCo e gOlfCod gOlfCode gOlfCode OlfCode g lfCode gO fCode gOl M...
stackexchange_codegolf
For each character in your program, the program with that character removed must produce a number smaller than the program with the next character removed. Your base program isn't required to do anything, and may be invalid. An example submission could be abcd, where bcd outputs 1, acd outputs 4, abd outputs 5, and abc...
stackexchange_codegolf
There are two types of people in this world: users and admins. Let's find out who the real admins are. The task is simple: If the script is run with elevation, print 'True' and only 'True' (only trailing newlines permitted as extra). If the script is run as an unelevated user, print 'False' and only 'False', exceptions...
stackexchange_codegolf