instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Given a string of text, output it as a 'tower'. Each slice of the string (of the form 0:n) is repeated 5*n times, so the first character is repeated 5 times, then the first and the second 10 times, etc. Examples: 'hello' -> ['h'] ['h'] ['h'] ['h'] ['h'] ['h', 'e'] ['h', 'e'] ['h', 'e'] ['h', 'e'] ['...
stackexchange_codegolf
A program is "conveniently palindromic" if it is equal to the string derived when its reverse has all its parentheses (()), brackets ([]), and braces ({}) flipped. No other characters are special and require flipping. (<> are sometimes paired but often not so they are left out.) copied from this challenge. Write a co...
stackexchange_codegolf
Challenge Write a program which takes the URL of a PPCG answer as input and outputs the length of the answer's first code block in bytes. Code Blocks There are three different ways of formatting code blocks: Four spaces before the code (- represents a space, here) ----Code goes here Surrounding the code in <pre> tags:...
stackexchange_codegolf
Background When you run tail -f file in bash, the file is outputted and then any subsequent appends. However, when you remove something that has already been displayed, tail outputs: tail: nameoffile: file truncated Your Challenge When given an input f, append tail: [value of f]: file truncated (with trailing & leadin...
stackexchange_codegolf
Find a bijective function which maps integers to arbitrarily large tuples of integers. Given the input \$n\$, output the tuple it matches to. Edit: The empty tuple is included in the mapping.
stackexchange_codegolf
Related: Clearly parenthesize APL trains Background In the most basic form, APL has two kinds of tokens: arrays and functions. For this challenge, we will use a lowercase letter a-z for an array, and an uppercase letter A-Z for a function. Furthermore, we will assume each character is a token of its own; Fx is equivale...
stackexchange_codegolf
Challenge Premise Bob is a novice pianist who can only play sequences of single notes. In addition, he does quite an interesting thing: for every note after the first, if it's higher than the previous note was, he uses the finger directly to the right of the previous finger used; if lower, to the left; if the same pitc...
stackexchange_codegolf
Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from any starting point inside the string including wrap-around by going left-to-right For example: xyzabc would give a truthy r...
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
quintopia has posted here a challenge to compute multinomial coefficients (some of the text here is copied from there). There is a fun algorithm to compute multinomial coefficients mod 2. Given a list of numbers, k1, k2, ... ,km, output the residue of the multinomial coefficient: reduced mod 2. The following algorith...
stackexchange_codegolf
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro. I am an evil farmer, and to drive up the price of wheat in my area, I've decided to burn the fields of all the farmers around me. I would really like to see the fields go up in flames (...
stackexchange_codegolf
The cosine similarity of two vectors \$A\$ and \$B\$ is defined using their dot product and magnitude as: \$\frac{A\cdot B}{\|A\|\|B\|}\$ Or in other terms \$\frac{\sum_{i=1}^nA_iB_i}{\sqrt{\sum_{i=1}^nA_i^2}\sqrt{\sum_{i=1}^nB_i^2}}\$ Challenge Given two nonempty, nonzero vectors containing only integers (can be taken...
stackexchange_codegolf
Task Your task is to generate a password that is both secure and short in the fewest bytes possible given an integer seed as input. Input No seed Or An integer seed Output A password Scoring Your score is how many seconds the password takes to crack on How secure is my password divided by (bytes * password length) Scor...
stackexchange_codegolf
Background There are self-extracting .ZIP files. Typically they have the extension .EXE (and by executing the file they will be extracted) but when renaming them to .ZIP, you can open the file with some ZIP extracting software. (This is possible because .EXE files require a certain header but .ZIP files require a certa...
stackexchange_codegolf
Let's define a simple language that operates on a single 8-bit value. It defines three bitwise operations (code explanation assumes 8-bit value variable): ! Negate the least significant bit (value ^= 1) < Wrapping left-shift (value = value << 1 | value >> 7) > wrapping right-shift (value = value >> 1 | value << 7) In...
stackexchange_codegolf
Brainfuck is an esoteric programming language that is Turing Complete, meaning you can't tell whether a given program will halt without running it. It's cell-based and has an infinite tape of cells, values containing an unsigned integer from 0 to 255, but if you give it arbitrary-size cells, just three is enough to mak...
stackexchange_codegolf
Imagine a very simple language. It has just 2 syntax features: () indicates a block scope, and any word consisting only of 1 or more lower case ASCII letters, which indicates a identifier. There are no keywords. In this language, the value of identifiers is not important except when they appear multiple times. Thus for...
stackexchange_codegolf
I've tried this question on two forums and have been told this is the best place for this type of question. I'm trying to print from 0 to 1000 then back to 0 again (and all numbers in-between), printing 1000 only once. Also, each number must be on a separate line using vanilla PHP. My current code is 60 characters long...
stackexchange_codegolf
Given an input of a string representing a function definition, output the string with newlines and spaces inserted so that the function's arguments are newline-separated and aligned. The input string will follow the following pattern: First, it will start with a prefix, which is always at least one character long and ...
stackexchange_codegolf
A palindrome is a word which is spelled the same backwards and forwards. For example, "racecar" is a palindrome as is "redder". A double palindrome is a palindrome whose halves are also palindromes. For example, "abbabba" is a double palindrome, as the half "abba" is also a palindrome. Similarily, "abaababaaba" is a tr...
stackexchange_codegolf
Your task is to write a program which implements a bijection \$\mathbb{N}^n\to\mathbb{N}\$ for \$n \ge 1\$. Your program should take \$n\$ natural numbers as input, in any acceptable method (including taking them as a single, \$n\$ element list/array) and output a unique natural number for all possible inputs. In layma...
stackexchange_codegolf
A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific purpose. These days we like to think of a byte as 8 bits. In this challenge, you're tasked to convert an 8-bit byte to a 1...
stackexchange_codegolf
Challenge Write a program that takes as input a text and output "That's me!" if the input is equal to the program own source code, and "That's not me!" otherwise. Notes This is codegolf, in each programming language the shortest program wins. The input can be taken from program arguments or function argument, and the ...
stackexchange_codegolf
This should be easy: given an arbitrary string, your program will give it a name. Requirements Your program will accept an input of a UTF8 string, and output a string representing the input's "name", how you define this name is arbitrary, but it must comply with some conditions. I/O Ranges The input will at most be 382...
stackexchange_codegolf
Today, November 11th, is known as Remembrance Day, Armistice Day, or Veterans Day (depending upon the country), and is a day of reflection and gratitude for members of the military and their service, specifically started to reflect the end of European hostilities in the first World War. Let us reflect on that with a si...
stackexchange_codegolf
In this challenge, you are passed two words: Your job is to determine if they are adjacent. Two letters are adjacent if: They are the same letter, or They are lexicographically adjacent. For example, J is adjacent to I,J, and K only. Z is not adjacent to A Two words are adjacent if: They are the same length, and Ea...
stackexchange_codegolf
Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter. From the Wiki: A line of text is a paragraph, to be wrapped by the client. It is is independent from the lines coming before or after it. A list item starts with an asterisk and a space. Again, the r...
stackexchange_codegolf
This should be a simple challenge. Given a number \$n \ge 0\$, output the super-logarithm (or the \$\log^*\$, log-star, or iterated logarithm, which are equivalent since \$n\$ is never negative for this challenge.) of \$n\$. $$\log^*(n) = \begin{cases} 0 & \text{ if } n \le 1 \\ 1 + \log^*(\log(n)) & \text{ if } n > 1...
stackexchange_codegolf
CHALLENGE This is a fastest-code challenge. Count how many n-dimensional hypercubes with n=1,2,3,4 exist, with vertices labeled with either 1 or 0, such that there does not exist any rectangle formed by 4 vertices such that one diagonal is 1-1 and the other diagonal is 0-0. To be more clear, the forbidden rectangles ha...
stackexchange_codegolf
Background Shakashaka is a puzzle on a grid, whose objective is to place some half-squares (right triangles) on the empty cells so that all the remaining contiguous regions form rectangles, either upright or 45 degrees rotated. Here is an example puzzle with a solution: Ignore the number clues for this challenge. Cha...
stackexchange_codegolf
Introduction So the Challenge is to give out all combinations with two Inputs. The length of the string is also optional and you should be able to edit this. I've selected this channel because I thought it would be very easy to do it "normally" but the challenge itself could be very interesting. I had to create that fo...
stackexchange_codegolf
You left your computer for too long, and it went to sleep. Wake it up again by printing the following coffee maker. ________._________ | | \ - / | || | \ - / | || |___\___/ | || | X | | ___ | | / - \ |______| / - \ | ____ | /_______\ ||7:30||__________ ||____| | |______...
stackexchange_codegolf
A while ago I purchased a new wallet which is able to hold 8 cards (4 on both side). However, I seem to have way more cards than that and I need to make choices on which ones I want to carry with me. Some cards I use more often than others, but the cards I prefer to carry with me are not necessarily the ones I use most...
stackexchange_codegolf
Challenge Write a function which takes an argument which is a verb, and returns the past tense of the verb. (Assume that the verb is regular) Past tense Note: consider y as neither consonant nor vowel. Normally, just adding ed after the end of verb makes the past tense of the verb. Ex: jump → jumped, ask → asked How...
stackexchange_codegolf
Muriel is a language where the only way to loop is to create a quine and execute it. Your job is to create your own language with this property and an implementation of it in a pre-existing language. We will define a Muriel-like language like as follows: It has a built-in command for executing code in its own language...
stackexchange_codegolf
Given a prime P greater than 10, your program or function must figure out its divisibility rule x, defined as the integer with smallest absolute value which yields a multiple of the original prime when multiplied by the last digit of the prime and added to the rest of the original prime. Example Given an input 31, the ...
stackexchange_codegolf
Please note the special scoring for this challenge. Given a non-empty string made of a-z, output the string immediately before it in the shortlex order. Shortlex order We enumerate strings in shortlex order by first listing the strings of length 0, then those of length 1, then length 2, and so on, putting them in alph...
stackexchange_codegolf
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet: Print all Integers from 1 to 10 inclusive in ascending order to standard output. Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of th...
stackexchange_codegolf
Challenge Given an integer, \$s\$, as input where \$s\geq 1\$ output the value of \$\zeta(s)\$ (Where \$\zeta(x)\$ represents the Riemann Zeta Function). Further information \$\zeta(s)\$ is defined as: $$\zeta(s) = \sum\limits^\infty_{n=1}\frac{1}{n^s}$$ You should output your answer to 5 decimal places (no more, no le...
stackexchange_codegolf
Welcome to my first code-golf challenge! :) Let's hop right into it. Challenge: Given two floating point vectors, O (origin) and T (target), you have to create a program to print the values L and R to STDOUT. O is one corner of the square T is one corner of the square that is located opposite to O L is the 2D point (c...
stackexchange_codegolf
33 is a simple esolang I created. You may have seen me use it in a few questions. You're not going to be writing a full interpreter. The interpreter you will be writing is for a simplified version of 33. This simplified 33 has two numeric registers: the accumulator and the counter. The accumulator holds all the post-ar...
stackexchange_codegolf
Given two real numbers (postive or negative) in the limits of float pointing number data types, i.e., (\$-3.4e38\$ to \$3.4e38\$) not inclusive, you should output the max of the two reversed numbers. TEST CASES Example Input: 135 210 Output: 531 \$531\$ is \$135\$ reversed, which is greater than \$012\$, i.e., \$210...
stackexchange_codegolf
Your challenge, should you choose to accept it, is to take as input: A program in DirectionLang (as an ASCII string consisting of DirectionLang instructions) A list of pairs of integers, henceforth known as the pretty places. This list may be taken in any reasonable format. You should then output a truthy value if th...
stackexchange_codegolf
The primorial \$p_n\#\$ is the product of the first \$n\$ primes. The sequence begins \$2, 6, 30, 210, 2310\$. A Fortunate number, \$F_n\$, is the smallest integer \$m > 1\$ such that \$p_n\# + m\$ is prime. For example \$F_7 = 19\$ as: $$p_7\# = 2\times3\times5\times7\times11\times13\times17 = 510510$$ Adding each num...
stackexchange_codegolf
For this golf, you will need to use more than one language. The task A Rube Goldberg machine is a contraption that takes an enormous number of complicated steps in order to execute a very simple task. The goal of this golf is to output Rube Goldberg... but not directly. The machine Your "machine" is the source code tha...
stackexchange_codegolf
There's only one question for machine-language golfing, and it's for the ia32 and amd64 architectures. Here's one for a predecessor of them: the Zilog Z80! The ISA is available here. As usual, if your tip is only applicable to a certain environment/calling convention, please indicate that in your answer. Only one tip ...
stackexchange_codegolf
You have been collecting data from a Advanced Collecting Device Controller™ for a long time. You check the logs, and to your horror you discover that something has gone terribly wrong: the data only contains the last bits of the numbers! Luckily, you know the starting value and that the value never changes fast. That ...
stackexchange_codegolf
Super Mario Galaxy features two rhombicuboctahedron-shaped* planets tiled with platforms that shrink as Mario runs across. Should Mario fall into a triangular hole or a gap left by a tile he previously touched, he will be consumed by the black hole at the core. (Watch: Hurry-Scurry Galaxy, Sea Slide Galaxy) Image: Mar...
stackexchange_codegolf
Given a list of date ranges r as input, output or return any ranges not found in r. For the sake of this example, input will be in YYYY-MM-DD format. Let's say you have three date ranges: [2019-01-01, 2019-02-01] [2019-02-02, 2019-04-05] [2019-06-01, 2019-07-01] You can see that there is a gap in between 2019-04-05 an...
stackexchange_codegolf
This is a repost of this challenge Challenge There is an old, popular riddle: Find an English word with 8 letters that, taken away one letter, creates a new valid word. Repeat that until there are no letters left. Example solution: starting staring string sting sing sin in I Your task is to write a program, which t...
stackexchange_codegolf
Write a program that will test the primality of a specified number, and give the output as a Boolean value (True is prime). Your prime test can (but doesn't have to) be valid for the number 1. Here's the catch: your program itself has to sum to a prime number. Convert every character (including spaces) to its Unicode/...
stackexchange_codegolf
Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime ...
stackexchange_codegolf
There has been a question about yes in the past, but this one is slightly different. You see, despite yes having a rather long size, it is incredibly fast. Running the following command: timeout 1s yes > out yields a file that is 1.9 GB. Compared to this program: int puts();main(){while(1){puts("y");}} which yields a...
stackexchange_codegolf
What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer). Please post one tip per answer. At the moment of writing, the official BQN site is the most comprehensive res...
stackexchange_codegolf
Related From Wikipedia: In number theory, the Calkin–Wilf tree is a tree in which the vertices correspond one-to-one to the positive rational numbers. The tree is rooted at the number \$1\$, and any rational number expressed in simplest terms as the fraction \$\frac{a}{b}\$ has as its two children the numbers \$\frac{...
stackexchange_codegolf
Challenge Display Inky the ghost from Pac-Man using only ANSI escape codes. Here's a text representation of the image B B B B B C C C C B B B B B B B B C C C C C C C C B B B B B C C C C C C C C C C B B B C W W C C C C W W C C C B B W W W W C C W W W W C C B B E E W W C C E E W W C C B C E E W W C C E E W W C C C C C W...
stackexchange_codegolf
I have this problem where I listen to so much music that I can never remember what songs are called. But even if I remember the lyrics, I won't always know the song's name. But lucky for me, there's a pretty neat formula to determine¹ the title of a song just based on its lyrics. I'll define the way a song title can be...
stackexchange_codegolf
My wires are all tangled! Isn't it annoying when wires get all tangled up? Well, that just happened to me, so I'd like to to help me untangle them! For your convenience, I've disconnected them all from the device, but they're all still connected to the outlet. Your challenge is to figure out how to untangle them! Input...
stackexchange_codegolf
Given an integer n, output the following ASCII art to n rows: 1+1=2 1+2=3 2+3=5 3+5=8 5+8=13 Essentially, the first row is 1+1=2 and the nth row (1-indexed) is \$f_n + f_{n+1} = f_{n+2}\$ where \$f\$ is the Fibonacci sequence, padded so the numbers line up with the previous row. You may instead out...
stackexchange_codegolf
I use "suffix" loosely here to mean "any sub-string that follows the prefix". "Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first character of the input text (for the first word). A "prefix" in the middle of a word is ignored. E.g. if your input prefix is "...
stackexchange_codegolf
Given a string s and a positive integer N, gradually duplicate each character more and more until N duplicates, and then staying at N duplicates until N characters away from the end, then step down again. For example, given abalone and 3: a we start with 1 copy bb then 2 copies aaa then 3 copies, which is our sec...
stackexchange_codegolf
In this challenge you will receive a list of non-negative integers. Each one represents a mushroom with a cap of that radius centered at that location. So a 0 means that it occupies no space at all, a 1 means that its cap only occupies space above it, a 2 means it occupies space above it and one unit to the left and ...
stackexchange_codegolf
The Challenge Given an integer, calculate its score as described below. The score is calculated by raising each digit of the input Integer to the power n, where n denotes the index of the digit in Input (beginning with 1) when counted from left to right (the index of leftmost digit should be 1), and then summing them a...
stackexchange_codegolf
Note: This is the cops' thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer. Task: Write the shortest safe program which multiplies the square root of an integer n by the square of n This is cops-and-robbers, so the rule...
stackexchange_codegolf
A simple regex is either: _ (which matches the empty string) Any lowercase letter a to z (which matches that letter) r*, where r is a regex (which matches r any number of times) (r|s), where r and s are regexes (which matches either r or s) (r+s), where r and s are regexes (which matches r followed by s) Note that du...
stackexchange_codegolf
On modern game consoles and other devices without traditional keyboards, trying to input text is a nightmare. Having to type with a few buttons and a joystick on a virtual keyboard is annoying, and I like to make as few movements/button presses as possible. The keyboard you will be using looks like this: +---+---+---+-...
stackexchange_codegolf
Letter dice are common in word games. It can be fun to try to spell funny words with boggle dice, for instance. If you grab a handful of dice, chances are you won't be able to spell certain words. This challenge is a generalization of that idea. Challenge Given a list of dice which each have at least 1 face and a word,...
stackexchange_codegolf
Given 2 inputs (m=minimum starting id, n=number of ids), generate a sequential list of ids, starting at >=m, made up of the digits 0-9 where no 2 contiguous numbers are the same, e.g. 1232 is ok, 1233 is not (contains 2 '3's next to each other). Example for m=985, n=6, below shows what ids would be generated/skipped .....
stackexchange_codegolf
Inspired by This answer to a Puzzling question Background - exponentiation by squaring If you don't want to read the background, or don't understand it, there's a worked example in Java, linked at the bottom of the post. \$a^{2^{x+1}} = a^{2^{x}} * a^{2^{x}}\$ Therefore to find \$a^b\$ (where \$a\$ and \$b\$ are base-1...
stackexchange_codegolf
A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a mat. Below are some sample looks: Column 9 by Row 7 Symbol 1: @ Symbol 2: - Input: 9 7 @ - @@@@@@@@@ @-------@ @-@@@@@-@...
stackexchange_codegolf
Task Given a positive integer return the geologic era and period it was that many million years ago. Input/output The input is a string or integer; the output is a string. Eras and periods are separated by slashes (/). Input will always be between 0 and 542 inclusive Data The possible outputs for eras and periods and t...
stackexchange_codegolf
Well I think it is about time we have another proof-golf question. This time we are going to prove the well known logical truth \$(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)\$ To do this we will use Łukasiewicz's third Axiom Schema, an incredibly elegant set of three axioms that are complete over proposit...
stackexchange_codegolf
Background The Thousand Character Classic is a chinese poem written around the 4th Century CE in China, and memorized by large populations since then. The name comes from not only its length, but its number of characters: each character occurs only once in the text. It is commonly used to teach children chinese charact...
stackexchange_codegolf
This question is similar to Write a word equation solver by David Frank but different in three important ways: (1) David asked for just the first solution found, and I am asking for all the solutions. (2) I am asking to output the time required to solve the puzzle. And (3), it is a completely different undertaking to...
stackexchange_codegolf
Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is <> then it has stopped. For example: <> 1> 2> 3> After one second, I get <> 1> 2> 3> After two, I get <> 1> 2> 3> If two cars are too close, they crash. 1> <1 1> <2 Afte...
stackexchange_codegolf
I made a joke the other day and sent it to some friends. One replied back "I love the irony!" and I looked at it and realized there was some irony in it. But that wasn't the irony she saw - the irony she was was the punchline of the joke, which wasn't ironic in the slightest. And it got me thinking about a certain othe...
stackexchange_codegolf
The challenge is simplistic, given an input time as a string in any one of the following formats: hh, hh:mm or hh:mm:ss with 0 ≤ hh ≤ 23, 0 ≤ mm ≤ 59 and 0 ≤ ss ≤ 59. Output what time it currently is using the following symbols: AA LABEL FOR CHARACTER CODE POINT HEXADECIMAL == ==================== ==========...
stackexchange_codegolf
Input: A maze containing the characters: -- (horizontal wall); | (vertical wall); + (connection); (walking space); I (entrance); U (exit). I.e. an input could look like this: +--+--+--+--+--+--+--+--+--+--+ I | | | + +--+--+--+ + + + +--+ + | | | | | | +--+-...
stackexchange_codegolf
Goal: create a self-referencing tuple satisfying x == (x,) in any version of Python. Standard libraries, matplotlib, numpy, pandas only. Answers meeting this extra condition are prioritised (which may be impossible): this tuple should also be insertable into a dict or set. If the extra condition is impossible, apart fr...
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
You are given a string \$s\$ of characters from a to z. Your task is to count how many unique strings of length \$n\$ you can make by concatenating multiple prefixes of the string \$s\$ together. Since the result can be superlative you can either choose to output the whole result, the result mod \$2^{32}\$ or the resul...
stackexchange_codegolf
In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any two alleles from your programs will result in a new, functioning program (which returns its own alleles). As an example, say you wr...
stackexchange_codegolf
Task A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria. For example, this position does (click for larger images). Every white piece is on ...
stackexchange_codegolf
Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws. The Rules of Natural Deduction Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P Negation Elimination: {(¬P → Q), (¬P → ¬Q)} ⊢ P And Introduction: {P, Q} ⊢ P ʌ Q And Elimination: P ʌ Q ⊢ {P, Q} Or Introduction: P ⊢ ...
stackexchange_codegolf
(Similar: Through the bases) Normally, our number system is base ten, with the digits 0123456789. However, we can increase or decrease the base count (so hexadecimal uses 0123456789abcdef and octal uses 01234567. Your goal is: given a string, interpret it in all bases 2-36 for which it's valid, compute the total, and e...
stackexchange_codegolf
These are raindrops: ! | . " : These are clouds particles: ( ) _ @ $ & I want you to verify, when given a block of text, whether or not it is raining. It is raining if, for every raindrop, there is a cloud particle somewhere above it. There must be one cloud particle for every raindrop. Output a truthy or falsy value...
stackexchange_codegolf
Challenge Write a program or function that takes in 4 non-negative integers, A, B, C, and D, that represent two fractions, A/B and C/D, where B and D are non-zero and A <= B and C <= D. Output an ASCII art depiction of the fractions made of |x- characters on two lines as follows: The lines will always be the same, min...
stackexchange_codegolf
A very simple challenge today. Output a truthy value whether the ASCII character (or it's code) supplied is a brainfuck instruction (one of +-,.<>[]), and a falsy value if it's a comment (everything else). Input + # < > . P , Output true false true true true false true
stackexchange_codegolf
Introduction Bob runs a deli. His deli serves sandwiches to its customers. However, it is a bit unusual. At Bob's deli, instead of telling Bob what they want, customers show Bob an ASCII art drawing of their sandwich. Bob must find the pattern in their sandwich so he knows what ingredients to prepare. However, Bob does...
stackexchange_codegolf
Validate a codice fiscale Every Italian resident/citizen is given a 16-character alphanumeric codice fiscale Challenge The final letter is a check code, which is calculated as follows : Characters of the code are split up into even and odd character according to their positions (check letter excluded) Both sets are re...
stackexchange_codegolf
A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible scramble states. Due to the way a 2x2 only has two layers, doing one turn on one face is equivalent (without considering the p...
stackexchange_codegolf
A laser shoots a straight beam in one of the four orthogonal directions, indicated by <>^v. Determine whether it will hit the target O on a rectangular grid. Each of these will hit (True): ..... ...O. ..... ...^. ..... >O. ... v.... O.... ........... ........... O.........< ........... These will miss (False): ......
stackexchange_codegolf
Input variables: (Names are just examples, they don't need to be named like this) GrandTotal - integer to divide SplitCount - number of output integers required UpperLimit - highest valid value for any one output integer LowerLimit - lowest valid value for any one output integer Valid Output: Outout must be a random ...
stackexchange_codegolf
A marquee is a low-tech board that allows customizable letters. For example, here is a marquee: SALE ON SNEAKERS However, someone might come along and vandalize it by removing letters to send a different message: S N AKE Given two non-empty string inputs, an original message and a new message, determine whethe...
stackexchange_codegolf
You are a young programming geek living with your 2 other best friends. Every week, one of you has to do all the chores of the house and you decide whose turn it is by picking a stick. The one who picks the shortest stick loses and does all the chores. As all of you are programmers and love creating puzzles, you have m...
stackexchange_codegolf
This is based on how my company deals with the monitoring of the working times for every employee. Each one of us has a card that can be passed in front of a sensor, so that a clock registers the times at which the employees check in or out the office. Every time register is linked to a code: Code 0: the employee arri...
stackexchange_codegolf
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and c...
stackexchange_codegolf
I have a hardware that has a 32-bit input register. The register has the following characteristics: The 32-bit register consists of eight 4-bit fields. Each 4-bit field holds a value in signed-magnitude; it can hold an integer between -7 and +7 inclusive, including -0 and +0 (signed zeroes). For example, the hexadeci...
stackexchange_codegolf
You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and sum them up, then sort the best pairs ordered by the absolute distance to 100 in ascending order. Paired up integers from each list shall not be repeated in the output. For instance, we have ...
stackexchange_codegolf
Suppose a new fairy chess piece named the Wazir is introduced to chess. Wazirs can move from a position (x, y) to:  (x+1, y)  (x, y+1)  (x-1, y)  (x, y-1) That is, they move orthogonally like the rook, but only one step at a time like the king. How many such wazirs can be placed on an N×N chessboard so that no two wazi...
stackexchange_codegolf