instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Conway's Game of Life is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
Any live cell with 2 or 3 living neighbours (the 8 cells immediately around it) lives ... | stackexchange_codegolf |
Consider the Tetris pieces, but made out of some number of (hyper)cubes instead of four squares, where two blocks are considered the same if one is a rotation, reflection, or translation of another. The goal of this challenge is to take two positive integer input values, n and k, and count the number of \$n\$-celled po... | stackexchange_codegolf |
The system
Assume the Earth is flat and that it extends infinitely in all directions. Now assume we have one infinitely long train railway and n trains in that railway. All trains have different speeds and all trains are going in the same direction. When a faster train reaches a slower train, the two trains connect (be... | stackexchange_codegolf |
Challenge
You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, 0 through 9. Your job is to find and output how many right triangles can be formed with the given numbers.
Rules
Numbers must be kept in the order they wer... | stackexchange_codegolf |
Write a program that takes a United States aircraft registration number and returns a 24-bit ICAO hex code corresponding to that registration and vice-versa.
An aircraft registration number always begins with an N and is followed by 1 to 5 characters: 1 to 5 digits and then 0 to 2 uppercase letters. That is, one of the... | stackexchange_codegolf |
This is the second version of the task. The original task had a defect that the given range of integers was too small. This was pointed out by @harold that other methods couldn't defeat the way of hard-coding all the possible prime divisors. Now you have a larger range of integers to test from 0 to 2000000. Also, the r... | 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 |
Lambda calculus is a system of computation based on single-argument functions; everything in it is such a function. Due to this functional nature, juxtaposition is commonly used to denote function application, grouped from left to right. For example, \$(f g) h=f g h\$ denotes what would conventionally be written \$(f(g... | stackexchange_codegolf |
A digit addition generator of an integer n is any integer x that satisfy the equation x + s(x) = n, with s(x) being the sum of the digits of x. (We will work under base 10 for convenience.)
For example, a digit addition generator for 29 would be 19, because 19 + (1 + 9) = 29. Some numbers have more than one generator. ... | stackexchange_codegolf |
A "simple circular" word is a word whose chords do not intersect. The chords of a word may be seen by laying out the alphabet in a circle, and then connecting the word's consecutive letters.
Examples of Simple Circular Words
ROLE
LAKE
BALMY
Failing Example
A word fails to be simple circular if any of its chords in... | stackexchange_codegolf |
We have objects that oscillate between two integer points, [l, r], at the speed of one unit per time unit, starting at l on t=0. You may assume l < r. For example, if an object oscillates on [3, 6], then we have:
t=0 -> 3
t=1 -> 4
t=2 -> 5
t=3 -> 6
t=4 -> 5
t=6 -> 4
t=7 -> 3
t=8 -> 4
Etc. But objects oscillate continu... | stackexchange_codegolf |
I came across this picture the other day: (Credit to Josep M Batlle I Ferrer)
Your job is to generate this picture. This graph is generated by repeatedly applying newton's method to the graph of:
$$f(x)=\cosh(x)-1$$
In other words, repeatedly apply the following function to every point till the rectangular distance is... | stackexchange_codegolf |
Not entirely sure if this one or a similar challenge has already been posted, but here it goes anyway.
Write a program that takes a string as input and writes its trucated/summarized output form such that a specific sep (separator) is placed in the middle, removing the necessary characters of the original string so tha... | stackexchange_codegolf |
Given an input of a string, output the partial fraction in string form.
The partial fraction decomposition of a rational fraction of the form \$\frac{f(x)}{g(x)}\$, where \$f\$ and \$g\$ are polynomials, is its expression as:
$$\frac{f(x)}{g(x)}=p(x)+\sum_j\frac{f_j(x)}{g_j(x)}$$
In this case \$p\$ is 0, because we ass... | stackexchange_codegolf |
Lists can contain lists and we have nested lists. But we don't like nested lists and want to flatten them. By flattening I mean create a list which does not contain any list, but elements of lists it contained before. I'll explain it more.
Input
An arbitrary size list which has the below properties:
it can contain int... | stackexchange_codegolf |
I have some JavaScript code in a <script> HTML tag I'd like to golf, while still remaining in the tag. How can I golf that code, if at all? Here's the code:
<script>document.write`<font color=#40e0d0 face=arial>YOU ARE IN THE BEDROOM.<br>YOU SEE CRAB NICHOLSON.<br>HE HAS NO MITTENS.<br>HIS CLAWS ARE... | stackexchange_codegolf |
Cubically is too tedious to manually write any code in. Your challenge is to translate ASCII text into Cubically source code.
Cubically
This is just a quick run-down of Cubically; the repository has a more complete guide and details.
Cubically is an esolang I wrote a while ago, designed to be painful to use. It contain... | stackexchange_codegolf |
Robbers thread
Your task is to create a method for hiding information in an image. You will post three encoded messages of your choice (keep them classy), each with its associated image. Reveal the messages for the first two images and do not reveal the third. Robbers have the task of determining what your third hidden... | stackexchange_codegolf |
Your job is to implement bitwise addition.
To ensure that this is done, you will compute and print the result of addition without carry (or bitwise XOR). Then, you will compute the carry of the addition (bitwise AND) and multiply it by two (bitwise left shift). If the carry is nonzero, then you add the carry and the pr... | stackexchange_codegolf |
Challenge
Detect the newest file in a specific folder and pass it as an argument to another process. The first argument to your program will be the folder, and the second argument will be the full path to the process.
Please specify the platform(s) your code works on.
Examples
Windows
newestfile "C:\Public_domain_movie... | stackexchange_codegolf |
Given the following input:
An integer n where n > 0.
A string s where s is not empty and s~=[0-9A-Z]+ (alpha-numeric capitals only).
Using a standard, simplified QWERTY keyboard (as shown below):
1234567890
QWERTYUIOP
ASDFGHJKL
ZXCVBNM
Perform the following operation:
Find the original row that each character is in... | stackexchange_codegolf |
I would like to see the shortest expression to calculate the days (or the last day) of a month in any language.
Considering y as the number of year and m as month.
Basic rules
without date / time functions.
considering leap years.
there is not other rule.
| stackexchange_codegolf |
This is the Robbers thread. For the Cops challenge, see here
As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, in which order, the cop used.
Note that a crack is valid even if the languages are different. So long as the the language... | stackexchange_codegolf |
I haven't. :P So I decided to define one:
A tralindrome is a string which contains three equal-length sections X, Y, Z such that
all characters in the string are included in at least one of the three sections,
X starts at the first character, Y starts at or right after the last character of X, and Z starts at or right... | stackexchange_codegolf |
Whilst trying to golf several of my answers, I've needed to write large integers in as few characters as possible.
Now I know the best way to do that: I'll be getting you to be writing this program.
The challenge
Write a program that when given a positive integer, outputs a program that prints it to stdout or equivale... | stackexchange_codegolf |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... | stackexchange_codegolf |
Challenge
Given a string with any characters a-z or A-Z, return an 'encrypted' string, where all characters are replaced by the character next to it (assuming a QWERTY keyboard).
Case (uppercase, lowercase) does not matter.
The input will only have characters a-z and A-Z.
Shortest code in bytes wins.
Example Input a... | stackexchange_codegolf |
This is the Robber post. The Cop post is here.
Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942.
The sequence consists of the square numbers written backwards:
1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ...
Note that leading zeros are trimmed away (100 becomes 1, not 00... | stackexchange_codegolf |
Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value.
If input \$x\$ is an integer, the program should output it as is. If \$x\$ is not an integer, the program has a \$x-\left\lfloo... | stackexchange_codegolf |
Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example,
-10 == -64 - 64 + 64 + 27 + 27
so for input -10 you could output [-64, -64, 64, 27, 27], though other solutions are possible. Note that you should output the cubes, not the numbers be... | stackexchange_codegolf |
In this challenge you are asked to find in how many ways we can express a positive integer n as the sum of two positive integers k and the reverse of k.
Here is an example using n = 1069 :
188 + 881 = 1069
287 + 782 = 1069
386 + 683 = 1069
485 + 584 = 1069
980 + 89 = 1069
So, the answer here would be 5.
rules
As you ca... | stackexchange_codegolf |
Let us assume that we have number X.
Let us assume that we have positive integer "components" (C) of this X number.
We can add these components together like C1+C2+...+Cn = X.
We have N as limit of number of components.
We have B as limit of biggest component
Distribution: if we have [8;8;5] then avg of components is ... | stackexchange_codegolf |
This challenge is a simple ASCII-art challenge inspired by the solar eclipse that happened on August 21, 2017. Given an input 0 <= n <= 4, output the corresponding stage of the eclipse described below:
n=0:
*****
** **
* *
* *
** **
*******
n=1:
*****
** *****
* *******
* *****... | stackexchange_codegolf |
There is a 3x3 square block made of 1x1 square blocks, with coins in each 1x1 block, starting from top left block you want to collect all the coins and return to top left block again, if possible provide instructions to achieve this.
Rules
From block \$(x,y)\$ in one step you can move right(R) to \$(x,y+1)\$ ,left(L) ... | stackexchange_codegolf |
This is the cops' thread. The robbers' thread is here.
Your challenge is to make a program that runs forever without halting1, unless it gets a particular input or inputs2. If it receives that input, it must terminate in a finite amount of time3. This is code-golf, so the shortest answer that has not been cracked by a ... | stackexchange_codegolf |
Description
While support is getting better and better for people to write in various scripts around the world using unicode, and now you can even write in emojis as well, unfortunately most fonts[citation needed] are still missing Latin characters based on the double acute accent, which is required to write properly i... | stackexchange_codegolf |
Abracadabra is a magic word. To make it even more magical, let's make several alterations to how it may be written:
Change the casing for any subset of characters; for example: aBrAcAdAbRa
Append an exclamation mark to it: abracadabra!
Change each occurrence of a into a different vowel: ybrycydybry
Change any single c... | stackexchange_codegolf |
Input
The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars across the world. What could be easier?
Output
The Gregorian date of the first evening of Hannukah that year. That is the ... | stackexchange_codegolf |
The shortest code to generate the correct times on the clocks wins.
You are a seasoned time traveler and have been known to stop at many planets during your journies. Each planet rotates at a different rate and because of this, the length of a day is different than our usual 24-hour day. As a result, the planets use ... | stackexchange_codegolf |
Note to mods, if the title doesn't do justice, change it to whatever, I thought it was funny.
You're tasked with hanging up the lights for this Christmas season, and your family has decided that for it to be a merry Christmas, you need to hang at least 2 Christmas lights on your house. So, your challenge is, given a n... | stackexchange_codegolf |
Inspired by this challenge.
Goal:
Given a pre-configured switchboard and a list of indexes, invert the switches at the given indexes.
A switchboard is made up of some number of switches (v or ^) wrapped in -'s and arranged into rows of varying length. Here is an example switchboard:
-v-^-v-
-^-v-
-v-^-v-
To invert/fli... | stackexchange_codegolf |
Background
Tetris Grand Master 3 has a hidden grading system based on the shape of the stack at the end of the game, which is called Secret ">" Stacking Challenge. It consists of entirely filling the lowest rows except for the zigzag pattern which starts at the left bottom cell and spans the entire width:
#
.#########
... | stackexchange_codegolf |
A finite-permutation is a function which takes an \$n\$-tuple and produces an \$n\$-tuple such that every element of the input is present in the output, and the ordering does not rely on the values of the inputs.
We can unambiguously represent these permutations with an \$n\$-tuple where each element is the index of wh... | stackexchange_codegolf |
What are some tips for golfing in Turing Machine But Way Worse, a language made by MilkyWay90 and ASCII-only?
Tips should be Turing Machine But Way Worse-specific and not be trivial (For examples that you shouldn't post, removing unnecessary whitespace or using shorter state names).
EDIT: Added documentation to TMBWW
| stackexchange_codegolf |
Given an array of integers, find "the next to the middle".
The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is neither the mean, median or mode and is also contained in the array.
For example, in the following array
[ 7, 5, 2, 8, 0, 2, 9, ... | stackexchange_codegolf |
Background
You may be aware that periods in between letters in gmail addresses are ignored. Email sent to example@gmail.com, exam.ple@gmail.com, and e.x.a.m.p.l.e@gmail.com all end up in the same place!
This is a great way to have multiple different emails addresses for things like signing up for free trails, or filter... | stackexchange_codegolf |
A convenient and useful way to represent topological surfaces is with a fundamental polygon. Each side on a polygon matches to another side and can be either parallel or anti-parallel. For instance the here is the fundamental polygon of a torus:
To figure out why this is a torus we could imagine our polygon being a ... | stackexchange_codegolf |
Given an input string, output at random the unique combinations with repetition of the characters in the input string, from length 1 up to the length of the input string, with an equal chance of each one occurring.
Example: given the input abcd (or any combination thereof of the four characters a,b,c,d) , there is an e... | stackexchange_codegolf |
The goal is to produce a single line of R code that:
Does as little as possible
In as many characters as possible (max of 100 characters)
And is as ugly as possible (where "ugly" can be taken to mean inefficient computational strategies, extraneous characters such as a terminating semicolon, and so forth).
Do your wo... | 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 |
Because there are not enough simple code-golf challenges:
Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with a pseudo-random probability of 1/N, False otherwise.
Please note that the requirement for naming has been removed. Feel ... | stackexchange_codegolf |
Description :
Given an array of strings representing a grid of cells
With the key :
0 = 'dead cell'
1 = 'live cell'
write a function that returns the next iteration following the rules of Conway's Game of Life .
Rules
Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
Any live ... | stackexchange_codegolf |
Right hand brace is a style of code bracketing in which curly braces and semicolons are all aligned to a single point on the right side of a a file.
Generally, this is considered bad practice, for several reasons.
The Challenge
Take a multiline string through any method, and convert it's brace style to Right Hand Brac... | stackexchange_codegolf |
Given an ordered list of same-case letter strings (a-z XOR A-Z) where each string is preceded by 0 or more space ( ) characters, output the same list but with the strings sorted at each level of indentation. Indentation depths under different parents count as distinct lists for sorting purposes.
Example
If your input i... | stackexchange_codegolf |
Definition
If you take the sequence of positive integer squares, and concatenate them into a string of digits (i.e. 149162536496481100...), an "early bird" square is one that can be found in this string ahead of its natural position.
For example, 72 (the number 49), can be found at an offset of 2 in the string, althoug... | stackexchange_codegolf |
Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII carrier as input, and return or print a package that is identical to the carrier except characters corresponding to the mes... | stackexchange_codegolf |
Given two strings, find the translation table (substitution cipher) between the two, if the translation is not possible, output false. The answer must be minimized and created from left-to-right. The first character to be translated between words must be the first in the translation table. In addition to this, any lett... | stackexchange_codegolf |
This is Pascal's Braid:
1 4 15 56 209 780 2911 10864 40545 151316 564719
1 3 11 41 153 571 2131 7953 29681 110771 413403 1542841
1 4 15 56 209 780 2911 10864 40545 151316 564719
I totally made that up. Blaise Pascal didn't have a braid as... | stackexchange_codegolf |
Given a atomic number, print how many electrons are in each shell of the element that the atomic number corresponds to.
Expected input/output:
Input -> Output
1 -> 1
2 -> 2
3 -> 2, 1
4 -> 2, 2
5 -> 2, 3
6 -> 2, 4
7 -> 2, 5
8 -> 2, 6
9 -> 2, 7
10 -> 2, 8
11 -> 2, 8, 1
12 -> 2, 8, 2
13 -> 2, 8, 3
14 -> 2, 8, 4
15 -> 2, 8... | stackexchange_codegolf |
I wrote this function in 48 bytes and I wonder, is there any way to write this code 2 characters shorter?
p=lambda n,c:(n*c)[:n//2]+(n*c)[:n//2+n%2][::-1]
The point of the function is to create a palindrome of length n by using all the characters from the string c. Example: n = 3, c = 'ab'. Result is 'aba'.
Is there s... | stackexchange_codegolf |
A Fragile Quine
A fragile quine is a quine that satisfies the property of having each substring made by removing a single character, when evaluated, produces an error.
For example. If your program asdf is a quine, then for it to be fragile, the following programs must error:
sdf
adf
asf
asd
Your program (and all of it... | stackexchange_codegolf |
Introduction
Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this:
xxxyy-OEM-NNNNNNN-zzzzz
The day can be anything within 001-366, and the year cannot be lower than 95 or above 03.
xxx represents the day of the year the key was printed on (for exa... | stackexchange_codegolf |
Rule 110 is a cellular automaton with some interesting properties.
Your goal is to simulate a rule 110 in as few characters as possible.
For those who don't know, rule 110 is simulated line by line in a grid. Each square in a line of the grid looks at the squares above, above-left and above-right to determine what cel... | stackexchange_codegolf |
(via chat)
The OEIS entry A123321 lists the sequence of numbers that are the product of seven distinct primes. For brevity, we'll call this a 7DP number. The first few numbers and their corresponding divisors are below:
510510 = 2 * 3 * 5 * 7 * 11 * 13 * 17
570570 = 2 * 3 * 5 * 7 * 11 * 13 * 19
690690 = 2 * 3 * 5 * 7 *... | stackexchange_codegolf |
Given an input of a string, output the partial fraction in string form.
The partial fraction decomposition of a rational fraction of the form \$\frac{f(x)}{g(x)}\$, where \$f\$ and \$g\$ are polynomials, is its expression as:
$$\frac{f(x)}{g(x)}=p(x)+\sum_j\frac{f_j(x)}{g_j(x)}$$
In this case \$p\$ is 0, because we ass... | stackexchange_codegolf |
I've looked and could not find a post for this, if there is one, I'll remove it quick! Related and also related
The goal is (hopefully) clear: create the shortest code (in bytes) that implements the AES256 ECB cipher mode. Either convert the result to Base64 or output a array of bytes. The input contains two parts. The... | stackexchange_codegolf |
Since jq is the Language Of The Month for September 2021, what general tips do you have for golfing in jq? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to jq (e.g. "remove comments" is not an answer).
Please post one tip per answer.
| stackexchange_codegolf |
Let's start by defining a reflection of a character in a string:
Given a string with distinct lowercase alphabetical letters with no spaces such
as abcdefg, define a reflection of a letter in the string c as
moving it (without changing the order of any other letter) to a new
place in the string such that the num... | stackexchange_codegolf |
Introduction
I don't particularly know where the fizz buzz trend came from. It might just be a meme or something, but it is somewhat popular.
Challenge
Your job today is to convert Fizz Buzz into binary (0, 1) respectively, and convert that binary to text. Pretty standard stuff.
How does that work?
FizzBuzzBuzzFizzBuzz... | stackexchange_codegolf |
This seems almost trivial, but since after some effort I was not able to beat the literal solution in J, I thought it might make a decent challenge (though, to be clear, this is not a J-specific challenge).
Title says it all. You simply need to write a program, or function (taking no arguments) that returns or prints:... | stackexchange_codegolf |
For a given positive integer n, consider all binary strings of length 2n-1. For a given string S, let L be an array of length n which contains the count of the number of 1s in each substring of length n of S. For example, if n=3 and S = 01010 then L=[1,2,1]. We call L the counting array of S.
We say that two strings S... | stackexchange_codegolf |
Not to be confused with Password Bishop Goodness!
Given a string, answer (truthy/falsy or two consistent values) if it constitutes a password which is strong against bishops.
A password is strong against bishops if it is a string consisting of alternating letters (in a-h) and digits (in 1-8) such that each pair of char... | stackexchange_codegolf |
Hexagonal tessellations, or tilings of the plane, are three-colorable -- meaning that using only three colors, such as Red, Blue, and Green, every hexagon can be colored without any two hexagons that share a border sharing a color. A partial example showing such a pattern.
Given a partial hexagonal tiling in ASCII (via... | stackexchange_codegolf |
Input:
An NxM grid or multi-line string (or other reasonable input-format), containing only printable ASCII (unicode range [32,126]).
Output:
The amount of closed polygons of the same character that can be found, with two special rules:
Spaces are wildcards and can be used (multiple times) for any character
o, O, and ... | stackexchange_codegolf |
The Goldbach conjecture states that:
every even number that is greater than 2 is the sum of two primes.
We will consider a Goldbach partition of a number n to be a pair of two primes adding to n. We are concerned with numbers is of increasing Goldbach partition. We measure the size of a number's Goldbach partitions ... | stackexchange_codegolf |
Introduction
The Parsons code is just a simple way to describe pitch variations in a piece of music, whether a note is higher or lower than the previous one.
Even if you suck at remembering tunes, you can still pretty much remember if a note goes up or down, thus the Parsons code can help you to identify a music using ... | stackexchange_codegolf |
A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ragged matrix.
Input:
A list of ragged lists (can be empty) of positive integers and a target range e.g. 26-56. The tar... | stackexchange_codegolf |
The challenge
Given positive integer input n (n>1), calculate the array of unique factorizations of n, not including 1. Order does not matter.
Test cases
2 => [[2]]
3 => [[3]]
4 => [[4],[2,2]]
5 => [[5]]
6 => [[6],[2,3]]
7 => [[7]]
8 => [[8],[2,2,2],[2,4]]
9 => [[9],[3,3]]
10 => [[10],[2,5]]
11 => [[11]]
12 => [[12],[3... | stackexchange_codegolf |
Background
SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely S, K, and I instead of lambda abstraction. Unlike lambda calculus, beta reduction is possible only when a combinator is given enough arguments to reduce.
T... | stackexchange_codegolf |
In Russia we have something like a tradition: we like to look for lucky tickets.
Here's what a regular ticket looks like:
As you can see, the ticket has a six-digit number.
A six-digit number is considered lucky if the sum of the first three digits is equal to the sum of the last three.
The number on the photo is not... | stackexchange_codegolf |
A palindrome is a word that is its own reverse. I will define the left palindromic root of a word as the shortest prefix of the word for which the shortest possible palindrome that begins with that prefix is the original word. So the left palindromic root of racecar is race and the left palindromic root of ABBA is ABB.... | stackexchange_codegolf |
(Based on this Math.SE problem, which also provides some graphics)
I have a stick which looks kinda like this:
I want it to look kinda like this:
I'm not an expert painter, however, so before I start such an ambitious DIY project, I want to make sure that I'm not in over my head.
Your program should tell me how how ... | stackexchange_codegolf |
In this challenge, you will receive an input, convert it to hexadecimal, make a couple changes, and output the result.
Because they are only 16 characters in hexadecimal, your code will need to be as short as possible.
Examples
Examples are separated by a blank line. First line is input, second line shows the steps, t... | stackexchange_codegolf |
Your challenge is to write a program that constantly prompts for input, and when input is given, output that five seconds* later. However, your program must continue prompting for input during that time.
Since this is a bit confusing, here's a demo.
<pre id=x></pre><input id=h onchange='var k=this;(()=>{let a=k.value... | stackexchange_codegolf |
Black Box is a board game, Your task is to reveal all clues.
What is black box
Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues.
I/O
Input
The atoms can be any 1-char that is not newline (Used for separator) Like this.
O....
...O.
..O..
.....
....O
Output
When the code... | stackexchange_codegolf |
Write a program that takes in an integer N via stdin or the command line.
If N is 0, the single letter O must be printed to stdout.
If N is positive, this horizontal ASCII art double helix, drawn N segments wide, must be printed.
If N is 1, the output is:
/\
O O
\/
If N is 2, the output is:
/\ /\
O / O
\/ \/
... | stackexchange_codegolf |
Provided that the input is a monotone sequence of three or more integers:
Output -2 if the sequence strictly decreases. Example: [7,4,3,2]
Output -1 if the sequence monotone decreases but is neither strict nor constant. Example: [6,5,5]
Output 0 if the sequence is constant. Example: [0,0,0]
Output +1 if the sequenc... | stackexchange_codegolf |
The goal of radiation hardening is to make a program still work after you remove a byte. However, what if a skilled competitor is purposefully trying to mess with you?
In this game, each bot will take turns removing one character from the next bot down the line. If the bot fails to produce valid output next turn you ga... | stackexchange_codegolf |
Given an integer \$n > 1\$, output a balanced binary tree with \$n\$ leaf nodes.
The tree should be constructed out of (space), \ and / (slashes). Each slash represents a branch.
A node is represented by adjacent slashes: /\. There must be a root node at the top of the tree (i.e. the first row of the output).
To con... | stackexchange_codegolf |
I'm always forgetting Pokemon type matchups. This is a challenge to print the pokemon type chart!
Attacking Type
No Fi Fl Po Gr Ro Bu Gh St Fr Wa Gr El Ps Ic Dr Da Fa
Normal 1.0 2.0 1.0 1.0 1.0 1.0 1.0 0... | stackexchange_codegolf |
Rules
You will receive as input a list that contains integers and strings. Your task is to move all of the strings to the end of the list and all of the integers to the beginning of the list.
This is code-golf so the answer with the least number of bytes wins.
| stackexchange_codegolf |
The Blow-up is a powerful tool in algebraic geometry. It allows the removal of singularities from algebraic sets while preserving the rest of their structure.
If you're not familiar with any of that don't worry, the actual computation is not difficult to understand (see below).
In the following we are considering the ... | stackexchange_codegolf |
Some of you may have heard of the Wargame series of computer based real time strategy game. These games pit teams of players with primarily cold war era units to see how a hot cold war would have played out. The goal of this challenge is to simulate a tank battle in these games.
Input
Two "tanks" (one red and one bl... | stackexchange_codegolf |
The prospect of this challenge is:
If your program is run normally, all of the code in the speech marks (" - double quotes) should be printed.
If your program is wrapped in double quotes (in turn inverting the speech marks), the code that is normally not in quotes should be printed.
E.g:
Let's say you have the follow... | stackexchange_codegolf |
Introduction
So John finally has his holidays! And what better could he do than watching some movies. He indeed has a lot of movies to watch, but he is unable to decide which one to watch first. He has a list of movies, each in the format: <Movie name> (<Year>). So he makes a simple set of rules to decide his order of ... | stackexchange_codegolf |
pylint has no lower bound on the scores it will give your code. It uses the following metric to score code, with the maximum score being 10:
10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
With python 3.6, try and write a program that:
Outputs "Hello World" when run from the command lin... | stackexchange_codegolf |
(l, r) defines a line whose left end is at l and the right end is at r, on a 1-dimensional space.
Given 2 lines b = (0, bz) and f = (i, i + fz), v = (l, r) is the overlapping part of these lines. When b and f do not overlap (when v cannot have a positive length), v = (0, 0).
(input) -> (output)
bz, fz, i -> l, r
The... | stackexchange_codegolf |
Your challenge is to write a program to solve a 3x3x3 Rubik's Cube. This challenge is based on this one from 2013, rewritten to adhere to current community standards, and reposted with the original author's permission and help on meta.
Input
The input should represent an unsolved Rubik's Cube.
You may read this input v... | stackexchange_codegolf |
Background
In Boggle, a round is scored by adding up the points for each unique word a player has found (i.e. any word that more than one player has found is worth 0 points). The points are calculated based on the number of letters in each word, as follows:
3 letters: 1 point
4 letters: 1 point
5 letters: 2 points
6 le... | stackexchange_codegolf |
Introduction
This challenge was inspired by a seemingly simple task requested at work that couldn't easily be done in Microsoft Teams. At least not from what we could find!
Task
Your task, if you choose to accept it, is to output the last week day of any month in any year.
Input
You can input the desired month/year in ... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.