instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
We are probably all used to the English alphabetical order: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z When we compare words in English for the sake of alphabetization we first compare the first letter, whichever word has the later first letter comes later. If they are the same we check the second letter and...
stackexchange_codegolf
Sometimes lexicographical sorting of strings may cut it, but when browsing the filesystem, you really need better sorting criteria than just ASCII indices all the time. For this challenge, given a list of strings representing filenames and folders in a directory, do a filesystem sort, explained below: Split every stri...
stackexchange_codegolf
Your task is to, with an input number p, find the smallest positive cannonball number of order p that is NOT 1. Definition A cannonball number (of order p) is a number which is both: An p-gonal number (See this page). and an p-gonal pyramid number. The nth p-gonal pyramid number is the sum of the 1st to nth p-gonal n...
stackexchange_codegolf
Sequel of this AWESOME challenge You, a genius tech prodigy detective, have successfully disarmed the bomb and want to break into the computer. The police found the password 67890-=yuiop[]hjkl;'\vbnm^&*()_+:"| on a piece of paper, but much of the keyboard is broken and there are no other ways of inputting characters. T...
stackexchange_codegolf
My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button...
stackexchange_codegolf
There's a payment machine for laundry in my building which does a few frustrating things. The ones relevant to this challenge are: It doesn't make change. So if you pay over the amount then you are not getting that over-payment back. It doesn't accept coins smaller than 20c. Meaning the only coins it accepts are 20c...
stackexchange_codegolf
Alice is an intern in a company that uses Brainfuck as a primary language for both client-side and server-side development. Alice just has written her first code and she's a bit nervous as she's getting ready for her first code review. Alice wants to make her code properly formatted and look nice, but she has no time t...
stackexchange_codegolf
The challenge. Make a program that produces a random series of 8 notes in the scale of E minor, and then harmonizes them. Details. Notes must be represented in output as a 1-2 char string, which designates the note and if it is sharped or not, followed by a number, which designates the octave. Examples would be C3, D#...
stackexchange_codegolf
Definition A vector a containing n elements is said to majorize or dominate a vector b with n elements iff for all values k such that 1 ≤ k ≤ n, the sum of the first element of a↓ through the kth element of a↓ is greater than or equal to the sum of the first through kth elements of b↓, where v↓ represents the vector v ...
stackexchange_codegolf
The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1: The function can be found recursively: \$f_0(x)=x\$ \$f_{n+1}(x)=\left\{\begin{matrix}\frac{1}{2}f_n(3x)&x\in[0,\frac{1}{3})\\ \frac{1}{2}&x\in[\frac{1}{3},\frac{2}{3})\\ \frac{1}{2}+\frac{1}{2}f_n(3x-2)&x\in[\f...
stackexchange_codegolf
Sandbox Inspired by a Codingame challenge I tried (and failed at) about a month ago. Given a binary tree of words, say: HELLO / \ WORLD EATING / / \ ARCH IDAHO GUARD / DOOZY / ...
stackexchange_codegolf
Given a string s, return the smallest contiguous substring you can remove to create a palindrome. Examples: 800233008 -> 2 racecarFOOL -> FOOL abcdedcba -> (empty string) ngryL Myrgn -> "L " (or " M") 123456789 -> 12345678 (or 23456789) aabcdbaa -> c (or d) [[]] -> [[ (or ]]) a -> (empty stri...
stackexchange_codegolf
The goal is to write a program that encodes an other program (input) with the fewest character possible. Scoring The score is equal to the different number of characters needed for the output. Lower score is better. Rules No target languages with a limited set of commands. (No Brainf**k, Whitespace etc) Edit: I mean...
stackexchange_codegolf
Summary: For any given language, what is the smallest amount of unique characters for your language to be Turing-Complete? Challenge: For any language of your choice, find the smallest subset of characters that allows your language to be Turing-Complete. You may reuse your set of characters as many times as you want. ...
stackexchange_codegolf
Today, my girlfriend and I started with this year's Advent of Code to improve our Python. So far we only did Day 1 and the first part of Day 2. The latter, I found to be very fun, so, to spice it up a little, and with a tip o' the head to Eric Wastl, here's my attempt at turning it into a Code Golf challenge. Task Your...
stackexchange_codegolf
This is my first challenge on ppcg! Input A string consisting of two different ascii characters. For example ABAABBAAAAAABBAAABAABBAABA Challenge The task is to decode this string following these rules: Skip the first two characters Split the rest of the string into groups of 8 characters In each group, replace each ...
stackexchange_codegolf
Did you know that Heronian Tetrahedra Are Lattice Tetrahedra? A Heronian tetrahedron is a tetrahedron where the length of each edge is an integer, the area of each face is an integer, and the volume of the tetrahedron is an integer. It's always possible to place such a tetrahedron in space such that all of the vertic...
stackexchange_codegolf
A few month back, I made a language called ;# (Semicolon Hash) and it started a little bit of a craze (it even got its own tag, as you can see). But, as with everything, the craze died down, and questions related to it stopped being posted. However, a few people were annoyed at the lack of capability of ;# and this lea...
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
Bi-directional translator The challenge is to create a translator that can translate a [a-zA-Z ] string into another string according to the mappings below. The translator should also be able to translate translated text back into its normal form (hence bi-directional). Case doesn't have to be maintained and can be eit...
stackexchange_codegolf
The following puzzle was invented by Eric Angelini in September 2007. As mentioned in A131744 : the sequence is defined by the property that if one writes the English names for the entries, replaces each letter with its rank in the alphabet and calculates the absolute values of the differences, one recovers the sequen...
stackexchange_codegolf
Write a program or function that takes in a string of the characters -=o. where the -=o's and .'s always alternate, character to character. The string will have an odd length greater than one and always start and end in one of -=o. Basically, the input will look like a line of emoticon faces that share eyes in various ...
stackexchange_codegolf
You will be given two pieces of input: a string in run-length encoded format defining the running track, and a capital letter representing the lane to start from. For example, the string "3a4A6b5B" expands to "aaaAAAAbbbbbbBBBBB". You then use the expanded string to create a track, as such: A) aaaAAAA B) bbbbbbBBBBB ...
stackexchange_codegolf
A port of my other question: Double Prime Words Consider a word/string of n alphanumeric characters with sum of the characters, s, using their numeric position in the alphabet (a=1, B=2, c=3, etc.) or numeric value (0,1, 2, 3 - 9). Numeric characters should be taken at individual value. (66 is two 6 characters for a su...
stackexchange_codegolf
You're given a n-by-m matrix of integers, where n,m > 3. Your task is to find the 3-by-3 sub-matrix that has the lowest mean, and output this value. Rules and clarifications: The integers will be non-negative Optional input and output format The output must be accurate up to at least 2 decimal poins (if it's non-integ...
stackexchange_codegolf
This is a code-challenge with a custom scoring system, where the lowest score wins. Introduction Many smartphones allow to enter text by swiping your finger across the 2D virtual keyboard. This technology is usually combined with a prediction algorithm that outputs a list of guessed words, sorted from most likely to le...
stackexchange_codegolf
A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000. Here are lines of the expected output: 0 1 2 3 4 5 6 7 8 9 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 34 35 36 37 38 39 45 46 47 48 49 56 57 58 59 67 68 69 78...
stackexchange_codegolf
Introduction: I'm a twisty puzzles collector. Here you can see my current collection of ± 300 puzzles. I think everyone knows the regular Rubik's Cube (3x3x3 Cube), which is a NxNxN Cube. There are also Cuboids (block-shaped puzzles), which come in different forms, perhaps better explained by SuperAntionioVivaldi here:...
stackexchange_codegolf
A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced. Your will create a prototype for inserting the Ken Thompson virus into code. The goal of this virus will be to allow you to (fak...
stackexchange_codegolf
This question is inspired by Kevin Cruijssen's question. Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side). The procedure for one step of rolling the carpet is the follow...
stackexchange_codegolf
Strobogrammatic Numbers Definition A number which is rotationally symmetrical, i.e., it'll appear the same when rotated by 180 deg in the plane of your screen. The following figure illustrates it better, (source: w3resource.com) Task Given a number as the input, determine if it's strobogrammatic or not. Examples Tr...
stackexchange_codegolf
For any String that is composed of lower cased alphabetical characters, make a function that returns a list of all of it's variations, empty strings returns empty list Test Cases "" -> [] "a" -> ["a", "A"] "ab" -> ["ab", "Ab", "aB", "AB"] "abc" -> ["abc", "Abc", "aBc", "ABc", "abC", "AbC", "aBC", "ABC"] This is Code-g...
stackexchange_codegolf
Awhile back I encountered a simple programming puzzle to determine whether a string was a pangram, or a perfect pangram. (Although it's worth noting that this particular challenge gave a different meaning than the standard definition of a "perfect pangram," to mean any sentence where every letter appears n times for so...
stackexchange_codegolf
Let's define a function \$f\$ which, given a positive integer \$x\$, returns the sum of: \$x\$ the smallest digit in the decimal representation of \$x\$ the highest digit in the decimal representation of \$x\$ (which may be the same as the smallest one) For instance: \$f(1)=1+1+1=3\$ \$f(135)=135+1+5=141\$ \$f(209)=...
stackexchange_codegolf
This king-of-the-hill game is a strategy game in which you must throw around a water balloon and avoid getting splashed by water. The goal is to obtain the most points. You will be given a map of the field and the location of the water balloon. You can either return that you want to hit the water balloon (if you are cl...
stackexchange_codegolf
Following last year's event, we're doing Code Golf Advent Calendar 2022! On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast ...
stackexchange_codegolf
My doubles pickleball group often has five people. Four are playing and one is awaiting the next game. We can represent the state of the game with a string of five characters like abCde. This indicates that a and b are playing against c and d with c serving. We want to write a routine that gives the possible positions ...
stackexchange_codegolf
I'm not sure if this kind of golf is allowed, but here it is. Your objective is to create an image containing one pixel of every possible RGB color. The image with the smallest file size wins. Rules: The image must be a PNG. The image must contain exactly one of every possible RGB color. Acceptable image dimensions ar...
stackexchange_codegolf
Your task is to automatically complete URLs like the address bar in most browsers is doing. We will use the following (simplified) rules: If the input string starts with http://, ftp:// or https://, return the string unchanged. Otherwise, if the input string contains a dot ., e.g. in.put then the HTTP is assumed and ...
stackexchange_codegolf
This challenge is one of the two challenges which were planned for Advent of Code Golf 2021, but didn't fit into the 25-day schedule. Related to AoC2020 Day 22, Part 2. Combat is a simple two-player card game played with a deck of cards. A unique positive integer is written on each card. The game proceeds as follows: ...
stackexchange_codegolf
Enabling delayed expansion variables in Batch chews up a lot of bytes. The shortest I have managed to make it is: @!! 2>nul||cmd/q/v/c%0&&exit/b Saving 11 bytes over @echo off&setLocal enableDelayedExpansion. The method is explained here - Tips for Golfing in Batch. Basically, it runs a command (!!) which fails initia...
stackexchange_codegolf
Surreal Numbers are one way of describing numbers using sets. In this challenge you will determine the value of a surreal number. Intro A surreal number consists of two sets: a left and right. The value of the surreal number must be greater than all numbers in the left set and less than all numbers in the right set. We...
stackexchange_codegolf
Given year, month and optionally weekday of 1st, output the calendar of the month. The first week should remain nonempty. For empty cell, fill it with the date where it's supposed to be, in last or next month, and add # to indicate gray. If last few days can't fit in 5 lines, then they share last line with 5th week, us...
stackexchange_codegolf
The string abaaba Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes aba aba We could also split it up this way: a baab a And all three of those are palindromes. In fact there are only two ways to split the string into smaller strings such that non...
stackexchange_codegolf
Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ You may assume the input is valid. Based on the input, draw a new string arranged on a textual grid of sp...
stackexchange_codegolf
Your task is to make a program that prints out its own source. "Hey, we already have this challenge, and tons of variations of it! Why are you making another one?" you may ask, but this one is going to be one of the most difficult ones (hopefully, anyway). Your quine must be "mutation-hardened", which means the quine, ...
stackexchange_codegolf
The Challenge Consider the following diagram of the Fifteen Puzzle in its solved state: _____________________ | | | | | | 1 | 2 | 3 | 4 | |____|____|____|____| | | | | | | 5 | 6 | 7 | 8 | |____|____|____|____| | | | | | | 9 | 10 | 11 | 12 | |____|____|____|____| | | | ...
stackexchange_codegolf
During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any means: A text \$L\$ consisting of exactly 7 sentences. The first and last sentences have 7 words each, the middle one ha...
stackexchange_codegolf
Introduction I recently came across an oral exam where the candidates were asked to find a logical circuit than can negate 3 inputs A,B,C using only two NOT gates. The question also specified that such a circuit is unique up to removal of useless gates and reordering inputs/outputs. The candidates were asked to prove t...
stackexchange_codegolf
Python string parsing has quite a few edge cases. This is a string: "a" Putting 2 strings immediately after each other implicitly concatenates them, so this is also a string: "a""a" However, if you put 3 quotes in a row, it will create a "triple quoted string" which can only be ended by another 3 quotes in a row. A t...
stackexchange_codegolf
The Illuminati commands you (with their mind control) to output the following string: ^ /_\ /_|_\ /_|_|_\ /_|/o\|_\ /_|_\_/_|_\ /_|_|_|_|_|_\ /_|_|_|_|_|_|_\ /_|_|_|_|_|_|_|_\ /_|_|_|_|_|_|_|_|_\ Rules: Trailing spaces are allowed for each line. Leading spaces in each line...
stackexchange_codegolf
This is a mirror: |. I just found out that you can stick a mirror in the middle of a string if the string can be mirrored on itself! For example, the string abccba. If you cut it in half the two halves are mirror images of each other: abc <--> cba So, we can stick a mirror in the middle of the string, and our new st...
stackexchange_codegolf
Definition Here is the process to describe a number: For each number from 0 to 9 that is present in the number: Write down the frequency of that digit and then the digit. For example, for the number 10213223: There is 1 occurrence of 0, 2 occurrences of 1, 3 occurrences of 2, 2 occurrences of 3. Therefore, the numb...
stackexchange_codegolf
A partition of a list \$A\$ is a way of splitting \$A\$ up into smaller parts, concretely it is list of lists that when concatenated gives back \$A\$. For example [[1],[2,3],[5,6]] is a partition of [1,2,3,5,6]. The trivial partition is a partition that "splits" the list into only one piece, so [[1,2,3,5,6]] is also a ...
stackexchange_codegolf
The challenge is simple: Read 3 letters from a system input¹ and convert them to numbers (A-1, B-2, C-3...Z-26)². Print each of those numbers in the order the letters were inputted in, each on a new line and then the sum of all 3 numbers, on its own line as well. NOTE: There will be no extra input characters, only 3 le...
stackexchange_codegolf
We all know that whenever a rational number is written in decimal, the result is either terminating or (eventually) periodic. For example, when 41/42 is written in decimal, the result is 0.9 761904 761904 761904 761904 761904 761904 761904 ... with an initial sequence of digits 0.9 followed by the sequence 761904 repe...
stackexchange_codegolf
Your challenge is to write a program that outputs the color of a given square from the chessboard. This is how a chessboard looks: You can see that the square a1 is dark, and h1 is a light square. Your program needs to output dark or light, when given a square. Some examples: STDIN: b1 STDOUT: light STDIN: g6 STDOU...
stackexchange_codegolf
Preamble There was a unit test in our codebase which was shuffling a string of length \$52\$ formed from the set of letters \$[A-Z]+[A-Z]\$ and then using the first \$20\$ characters of that shuffled string. It failed quite a while after being written due to no repeated character being present in those twenty and we wo...
stackexchange_codegolf
Background Two numbers, \$a\$ and \$b\$, are said to be connected by a Brussels choice operation* if \$b\$ can be reached from \$a\$ by doubling or halving (if even) a substring (the substring must not be empty and may not contain any leading 0s but it can be 0) in the base-10 representation of \$a\$ *This operation is...
stackexchange_codegolf
Inspired by this comment chain... I wanna enklact my way out of this challenge but I can't... @ETHproductions to enklact (v): to implement a lookup table using a subsection consisting of unique elements. Enklacting is a very useful way to compress a lookup table. For example, let's say you had the following list of ...
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
The golfing language Jelly has a very complex and clever string compression system which I'm not going to go into depth about here. You can find a very good explanation here. Basically, Jelly's string literals are represented as “...», where ... is a string of characters from Jelly's codepage that is decoded into a bas...
stackexchange_codegolf
Given an integer array of at least two elements, output the Matrix-Vector (defined below) of the array. To compute the Matrix-Vector, first rotate through the size-n input array to create a matrix of size n x n, with the first element of the array following the main diagonal. This forms the matrix portion. For the vect...
stackexchange_codegolf
We have lots of horizontal axis for numbers, but I honestly think they're kind of boring. Your task today is to build me a portion of a diagonal axis between two distinct non-negative integers given as input. How to build a diagonal axis? Let's take an example, with the input 0, 5. Our axis should look like this: 0 ...
stackexchange_codegolf
Background We define the prime-counting function, \$\pi(x)\$, as the number of prime numbers less than or equal to \$x\$. You can read about it here. For example, \$\pi(2) = 1\$ and \$\pi(6) = 3\$. It can be shown, using dark magic, that \$ \lim_{x \to \infty} \frac{\pi(x)}{x/\log x} = 1 \$ which means we can approxima...
stackexchange_codegolf
Making a versatile integer printer is nice and all, but writing a single code that prints a lot of different numbers is cumbersome. Wouldn't it be easier to make a script that outputs a number, but also gives you a new script to get the next number? Challenge: Write a code that outputs a single integer N and an executa...
stackexchange_codegolf
Objective Write a program or function (or equivalent) that sorts out and returns the odd letter in the matrix of random size. Details You will be passed a matrix (as a string) as input of random dimensions such as this. bbbbbbbbbb bbbbbdbbbb bbbbbbbbbb bbbbbbbbbb bbbbbbbbbb Your job is to find the letter that doesn't...
stackexchange_codegolf
This is the robbers' challenge. The cops' one is here. 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 ...
stackexchange_codegolf
So you are given a POSITIVE base 10 (decimal) number. Your job is to reverse the binary digits and return that base 10 number. Examples: 1 => 1 (1 => 1) 2 => 1 (10 => 01) 3 => 3 (11 => 11) 4 => 1 (100 => 001) 5 => 5 (101 => 101) 6 => 3 (110 => 011) 7 => 7 (111 => 111) 8 => 1 (1000 => 0001) 9 => 9 (1001 => 1001) 10 => ...
stackexchange_codegolf
This challenge was inspired by Yeah But No But Yeah. maxb´s colleague recently sent him the following piece of JavaScript as a joke: let butScript = (nrOfButs) => { for(var i = 0; i < nrOfButs; i++){ if(i % 3 == 0){ console.log("Yeah") } if(i % 2 == 0){ console.log("...
stackexchange_codegolf
You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers. Now leftover bagels will still be good for 1 more day. After a day on the ...
stackexchange_codegolf
Backstory I was fiddling around with the Evolution of Trust and thought of this.Warning: I recommend you go check it out first before attempting this challenge. Summary for people who haven’t played A quick summary of what it says on the site: there is a machine. If you put in one coin, your opponent gets three coins (...
stackexchange_codegolf
Multi-level marketing related challenge. A peer wants to get rewarded. So it attracted N investors (N>=1), each i-th investor invested x[i]. When a total sum exceeds threshold x[0]+x[1]+...+x[N-1] >= T a peer could be rewarded. But only if a following conditions are satisfied: Minimum amount of investors should be gre...
stackexchange_codegolf
In this game, you can look inside one box at a time chosen by you. When you do that, you can see how many coins there are in that box. The wizard has one last twist for you. At any point, you can choose to give up on this set of boxes and get him to start the whole process again (with a new random \$x\$). Of course, i...
stackexchange_codegolf
Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever This is code-golf, so shortest code wins! Test cases: i dont know if you even need it! lol 1,0 -> 0 5,6 -> 30 3920,5...
stackexchange_codegolf
Problem: Given a string representing a mathematical expression with constants (pi, e, psi, i), basic arithmetic operations (+, -, *, /), parentheses, fractions, and exponentiation, write a program or function to convert a string to its equivalent LaTeX code. The input string will only contain digits, arithmetic operato...
stackexchange_codegolf
A pristine program is a program that does not have any errors itself but will error if you modify it by removing any contiguous substring other than the entire program. A crystalline program is sort of the opposite. It is a program which doesn't have any errors itself but will error if you modify it by adding any 1 cha...
stackexchange_codegolf
Valve's KV file format is as follows (in pseudo-EBNF): <pair> ::= <text> <value> <value> ::= <text> | <block> <text> ::= "\"" <char>* "\"" <block> ::= "{" <pair>* "}" The parsing starts on <pair> state. Whitespace is allowed anywhere, but is only required between two consecutive <text> tokens ("a""b" is invalid, but "...
stackexchange_codegolf
The challenge is to draw the outline of an 'island', generated using a seed as input. Input (seed): string of 6 characters (exactly) allowing only lowercase letters (i.e. abcdefghijklmnopqrstuvwxyz) - examples: 'island', 'aaaaaa', 'jhgcfj' Each seed is to give a unique island (i.e. no two seeds will give the same outp...
stackexchange_codegolf
As we all know, meta is overflowing with complaints about scoring code-golf between languages (yes, each word is a separate link, and these may be just the tip of the iceberg). With so much jealousy towards those who actually bothered to look up the Pyth documentation, I thought it would be nice to have a little bit mo...
stackexchange_codegolf
On that challenge you have to solve that challenge. Contest is over! Check the end of the question Specs: Write the smallest code (Any language*). The score of an answer is the sum of: Code length without whitespace. Number of answers using that same language squared. Length of the name of the biggest language on the...
stackexchange_codegolf
Simple challenge inspired by the popularity of my previous print invisible text and print real invisible text challenges, and the same length different string challenge. Given a string consisting of only printable characters (0x20 to 0x7E), print every printable character not present in the string. Input A string, or a...
stackexchange_codegolf
Your challenge is to implement a cyclic Program Sequence Generator (PSG) in a language of your choice. Given a language, L, a PSG in L is a program in L that outputs a PSG in L. Some properties of a PSG are: Repeated execution of a PSG in L generates a sequence of programs in L. A PSG is said to be cyclic if the seque...
stackexchange_codegolf
My school has its Homecoming dance next week, and there's someone in mind I want to ask. But I don't want to ask her the normal way. I want to send her a program that prints "Rachel, will you go to Homecoming with me?" However, if I just send her print"Rachel, will you go to Homecoming with me?", it'll be way too obvio...
stackexchange_codegolf
Consider a n x n multiplication table and replace each item with its remainder of division by n. For example, here is a 6x6 table and its "modulo 6" structure: (The last column and row are ignored since both are null) 1 2 3 4 5 6 | 1 2 3 4 5 2 4 6 8 10 12 | 2 4 0 2 4 3 6 9 12 15 18 | 3 0 3 0 3...
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
In this challenge, you must take a string matching the regex ^[a-zA-Z]+$ or whatever is reasonable (you don't have to consider uppercase or lowercase letters if you want) (you may assume the string is long enough, and has the right structure for all the operations), and output another string, produced similarly to word...
stackexchange_codegolf
The Challenge The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard. This is code golf, so shortest solution in bytes wins! IO Input will be a single String of zero or more characters in the ASCII decimal range of 32-126 inclusive. You may ...
stackexchange_codegolf
The goal of this challenge is to write a program that visualizes a dependency graph in the form of a tree. While "dependency graph" in this context means nothing more than a directed graph, the visualization method described here works best for graphs describing some dependency relation (as an exercise, after you've re...
stackexchange_codegolf
Introduction Many old chess books use descriptive notation to notate squares on a chessboard, naming the file (column) of the square based on the starting piece positions of White or Black, depending on whose move it is. The ranks (rows) are numbered 1 through 8, with 1 being closest to the player. For example, from Wh...
stackexchange_codegolf
Anyone got tips for golfing in Thue. One tip per answer, and no tips aplicable to all languages (like remove comments)
stackexchange_codegolf
The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute the average Levenshtein distance between two independent and uniformly random chosen binary strings of length n each. Your...
stackexchange_codegolf
Background We've had challenges before on Fibonacci coding and Zeckendorf representation. These representations follow naturally from Zeckendorf's theorem, which states that every positive integer can be represented uniquely as the sum of one or more distinct, non-consecutive Fibonacci numbers. For example: $$ \begin...
stackexchange_codegolf
This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and fully implement conversion between factoradic and any other integer base. The factoradic system is extended to the reals by ...
stackexchange_codegolf
Challenge Given a single word as input, determine if the word is odd or even. Odd and Even words Assume the general rules: odd + odd = even even + odd = odd odd + even = odd even + even = even In the alphabet, the odd letters are: aeiou And the even letters are: bcdfghjklmnpqrstvwxyz The same applies to capital lett...
stackexchange_codegolf
Integers in cosine From trigonometry we know that \$\sin(a) =-\cos(a + \frac{(4*m + 1)\pi}{2})\$ where \$a\$ is an angle and \$m\in\mathbb{Z}\$ (integer). The task For an input of a positive integer \$n\$ calculate the value of the integer \$k\$ with \$n\$ digits that minimizes the difference between \$\sin(a)\$ and \$...
stackexchange_codegolf
Fairy Chess is a sort of generalized chess that allows unconventional pieces. The eight queens puzzle is a classic problem where you have to put 8 queens on a chess board such that no two queens threaten each other. This challenge is sort of a generalized combination of the two. Challenge Given a list of fairy chess pi...
stackexchange_codegolf
The other day, my son asked me to build him a staircase using Lego-ish blocks. And I came up with something like this: Then my kid asked me for a program using the least number of bytes that generated a similar staircase in a computer screen. I am not that good at code-golf, so I need your help. I need a program that:...
stackexchange_codegolf
Many people consider RPS to be a game of chance. If both players play unpredictably, the best strategy is to play randomly. However, let's introduce a bit of predictability to it. Each bot will have a chance to tell the other bot what it's going to play simultaneously. Then there is a pause in which each bot will know...
stackexchange_codegolf
One of my favorite types of challenges on this site are restricted-source challenges. These challenges impose a computer tractable restriction that the sources of potential answers must pass. I like these challenges so much I have been working on a golfing language designed to win at these challenges for some time no...
stackexchange_codegolf