instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
What general tips do you have for golfing in Lexurgy? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Lexurgy (e.g. "remove comments" is not an answer). Please post one tip per answer. Lexurgy is a tool created by Graham Hill/def-gthill meant for conlang...
stackexchange_codegolf
Polystrips are a subset of polyominoes conforming to the following rules: each piece consist of 1 or more cells no cell can have more than two neighbours the cells should not enclose a hole Free polyominoes are distinct when none is a rigid transformation (translation, rotation, reflection or glide reflection) of ano...
stackexchange_codegolf
Your task is to create either a console "app" or a function which allows the user to bet on certain numbers or retire / claim rounds. Bets Your program or function will prompt for a command after an action, and the bet is the most important, crucial to the operation of the app. A bet looks something like this: bet 5 b...
stackexchange_codegolf
Input Two words separated by a space. It is assumed that the first is a verb. Output The "Soviet counterpoint" to the input phrase, in the form of a punchline to an "in Soviet Russia" joke. "break law" --> "In Soviet Russia, law break you!" Accounting for correct grammar is unimportant. Shortest program wins!
stackexchange_codegolf
You and your brother have inherited a rectanglar block of land. This block of land's corners are read in from stdio as TLX,TLY,TRX,TRY,BLX,BLY,BRX,BRY (all decimal numbers without units, T=Top, L=Left, B=Bottom, R=Right) Unfortunately the city has seen fit to appropriate a small rectanglar section from inside your you ...
stackexchange_codegolf
What is the shortest way to convert a string containing integers separated by spaces to a list of integers? input : "-3 1 5 8 10" output : [-3, 1, 5, 8, 10] I regularly face this situation and I wanted to know if there is a better way than (24 bytes): list(map(int,s.split()))
stackexchange_codegolf
Let's play Russian Roulette! Normally, this would be a race to write the shortest MOD 6 program, but that's not very realistic, as the chance of winning decreases with each click. Here are the rules: Emulate a real six-shooter: A single bullet is placed into one of the six chambers, and the barrel is spun once, onl...
stackexchange_codegolf
Write a function or program that given a list of non negative integers, arranges them such that they form the largest possible number. INPUT [50, 2, 1, 9] OUTPUT 95021 INPUT 0 OUTPUT 0 INPUT (Interesting one) [7, 76] OUTPUT 776 RULES standard loopholes apply. Depending on your language you can use int(32) / in...
stackexchange_codegolf
For a given list of number \$[x_1, x_2, x_3, ..., x_n]\$ find the last digit of \$x_1 ^{x_2 ^ {x_3 ^ {\dots ^ {x_n}}}}\$ Example: [3, 4, 2] == 1 [4, 3, 2] == 4 [4, 3, 1] == 4 [5, 3, 2] == 5 Because \$3 ^ {(4 ^ 2)} = 3 ^ {16} = 43046721\$. Because \$4 ^ {(3 ^ 2)} = 4 ^ {9} = 262144\$. Because \$4 ^ {(3 ^ 1)} = 4 ^ {...
stackexchange_codegolf
Given a string, shuffle it so that it becomes a palindrome. For example, adadbcc can be arranged into dacbcad, or dcabacd, acdbdca and more. Any of these (or all) is acceptable, and duplicates are allowed if outputting all. Something like abc cannot be shuffled into a palindrome, and you can assume it won't be inputted...
stackexchange_codegolf
The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^2\$-gons where each vertex is a different point of the \$n \times n\$ grid. One is not allowed to have two consecutive segments ...
stackexchange_codegolf
Task Your task is to print this exact text: A BCD EFGHI JKLMNOP QRSTUVWXY ZABCDEFGHIJ KLMNOPQRSTUVW XYZABCDEFGHIJKL MNOPQRSTUVWXYZABC DEFGHIJKLMNOPQRSTUV WXYZABCDEFGHIJKLMNOPQ RSTUVWXYZABCDEFGHIJKLMN OPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZABCDEFGHIJKLMN OPQRSTUVWXYZABCDEFGHIJKLMNOPQ RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV WXYZ...
stackexchange_codegolf
Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). A trailing newline is permitted and need not be repeated. For example if your source was print p Since p appears twice and every other byte appears once yo...
stackexchange_codegolf
Your task is "simple" should you choose to accept it. Write an HQ9+ compiler in a language of your choice. HQ9+ has four commands (as you may be able to tell) H prints "Hello, World!" Q prints out the source code (this can either be the compiled source or HQ9+ source for the purpose of this challenge),9 prints out the...
stackexchange_codegolf
I'm new to code golf challenges. My problem came up in Advent of Code 2020 Day 8 The input is an array of arrays. In part two of the problem one needs to run several trials to produce a result by changing an element in the input array. My current code is this (comments added to explain what's going on): p input.each_wi...
stackexchange_codegolf
Jack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he made by himself. Challenge You are given N (if required), the number of days Jack knows the cost of electricity for, and X,...
stackexchange_codegolf
Universal Command Sequence Definition An \$n\$-maze is a \$n\times n\$ chessboard which has "walls" on some edges, and a "king" on the board that can move to the 4 adjacent cells, which cannot pass through any walls. Starting from any cell the king should be able to reach every cell on the board. A command sequence is ...
stackexchange_codegolf
Counting Gems Background My jewel box just fell down! There're too many gems of different shape on the ground. And your task is to count number of a certain type of gem. I/O Your code should take two inputs S and G, which could be a string with newlines, an array of lines, a two-dimensional array of characters, a text...
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
You are fish in a pond that needs to survive by eating other fish. You can only eat fish that are the same size or smaller than yourself. You must create a program that takes a shoal of fish as sorted input. From this you must work out how many fish you can eat and ultimately the size you will grow to. Size chart +----...
stackexchange_codegolf
Everyone knows that C is a lovely, safe, high level programming language. However you, as a coder are set the following task. Write a program to add two numbers. Input: Two space separated integers. Output: The sum of the two numbers in the input. The twist is that your code must be 100% safe. In other words, it m...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1 to \$n\$. Out of curiosity, I come up with a definition of "magic number" for a shuffled deck: The magic number of a shuffle is the minimum number ...
stackexchange_codegolf
Given a string \$ x \$, we say another string \$ y \$ is half of it, if both of the following properties are true: \$ y \$ is a (not necessarily continuous) subsequence of \$ x \$ - there exists a strictly increasing sequence \$ a_i \$ such that \$ y_i = x_{a_i} \$ Each character appears in \$ x \$ exactly twice as ma...
stackexchange_codegolf
Introduction Long ago, when I used to code card games with usual playing cards, I used to specify a number for each card and call a function with some number to get a card. This somewhat inspired me to make this challenge. So for the people unaware of the playing cards, a deck of cards consist of 52 cards (13 in each ...
stackexchange_codegolf
The Fibonacci sequence is a fairly well known thing around here. Heck, it even has its own tag. However, for all that, we sure like to stick to our roots of 1, 1, ... (or is it 0, 1, ...? We may never know...). In this challenge, the rules are the same, but instead of getting the nth item in the Fibonacci sequence, you...
stackexchange_codegolf
Your task: Create a program that encrypts a string with another string using a key, using the vigenere cipher. What a vigenere cipher does Ciphertext: string Key: keya | | v v string keyake | v (18)(19)(17)(08)(13)(06) (10)(04)(24)(00)(10)(04) | v (28)(23)(41)(08)(23)(10) ...
stackexchange_codegolf
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements: B or b = 8 E or e = 3 I or i = 1 S or s = 5 Let...
stackexchange_codegolf
Write a program that precisely clones GNU cat version 8.32, which is installed on my computer. In any case, if called with the same arguments, same stdin, and same files, your program's output to both stdout and stderr must by byte-for-byte identical to that of GNU cat, and the exit code must be the same. This applies ...
stackexchange_codegolf
Task Given a non-empty string of lowercase ASCII letters a-z, take its first character, and: Surround it with a square of copies of the second character, Surround that with a diamond of copies of the third character, Surround that with a square of copies of the fourth character… …alternating between square and diamon...
stackexchange_codegolf
Write a program that translates an arithmetic expression to a Brainfuck program which evaluates the expression and prints the result in decimal numbers. For example, this arithmetic expression, 2 * (3 + 4) can be translated to Brainfuck as, ++ 2 >+++ 3 >++++ 4 [-<+>]< add <[>[->+>+<<]>[-<+>]<<-]>[-]>>[-<<<+>>>]<<< mul...
stackexchange_codegolf
Background When I was younger, I was taught a method of drawing a weird "S" shape, that I (along with my classmates) found fascinating. Today, I rediscovered it, and due to its formulaic approach to drawing it, thought it could lead to an interesting challenge :P Drawing the "S" The S can be drawn by following these si...
stackexchange_codegolf
What is the Ultraradical? The ultraradical, or the Bring radical, of a real number \$a\$ is defined as the only real root of the quintic equation \$x^5+x+a=0\$. Here we use \$\text{UR}(\cdot)\$ to denote the ultraradical function. For example, \$\text{UR}(-100010)=10\$, since \$10^5+10-100010=0\$. Challenge Write a ful...
stackexchange_codegolf
Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if a is a root then so is -a, return another polynomial with the roots rotated by 90 degrees. Details The polynomial can be given in any reasonable format, e.g. as a list of coefficients. The symmetry...
stackexchange_codegolf
Robber's challenge This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-empty output in language B. The program may produce any output to STDERR when run in either language, but may not take in...
stackexchange_codegolf
Let me tell you about a simple number system. (which I made up just for this challenge) This system contains the functions (), [], {}, and <>. 1. () When () is given no arguments, it evaluates to 0. When () is given one or more arguments, it evaluates to the sum of the arguments. 2. [] When [] is given no arguments, it...
stackexchange_codegolf
Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's sa...
stackexchange_codegolf
Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining exactly two squares at their edges. Examples For the pattern on the left, O represents an occupied cell on the grid and...
stackexchange_codegolf
Last Thursday user @SpookyGengar delighted us with his/her first challenge about Making Squared Words. What if we double the number of sides? The challenge Take a string as input in any reasonable format you need (string, char array...) and output an octogonal representation of the input (also in any reasonable format:...
stackexchange_codegolf
Given N decanters (0 < N < 10) with that can hold C0 ... CN-1 liters (0 < C < 50) and a goal G liters, please determine if it is possible to reach that goal using only the following actions: Fill a decanter Empty a decanter Pour from one decanter to another until the one being poured to is full or the one being poured...
stackexchange_codegolf
Task Create a program or a function that is valid in multiple programming languages, and when compiled/interpreted as a different language outputs "Hello, World!" in a different natural language. For example, a valid solution might output Hello World! (English) when compiled and run as C, Hallo Welt! (German) when comp...
stackexchange_codegolf
Well the community is just a bot. But what if it would have been a person? Your task is to find what community's reputation might have been if it would have been given reputation for the edits it makes.(simply 2*edits) This should work for any site, but we would consider PP&CG for this question. Use any language, even ...
stackexchange_codegolf
A collection of N dimensional coordinates are provided. An example is below: {2,3,4} This can be thought of as a 3 dimensional array with 2x's, 3y's and 4z's; there may be any number of dimensions. In the example, there are 24 total nodes. Each node can be indexed using {x,y,z}. To access the 5th node, the provided in...
stackexchange_codegolf
The sci-fi shooter Destiny 2 contains guns which have the ability to regenerate ammunition directly into the magazine if, and only if x (precision) shots are landed (in a fixed amount of time), returning y bullets to the magazine. For example, the perk (ability) "Triple Tap" will return 1 bullet to the magazine if 3 pr...
stackexchange_codegolf
Introduction So my boss is making me do some manual labor...urgh...I have to take a part out a box of parts, process it and put it back in the box. To make this more interesting I try to sort the parts as I do this, as each part has a unique alphanumeric serial number. Unfortunately, I only have room to have four part...
stackexchange_codegolf
Given a square of text representing a spiral of characters, rotate it! The spiral starts at the center and moves counterclockwise to the outer edge, starting to the left of center: 987 216 345 This translates to the string 123456789. Rotation is done to the left, so if you rotate it one position, it will be 234567891....
stackexchange_codegolf
Challenge You just entered a room. Here's how it looks (you are the X): |\ /| | \/ | | X | | | |----| You challenge yourself to see if you can reach where you started by following the walls. You go right until you find a wall. Then, you turn clockwise until you are facing parallel to the wall. For example, if you...
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
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
The Kempner series is a series that sums the inverse of all positive integers that don't contain a "9" in their base-10 representations (i.e., \$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + .. + \frac{1}{8} + \frac{1}{10} + ...\$). It can be shown that, unlike the Harmonic series, the Kempner series converges (to a value ...
stackexchange_codegolf
Inspired by this. Given a string as input consisting of only upper and lowercase alphabet characters, wicka-wub it. How do I wicka-wub a string? The example text used is "DJMcMayhem". Split the string before each capital letter, so you get ["D", "J", "Mc", "Mayhem"]. Next, take the two halves of the list as sublists. T...
stackexchange_codegolf
An Armstrong number (AKA Plus Perfect number, or narcissistic number) is a number which is equal to its sum of n-th power of the digits, where n is the number of digits of the number. For example, 153 has 3 digits, and 153 = 1^3 + 5^3 + 3^3, so 153 is an Armstrong number. For example, 8208 has 4 digits, and 8208 = 8^4 ...
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
Challenge Imagine a hexagonal grid as shown below. Let's call such a grid has size \$n\$ if it has \$n\$ dots on one side. The following is one of size 3: - - - - - - - - - - - - - - - - - - - Then, pick as many dots as possible on the grid so that no two dots are adjacent. For size 3, the maximum is 7 dots: -...
stackexchange_codegolf
Write a program or function that takes in a single-line string. You can assume it only contains printable ASCII. Print or return a string of an ASCII art rocket such as | /_\ |E| |a| |r| |t| |h| |_| /___\ VvV with the input string written from top to bottom on the fuselage. In this case the input was Earth....
stackexchange_codegolf
These are ASCII dandelions: \|/ \ / | /|\ | \|/ | | | | _\|/_ | | | /|\ ASCII dandelions have three parameters: Length of the stem (positive number between 1 and 256, number of seeds (positive number between 0 and 7), and orientation (^ or ...
stackexchange_codegolf
Say I have an expression: 9 * 8 + 1 - 4 This expression can be interpreted in six different ways, depending on operator precedence: (((9 * 8) + 1) - 4) = 69 (* + -) ((9 * 8) + (1 - 4)) = 69 (* - +) ((9 * (8 + 1)) - 4) = 77 (+ * -) (9 * ((8 + 1) - 4)) = 45 (+ - *) ((9 * 8) + (1 - 4)) = 69 (- * +) (9 * (8 + (1 - 4))) = ...
stackexchange_codegolf
Bob got kidnapped and is stuck in a maze. Your job is to help him find a way out. But since it is a very dark and scary maze, he can't see anything. He can only feel walls when he runs in to it, and knows when he has found the exit, but doesn't know anything more that. Since he has to run your program by memory, it has...
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
A quote from MO.SE answer: Although it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to remember and useful in practice: In any given year, the following dates all fall on the same day of the week: 4/4, 6/6, 8...
stackexchange_codegolf
Given an integer k and either a block of text, or a 2d array that the inner arrays may have unequal lengths (that resembles a block of text), rotate every character or element in the k-th column up or down to the next position that exists. Example Rotate the 20th column of the following text (1-based): A line with more...
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
In this fastest-code challenge, you are provided with a set of \$n\$ identical blocks and need to determine how many unique buildings can be constructed with them. Buildings must satisfy the following rules: No overhangs - each block must either be on the ground or supported by one or more blocks directly underneath i...
stackexchange_codegolf
Challenge inspiration was this that I saw somewhere: The word "nun" is just the letter n doing a cartwheel Your challenge is to take a string and determine if it is the first letter doing a cartwheel. Rules A string is a letter doing a cartwheel if: The first letter is the same as the last letter. (The letter can't ...
stackexchange_codegolf
Let's plot a function f(x) = sin(πx) + 0.5 sin(3πx) over the domain [-3,3]. We can interpret this as a loose string lying on a board. Now let's drive n nails into the board at positions (x1, y1) to (xn, yn), where the xi ∈ (-3,3) and yi ∈ [-1,1]. Imagine that there are two eyelets at the end of the string, that is at p...
stackexchange_codegolf
Winner found It seems as if we have a winner! Unless anyone plans on contesting the world's current fastest Sudoku solver, user 53x15 wins with the staggeringly fast solver Tdoku. For anyone still working on their solvers, I'll still benchmark new submissions when I have time. The challenge The goal of a game of Sudoku...
stackexchange_codegolf
As per Luke's request and Peter Taylor's addition to this challenge. Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row loses. An interesting fact is that the maximum amou...
stackexchange_codegolf
Consider the problem of N queen on an (NxN) chessboard. Two queens are said to attack each other if they are on the same row, column, or diagonal. Implements backtracking algorithm to solve the problem i.e. place N non-attacking queens on the board.
stackexchange_codegolf
This challenge is based on a video in which Andrew Huang discusses unusual time signatures... https://www.youtube.com/watch?v=JQk-1IXRfew In it, he advises that you can understand time signatures by dividing them into 3's and 2's. So you count to a small number a few times, instead of counting to a large number. Here's...
stackexchange_codegolf
Write a program or function that takes in a positive integer N, and prints or returns an N×N ASCII art string whose top half is a semicircle made of ('s and whose bottom half is a downward-pointing triangle made of V's, with spaces used as padding. In other words, make an ASCII ice cream cone: (output for N = 17) ...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost). Santa is delivering presents to an infinite two-dimensional grid of houses. The delivery begins delivering a present to the ...
stackexchange_codegolf
Let's write the shortest code to perform a simplified variant of the DoD 5220.22-M Wipe Method with only two writing passes. Any programming language accepted, but the use of disk-wiping-oriented libraries is prohibited. Here's how we are to implement it in pseudocode: Set x to 0 [Start] 'Write Pass For each sector in...
stackexchange_codegolf
Inspired by a question (now closed) at Stack Overflow. Given a square matrix, let its double trace be defined as the sum of the entries from its main diagonal and its anti-diagonal. These are marked with X in the following examples: X · · X · X X · · X X · X · · X X · · · X · X · X · · · X · · · X · X · X · · · X No...
stackexchange_codegolf
One of your acquaintances has a hobby of making make-shift electrical gadgets using various types of batteries. However, since they're thrifty, they want to use as few batteries as possible for their projects. This challenge uses several types of batteries; your job is to output the fewest number of batteries that will...
stackexchange_codegolf
Recently, my reputation was 25,121. I noticed that each digit grouping (i.e. the numbers separated by commas) was a perfect square. Your challenge is, given a non-negative integer N and a unary boolean Black Box Function f : Z* → B , yield a truthy value if each value of f applied to the digit groupings of N is truthy,...
stackexchange_codegolf
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements: B or b = 8 E or e = 3 I or i = 1 S or s = 5 Let...
stackexchange_codegolf
Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'. Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order. However for each vowel aeiou, at least one of the progr...
stackexchange_codegolf
The idea for this code-challenge is simple: given a matrix of integers, let's sort it by applying Rubik-style movements. This means that you can select a single row or column and rotate its elements in any direction: [1, 3, 2, 4] => [3, 2, 4, 1] (rotate left for rows/up for columns) [1, 3, 2, 4] => [4, 1, 3, 2] (rota...
stackexchange_codegolf
Inspired by this StackOverflow post. Introduction Bob's job is to create spreadsheets and organize them. The way he organizes them is known to very few except for Bob, but he creates a list of each of the spreadsheets that fall under the same group. There's a bunch of data in the spreadsheet he creates, but there's o...
stackexchange_codegolf
This is a copy cat question of Simplify ijk string applied to the other nonabelian group of order 8. See also Dihedral group composition with custom labels. Challenge Given a string made of r and s interpret it as the product of elements of the dihedral group \$D_8\$ and simplify it into one of the eight possible value...
stackexchange_codegolf
Given, in any way and order, dimensions (in whichever order you want) a probability (in whatever format you want) number of iterations (you may choose whether to count the initial state or not) do one of the following: animate, or output each step of, or return a list of states of a spaces-filled sky of those...
stackexchange_codegolf
Print the following output of a happy coincidence addition pattern: 8 8 8 88 +888 ---- 1000 Rules: No leading spaces except the ones already present There can be a trailing newline + sign needs to be displayed Order of parcels needs to be the same No winner. It is code-golf per language.
stackexchange_codegolf
Display the remaining battery charge, as a percentage of maximum charge Remember if you can't run your code on a phone, calculator, etc, you can probably install your environment on a laptop at least. If you absolutely can't run on a device that has a battery, then unfortunately your language isn't eligible since you h...
stackexchange_codegolf
The formatting order of dates is one of the most complex and divisive issues the world faces today. Some of us vehemently argue that Month/Day/Year is appropriate, considering that's how we say dates out loud. Others loudly proclaim that Day/Month/Year is best, because it puts the terms in ascending order of the durati...
stackexchange_codegolf
Challenge: Find the number of distinct words in a sentence Your task is to write a program that takes a sentence as input and returns the number of distinct words in it. For this challenge, words are defined as consecutive sequences of letters, digits, and underscores ('_'). Input: A string containing a sentence. The ...
stackexchange_codegolf
Box blur is a simple operation for blurring images. To apply box blur, simply replace each pixel with the average of its and the surrounding 8 pixels' values. Consider, for example, the following example, in which each "pixel" has a one-digit value: \begin{array} {|r|r|}\hline 1 & 1 & 1 \\ \hline 1 & 7 & 1 \\ \hline 1 ...
stackexchange_codegolf
Introduction Alice is a 2-d language by Martin Ender which has two different execution modes, cardinal and ordinal. When the instruction pointer passes through a mirror (either / or \), it switches from one mode to the other one. In this challenge we will focus on ordinal mode, where commands operate on strings and the...
stackexchange_codegolf
If you have read in your childhood a Geronimo Stilton's book, I am sure that you remember the style of the text, sometimes the words were decorated for making the act of reading more funny for kids: example. But when you are an adult you don't have that little entertainment in your readings... why? In a nostalgic attac...
stackexchange_codegolf
The task is simple: Create an if-statement from scratch in x86 assembly that runs in as few clock-cycles as possible. Must be x86 assembly. Can't use any of the conditional jump/branch instructions (e.g. je, jne, jz, jg, jge, jl, jle). Can use jmp to jump to existing blocks of code. Can use cmp if necessary. Can't cal...
stackexchange_codegolf
To celebrate the island's next Founder's Day, colored filters (fuchsia, chartreuse, and aquamarine*) have been installed in every lighthouse. All lighthouses begin operation with their fuchsia filter, and they are all on the same color cycle: FCA, FCA, ... Each lighthouse changes its color filter after every ON blink,...
stackexchange_codegolf
This is a cops-and-robbers challenge the Cops' Thread can be found here Your challenge, as robbers is to take outputs from the cops' thread and find anagrams of the output that when run as a program output the original output provided. The winner will be the person with the most valid cracks on this question. Rules Yo...
stackexchange_codegolf
Write a quine with 1 or more rhyme scheme from http://en.wikipedia.org/wiki/Rhyme_scheme when read. The following characters are spoken aloud: any alphanumeric words or characters not in a comment; comparison and arithmetic characters (+ plus; - minus; * times, / divided by, | or, || or, & and, && and, ! not, = equals...
stackexchange_codegolf
Does your language have a maximum recursion depth (MRD)? Let's say your language has MRD=500 Write a code that finds the recursion depth and outputs the exact value For the case above your program (or function) should output 500 Code-Golf Shortest answer wins!
stackexchange_codegolf
I'm sure this is going to spark some controversy, but let's do a practical demonstration. The objective of this is simple, using the new code of conduct and no input, print out my pronouns ( "he/him", "he him" is also acceptable). Here's the challenge. This is a classical polyglot contest! This means that the first...
stackexchange_codegolf
Background A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail". Challenge Given a string a, and a word t, capitalise the correct letters of the w...
stackexchange_codegolf
For this challenge, you are to output the result of the sum of some numbers. What are these numbers? Well, you are given input, (a, b), which are integers (positive, negative, or zero) , a != b, and a < b , and each integer within a and b (including them) will have exponents according to the Fibonacci numbers. That's c...
stackexchange_codegolf
Given n, k, and p, find the probability that a weighted coin with probability p of heads will flip heads at least k times in a row in n flips, correct to 3 decimal digits after decimal point (changed from 8 because I don't know how to estimate the accuracy of double computation for this (was using arbitrary precision f...
stackexchange_codegolf
Based on How high can you count? let us give an advantage to the polyglot people. Challenge: Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on. You can not reuse any char...
stackexchange_codegolf
This is the cops' thread. For the robbers' thread, click here. Cops' Task First, write a quine in a language of your choosing. Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work. Post a...
stackexchange_codegolf
Introduction There have been a few examples of the smallest possible OCI container that does "X". However these examples never correctly handle termination signals. Challenge Produce the smallest possible container that correctly handles PID 1 signal responsibilities. The container does not need to manage child process...
stackexchange_codegolf
Problem Recreate the UI from a torrent program Given no input, output the following: +----------+----------+----------+ |a.exe |##########|seeding | +----------+----------+----------+ |b.exe 10% |# |leeching | +----------+----------+----------+ |c.exe |##########|seeding | +----------+----------+--...
stackexchange_codegolf