instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Long time ago, when I was spending more time playing RPG, one of the issues what some players had, was to track party movement and to draw proper map.
So I come with idea, to check how you guys come deal with this issue.
Task is to write a function, which takes as input parameter list of directions (passed as structure... | stackexchange_codegolf |
Tichu is a card game in which players take turn playing sets of cards from a deck consisting of a standard 52-card deck, plus 4 additional cards:
the dragon, which has a greater value than any other card
the phoenix, which can act as a wildcard
the dog, which passes the turn to your partner
the Mah Jong, which has val... | stackexchange_codegolf |
Challenge
You will be given an input string, anywhere the word "Lemon" is found it should be converted to "Lemonade" but the a, d, and e must be borrowed from somewhere else in the sentence.
Example
Example Input:
I found a lemon when I was a kid
Example Output:
I foun a lemonade whn I was kid
The Lemonade was c... | stackexchange_codegolf |
From Wikipedia, Gabriel's Horn is a particular geometric figure that has infinite surface area but finite volume. I discovered this definition in this Vsauce's video (starting at 0:22) where I took the inspiration for this problem.
You begin with a cake (a cuboid) of dimension \$x \times y \times z\$. In your first sli... | stackexchange_codegolf |
I'm making a page selector for my super cool terminal-based blog program. In order for it to fit correctly into the design, it has to have some constraints.
The page selector can only display a certain number of numbers at a time due to the constraints of the UI system. If there are more characters then can fit, they m... | stackexchange_codegolf |
Input:
An integer.
Output:
First convert the integer to it's equivalent Roman Numeral.
Then convert each capital letter of that Roman Numeral to their ASCII/UNICODE decimal value.
And output the sum of those.
Example:
1991 -> MCMXCI -> 77+67+77+88+67+73 -> 449
^ input ^ output
Roman Nu... | stackexchange_codegolf |
Write a Java method to check if a given string matches any value in a given enum.
Your method will take two parameters, one a string and one an enum, and return true if the string representation of any of the enum's elements matches the given string, or false otherwise. Note that your method should still function norma... | stackexchange_codegolf |
Write a program or a function that accepts the list of outputs from a logic function and outputs the LaTeX code for its truth table.
The inputs should be labeled as lowercase letters a-z, and the output should be labelled as F. The length of list of inputs will always be shorter than 2^25, which means that number of in... | 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 |
Austin: "Who sent you?"
Mustafa: "You have to kill me!"
Austin: "Who sent you?"
Mustafa: "Kiss my ass, Powers!"
Austin: "Who sent you?"
Mustafa: "Dr. Evil."
(...)
Mustafa: "I can't stand to be asked the same question three times. It just irritates me."
You are to simulate a short dialogue in the spirit of Austin Pow... | stackexchange_codegolf |
Recamán's sequence (A005132) is a mathematical sequence, defined as such:
$$A(n) = \begin{cases}0 & \textrm{if } n = 0 \\
A(n-1) - n & \textrm{if } A(n-1) - n \textrm{ is positive and not already in the sequence} \\
% Seems more readable than
%A(n-1) - n & \textrm{if } A(n-1) > n \wedge \not\exists m < n: A(m) = A(n-1)... | stackexchange_codegolf |
Background
I want to display rich, vibrant images on my theoretical fancy custom display, but due to budget constraints, it displays everything in 3-bit colour! Whilst Regular Dithering would work, I don't want to sacrifice resolution, so I would like my images to be dithered through time!
Specs
Provided an Input Image... | stackexchange_codegolf |
This is an answer-chaining question, which means that all answers are affected by those before them.
The task
The n-th answer to this question must run in all languages that are present in answers before it. They need not run in order, but must print the name of the language currently running, reversed.
Additional rule... | stackexchange_codegolf |
Problem
John bought 5 apples. You are given the weights of every group of four apples, and must then find the weights of the apples themselves.
For example, if all apples without the first one weigh 798 g, without the second - 794 g, without the third - 813 g, without the fourth - 806 g, and without the fifth - 789 g, ... | stackexchange_codegolf |
We do seem to have a fastest square root challenge, but it's very restrictive. In this challenge, your program (or function) will be given an arbitrarily sized nonnegative integer, which is the square of an integer.
Input
You may take input in any normally allowed way, including (but not limited to) an arbitrary sized ... | stackexchange_codegolf |
Inspired by a recent Daily WTF article...
Write a program or function that takes a GUID (string in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, where each X represents a hexadecimal digit), and outputs the GUID incremented by one.
Examples
>>> increment_guid('7f128bd4-b0ba-4597-8f35-3a2f2756dfbb')
'7f128bd4-b0ba-45... | stackexchange_codegolf |
As the June 2021 Language of the Month is Red, what are some general tips for golfing in Red language?
Please suggest tips that are at least somewhat specific to Red (e.g. "remove comments" isn't a valid tip here).
Please one tip per answer!
| stackexchange_codegolf |
Supreme Sum String
Given an input string, return the word with the highest sum of each of its unicode characters.
Rules
The input should be seperated by whitespace
The value of each word is based on the sum of each character in the word's UTF-16 code
The output should be the first word with the highest value (in case... | stackexchange_codegolf |
Take the decimal number \$0.70710678\$. As a fraction, it'd be \$\frac{70710678}{100000000}\$, which simplifies to \$\frac{35355339}{50000000}\$. If you were to make the denominator \$1\$, the closest fraction is \$\frac{1}{1}\$. With \$2\$, it'd be \$\frac{1}{2}\$, and with \$3\$ it's \$\frac{2}{3}\$. Because \$0.\bar... | stackexchange_codegolf |
My stovetop has 10 (0 through 9) different settings of heat and a very odd way of cycling through them.
It always starts at 0
When I hit plus it increments the number, unless the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9.
When I hit minus it decrements the number, unless t... | stackexchange_codegolf |
A huge storm is ravaging the world and as you and your family run away from it, you come across a gigantic shelter run by a girl. She tells you that "she sells sanctuary" and that different types of rooms are offered at different prices.
A room may only house one person.
The challenge
Write a program which takes in two... | stackexchange_codegolf |
The goal of this challenge is to determine if a move is a legal English Checkers move.
This challenge will use an 8x8 board. A moved piece should be treated as a man (not a king) that can only move diagonally forward. The board will have 0 or more black pieces and 1 or more white piece. One white piece will be current... | stackexchange_codegolf |
Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this file one character at a time, and at each step must guess the next character.
This is code-challenge. Your score will be
2... | stackexchange_codegolf |
Given a string as input, output the US state whose capital it is if it is a state capital, the capital of the state if it is a state, or Arstotzka if it is neither.
Examples:
Austin -> Texas
Alaska -> Juneau
The Nineteenth Byte -> Arstotzka
All the capitals and their respective states:
Baton Rouge, Louisiana
Indianapo... | stackexchange_codegolf |
The task
This is a simple challenge.
Your input is a single non-empty string, containing only digits 0123456789 and hashes #.
It will contain exactly one run of digits, which encodes a nonnegative integer and may wrap around the end of the string, and at least one #.
The integer may have leading zeroes.
For example, ##... | stackexchange_codegolf |
The challenge
How well can you gerrymander North Carolina into 13 voting districts?
In this challenge, you use the following files to draw different maps for Republicans and Democrats.
File 1: NC_2016_presidential_election.csv
File 2: NC_county_adjacency.csv
File 1 gives county-level voting data from the 2016 president... | stackexchange_codegolf |
Background
Sometimes, people think you didn't work at your git project. But - you can prove yourself with git shortlog -n. Now, the problem is you are a programmer and programmers are lazy. So you want to write a program which shows the person who committed at most.
Rules
You may not do the following things:
use git s... | stackexchange_codegolf |
Gaussian blur is a method used for blurring images smoothly. It involves creating a matrix which will be used by convolving it with the pixels of an image. In this challenge, your task is to construct that matrix used in Gaussian blur. You will take an input r which will be the radius of the blur and an input σ which w... | stackexchange_codegolf |
There's a visual method for multiplication that is taught to Japanese schoolchildren [citation needed] that uses lines and crossings to get the answer.
Image Source
Your task is to implement this in ASCII art. You will be given two numbers to multiply. The output should be the corresponding ASCII art made up of \, /, ... | stackexchange_codegolf |
Background
With the success of Simple Boolean Algebra Calculator, I present a more difficult problem.
Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used:
Above is what actual boolean algebra looks like. For the purposes of this... | stackexchange_codegolf |
This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty.
Like last time, you are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that ... | stackexchange_codegolf |
Challenge
Given a list of positive integers, find if there exists a permutation where taking up to one bit from each of the integers, a binary number consisting of all 1s can be created.
The number of bits in the resulting binary number is equal to the highest MSB in the list of integers.
Output
Your code must output o... | stackexchange_codegolf |
Sociable numbers are a generalisation of both perfect and amicable numbers. They are numbers whose proper divisor sums form cycles beginning and ending at the same number. A number is \$n\$-sociable if the cycle it forms has \$n\$ unique elements. For example, perfect numbers are \$1\$-sociable (\$6\to6\to\cdots\$) and... | stackexchange_codegolf |
Intro
Given radius \$r\$, draw a circle in the center of the screen.
Sandbox.
The Challenge
Here is a simple challenge.
Plot a circle using the formula \$x^2+y^2=r^2\$, or any other formula that will plot a circle according to the given parameters.
You may use any units that your language provides, so long as they are ... | stackexchange_codegolf |
As in this question, your task – should you choose to accept it – is to calculate the date of Easter Sunday according to the Gregorian Computus (as used in the Catholic Church and most others) when provided with only a year number as input, in as few characters as possible without relying on Easter-specific date functi... | stackexchange_codegolf |
You will be given as input an infinite stream of positive integers.
Your task is to write a program which outputs an infinite sequence of lists with two requirements:
All lists in the output are finite sub-lists of the input stream.
Every sub-list must be output eventually by your program.
Sub-lists are not necessari... | stackexchange_codegolf |
A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a mat. Below are some sample looks:
Column 9 by Row 7
Symbol 1: @
Symbol 2: -
Input: 9 7 @ -
@@@@@@@@@
@-------@
@-@@@@@-@... | stackexchange_codegolf |
In this challenge, you'll need to edit a grid of characters to make a program that does a task, while ensuring that you leave a lasting mark on the grid.
Task
The task to perform is determined by when you answer. Specifically, for the nth answer, divide n by 5, and if the remainder is...
0. Read a positive integer fro... | stackexchange_codegolf |
We have a lot of IPV4 address, to group into subnets, so we need a tool for doing this:
Our list is very ugly, not ordered and sometime in subnet notation, sometime in simple address.
Sample:
192.168.5.16/30
192.168.5.18
192.168.2.231/27
192.173.17.0/24
192.168.1.5/32
192.168.5.18/32
192.168.3.0/24
192.168.2.231/27
192... | stackexchange_codegolf |
Conways' 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 |
Your input is an array of integers in the range [-1,4]. An array element of -1 means that there might be a bomb in that position. A non-negative element means that there is not a bomb in that position and also the numeric value tells how many bombs there are within distance 2.
For example, if we have the following arra... | stackexchange_codegolf |
What does "jelly" mean in the title?. Robber's thread
Jelly has an "Evaluate the argument as Python 3" atom, ŒV which takes a string as an argument as evaluates that string as Python 3 code: Try it online!.
It also has compressed strings, delimited with “...» that can compress any string containing printable ASCII (plu... | stackexchange_codegolf |
Scientists have made contact with a parallel universe. Just one problem: They write math differently. Help the scientists make a program that can convert normal math expressions to their equivalent in alternate universe math. The connection through the portal is bad so your code needs to be as short as possible
Given a... | stackexchange_codegolf |
Classic Tetris was often a difficult game to play. One problem was that you could only work with the Tetris piece you were given, so if you had an awkward board, it would sometimes be difficult to find a suitable location to put your piece. Another problem was that you could only look one piece ahead, so it was difficu... | stackexchange_codegolf |
This challenge is pretty simple. As input, you take in a regular expression.
Then, you output a truthy/falsey of whether or not your source code matches the regular expression. It's that simple! Just two more things:
No quine builtins; you may, however, access the code's source code by file IO, etc.
This is code-golf,... | stackexchange_codegolf |
The Dottie number is the fixed point of the cosine function, or the solution to the equation cos(x)=x.1
Your task will be to make code that approximates this constant. Your code should represent a function that takes an integer as input and outputs a real number. The limit of your function as the input grows should b... | stackexchange_codegolf |
There is a job which can be decomposed into x equally-sized smaller tasks. You have a team of size y <= x, where every member works equally fast on any task. The goal for this challenge is to divide the work as evenly as possible such that every member of your team has at least 1 task to perform. As evenly as possible ... | stackexchange_codegolf |
Challenge
Print the numbers:
1
22
333
4444
55555
666666
7777777
88888888
999999999
In that order.
I/O
Takes no input. The numbers can have any delimiters desired (or none). That includes lists, cell arrays, .jpeg, etc.... Example outputs:
122333444455555666666777777788888888999999999
[1,22,333,4444,55555,666666,77777... | stackexchange_codegolf |
Background
You have again been given the task of calculating the number of landmines in a field. However, we have now travelled into the flatlands.
You must calculate the landmine score given a list/string of numbers (which will be 2D) and the landmine number.
The landmine number tells you where landmines are.
For each... | stackexchange_codegolf |
We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice.
Examples
"aa!1 1 !a !1" is non-discriminating because each of the characters , !, a and 1 appear three times.
"abbaabb" is not non-discriminating because b appears more often than a.
"abc" is ... | stackexchange_codegolf |
Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. Characters with 10 or more instances will define 2 or more digits of the returned integer. For example, aaaaaaaaaaaaaaaaaaaaaa... | stackexchange_codegolf |
Since Euclid, we have known that there are infinitely many primes. The argument is by contradiction: If there are only finitely many, let's say \$p_1,p_2,...,p_n\$, then surely \$m:=p_1\cdot p_2\cdot...\cdot p_n+1\$ is not divisible by any of these primes, so its prime factorization must yield a new prime that was not ... | stackexchange_codegolf |
Your task: given an input string, determine whether the binary representation of that string does not have 4 1s or 0s in a row, anywhere. Furthermore, your code itself should not contain any such runs of four in a row.
Test Cases
String Binary Result
U3 01010101 00110011 Truthy
48 ... | stackexchange_codegolf |
Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no longer substring, output any one of them.
This may mean outputting the empty string.
If there are several valid outputs, ... | stackexchange_codegolf |
A completely even number is a positive even integer whose divisors (not including 1) are all even.
Some completely even numbers are:
2 (divisors: 2, 1)
4 (divisors: 4, 2, 1)
16 (divisors: 16, 8, 4, 2, 1)
128 (divisors: 128, 64, 32, 16, 8, 4, 2, 1).
Some non-completely even numbers are:
10 (divisors: 10, 5, 2, 1)
12 ... | stackexchange_codegolf |
In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to reach every number from 0 to 100. If x = 4 then you can use up to four 4s and this question becomes the classic four fours puzzle (except you can use up to four 4s rather than having to use exac... | stackexchange_codegolf |
The sequence of Fibonacci numbers is defined as follows:
\$
F_0 = 0 \\
F_1 = 1 \\
F_n = F_{n-1} + F_{n-2}
\$
Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not need to handle the inputs \$ 0 \$ or \$ 1 \$, nor any non-Fibonacci numbers.
Errors as a result of floating point inaccu... | stackexchange_codegolf |
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following text:
There's a hole in the... | stackexchange_codegolf |
It's annoying when you have to search for a language homepage, get its link, and add it to your SE comment/answer, right? Let's write a script to do that for you!
Challenge
For each language name (intentional or not) in the input, replace it with the markdown link to the language home page, defined by TIO.
Rules
(impo... | 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 |
Introduction
My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going.
Challenge
Take a string as input, and check if it matches the regex /^[Vv]ro*m!$/m. In English that means any line of the string must start with a capital or lowercas... | stackexchange_codegolf |
This is the first in a series of Island Golf challenges. Next challenge
Given an island in ASCII-art, output an optimal path to circumnavigate it.
Input
Your input will be a rectangular grid consisting of two characters, representing land and water. In the examples below, land is # and water is ., but you may substitut... | stackexchange_codegolf |
This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here
A pretty common beginner style question is to print some string, but there's a catch! You need to do it without using any of the characters in the string itself!
For this challenge, we will find out who is the best at printi... | stackexchange_codegolf |
Let's say I have this string:
s = "Code Golf! I love Code Golf. It is the best."
I want to replace all the vowels with repeated "aeiou".
Notes:
Uppercase vowels should be replaced by an uppercase letter, and lowercase vowels should be replaced by a lowercase letter.
Consonants (all alphabet characters except for "ae... | stackexchange_codegolf |
Challenge
Your goal is to find the furthest point on a graph (from a provided start node). Your code doesn't need to handle cycles in the graph properly, but it might pose a fun challenge. For this question, you can assume the graph is actually a tree.
Input data
Input can be provided in any suitable format for the lan... | stackexchange_codegolf |
Introduction
To draw a Fibonacci series of square, you start by drawing a one-unit square:
_
|_|
Then another one to the left:
_ _
|_|_|
Then a two-unit one on top:
_ _
| |
|_ _|
|_|_|
Then a three-unit one on the right:
_ _ _ _ _
| | |
|_ _| |
|_|_|_ _ _|
Then a five-unit one on the bottom:
_ _ _ ... | stackexchange_codegolf |
This image was made by overlaying 7 differently colored rectangles on top of each other:
The black and maroon rectangles are unobstructed, that is, no other rectangles are above them.
Write a program that takes in an image such as this and remove any single unobstructed rectangle, outputting the resulting image.
Exam... | stackexchange_codegolf |
You are to print this exact text:
ABABABABABABABABABABABABAB
BCBCBCBCBCBCBCBCBCBCBCBCBC
CDCDCDCDCDCDCDCDCDCDCDCDCD
DEDEDEDEDEDEDEDEDEDEDEDEDE
EFEFEFEFEFEFEFEFEFEFEFEFEF
FGFGFGFGFGFGFGFGFGFGFGFGFG
GHGHGHGHGHGHGHGHGHGHGHGHGH
HIHIHIHIHIHIHIHIHIHIHIHIHI
IJIJIJIJIJIJIJIJIJIJIJIJIJ
JKJKJKJKJKJKJKJKJKJKJKJKJK
KLKLKLKLKLKLKLKL... | stackexchange_codegolf |
Today, November 11th, is known as Remembrance Day, Armistice Day, or Veterans Day (depending upon the country), and is a day of reflection and gratitude for members of the military and their service, specifically started to reflect the end of European hostilities in the first World War. Let us reflect on that with a si... | stackexchange_codegolf |
We don't have enough (semi-)easy challenges for beginners. More and more of the easy ones are already taken. So I tried to come up with something that might be achievable by beginners, but that isn't a duplicate.
Input:
A single string separated with your OS new-line (i.e. \r\n),
or an array with multiple strings.
Outp... | stackexchange_codegolf |
Note: this problem was inspired by the Unsolved Mathematical Problems for K-12 youtube video, which also features other interesting puzzles.
From the wikipedia article:
The no-three-in-line problem asks for the maximum number of points that can be placed in the n × n grid so that no three points are collinear ..... Al... | 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 |
In Vernor Vinge's excellent and fascinating book A Deepness in the Sky
(which, by the way, I highly recommend1), the Qeng Ho, a culture
that spans various star systems, has no notion of "days," "months," "years,"
etc., and hence has a unique timekeeping system that measures time entirely in
seconds. The most commonly ... | stackexchange_codegolf |
This is my first attempt at a Code Golf question. If it needs obvious edits, please feel free to make them.
Below is a description of the basic Dropsort algorithm.
Dropsort is run on a list of numbers by examining the numbers in sequence, beginning with the second number in the list. If the number being examined is l... | stackexchange_codegolf |
Given a list of n strings, return a list of that strings in ascending order. However, be aware, that in this case we want integer comparison for all numbers appearing in the strings, meaning that "12" > "3".
Example cases:
{"abc123", "abc6", "abc47", "abd49"} -> {"abc6", "abc47", "abc123", "abd49"}
{"foo0", "bar12", "f... | stackexchange_codegolf |
It's all in the title...
Take as input a positive integer n>=12 and... do what the title says.
Yes, this is on OEIS A187924.
Some test cases
12 -> 912
13 -> 11713
14 -> 6314
15 -> 915
16 -> 3616
17 -> 15317
18 -> 918
19 -> 17119
20 -> 9920
40 -> 1999840
100-> 99999999999100
This is code-golf. Short... | stackexchange_codegolf |
Given a string \$X\$ we will say two strings, \$a\$ and \$b\$, are building blocks of \$X\$ if \$X\$ can be made by concatenating some \$n\$ \$a\$s with \$m\$ \$b\$s in any order. For example the string tomato has building blocks to and ma:
to ++ ma ++ to
We will say that the fineness of a set of building blocks is th... | stackexchange_codegolf |
Here is a diagram of a prison using ASCII characters:
+------------------------------+
| |
| X X |
| |
| D
D |
| |
| |
| ... | stackexchange_codegolf |
Introduction:
In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.
Input:
Two input-lists. One containing integer x,y,z coordinates, and one co... | stackexchange_codegolf |
Let's build a simulation for an aspect in the card game, which I personally know by the Dutch name 'Oorlog' (translates to 'War').
How does 'Oorlog' work?
Two decks of cards (each including two Jokers) are equally divided between the amount of players playing. Each player shuffles their own stock, put it upside down in... | stackexchange_codegolf |
You are an employee of Microteque, a leading Silicon Valley startup creating smart microwave ovens for all kinds of strange places. Your customers can get their microwaves printed with patterns to match their kitchens, campers, man caves; even the kitchens of large nation-state facilities have shiny new branded microwa... | stackexchange_codegolf |
Challenge
Given a string input, output the demolished version of it.
The Process
P
r Pr r
o o o
g g g
r r r rogr r
a -> a -> a -> a -> a -> -> -> -> ->
m m m m m
m m ... | stackexchange_codegolf |
Because ARM is the July 2021 LoTM, I figured I'd create the tips thread.
ARM is probably the most successful architecture for the digital world. From mobile phones to supercomputers, ARM is everywhere! Consequently, let's have a thread where we can help each other shorten our ARM code.
One tip per answer, and no stupid... | stackexchange_codegolf |
Challenge
Given a user's ID, determine how many times they have hit the repcap.
Specs
On a given day, let's a user has hit the repcap if they had reputation that wasn't gained due to the repcap. Essentially, on any given day, if the user's net reputation change as calculated without any cap was different from their act... | stackexchange_codegolf |
Given a MM/DD date (12/24) and a start/end date range (11/01 - 06/24), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01) or wrap around to the next year (11/01 - 05/01).
Examples:
12/24 is in 11/01 - 06/24 = True
06/24 is in 11/01 - 06/24 = True
06/24 is in 06/24 - 06... | stackexchange_codegolf |
This challenge is about the following variant of edit distance. Say we have a cost of 1 for inserts, deletes and substitutions as usual with one exception. A substitution for a given letter x for a letter y only costs 1 the first time. Any further substitutions of x for y cost 0.
As simple examples:
A = apppple
B = a... | stackexchange_codegolf |
When code-golfing there will be times where you need a Hex Dump of your code, usually because you've used unprintable characters. So, why not make a program that Hex Dumps itself?
The Challenge
This challenge is to, given no input, output a Hex Dump of your source code in the following formatting:
0000: 00 00 00 00 00 ... | stackexchange_codegolf |
A normal Brainfuck program starts out with an array of cells, all containing the number 0. This program, on the other hand, must be able to run starting with any number x in the leftmost cell. The only rule is that at the end of program execution, the "pointed-to" cell must be cell x. (The leftmost cell is cell 0).
Ea... | stackexchange_codegolf |
Your challenge is to query the SE API and find out whose rep on PPCG is tied, and output it. If these were all the users on PPCG:
Martin Ender: 10000 rep
Dennis: 10000 rep
xnor: 5000 rep
sp3000: 3000 rep
You should output Martin Ender, Dennis. If these were the only users:
Jon Skeet: 1000000 rep
Martin Ender: 10000 re... | stackexchange_codegolf |
Sandbox
Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both:
A cat program
A standard cat program: read everything from STDIN and put it on STDOUT (or your language's closest equivalent).
Do nothing and halt
This shouldn't output anything.... | stackexchange_codegolf |
A guess the word game
The agreed dictionary. All words are 6 letters long with all letters distinct
Rules: This is a game of two players and the task will be to implement Player 2.
Player 1 chooses a word from the agreed dictionary
Player 2 repeatedly guesses a word from the agreed dictionary.
At each turn, Player 1 ... | stackexchange_codegolf |
March 13 is recognized as National Jewel Day, which is the theme of this challenge. So, given an integer n where n is greater than 0, create an ASCII jewel. For example:
n = 1 n = 2 n = 3
______
____ / \
__ ... | stackexchange_codegolf |
Challenge
Given the name of a PPCG member, output their PPCG ID number. If the user does not exist, you may report an error or return any non-positive number. If there are multiple members with this name, you may choose to output only one ID or all of them.
Test Cases
"musicman523" -> 69054
"Dennis" -> 12012
"xnor" ->... | stackexchange_codegolf |
A permutation of size n is a reordering of the first n positive integers. (meaning each integer appears once and exactly once). Permutations can be treated like functions that change the order of a list of items of size n. For example
(4 1 2 3) ["a", "b", "c", "d"] = ["d", "a", "b", "c"]
Thus permutations can be co... | stackexchange_codegolf |
A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 bonds, so no carbon atom may be forced to have more than four bonds. A straight-chain alk*ne can be represented as a list ... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
Christmas is coming up, and Santa hasn't kept to his diet very well this year. Due to his size, he is getting the elves to collect a list of all the chimneys he will be able to fit down. Unfortunately, chimneys these days are a bit of ... | stackexchange_codegolf |
You're writing your favorite language and you want to display the following string: abcdefghijklmnopqrstuvwxyz to your happy customer. Unfortunately, your keyboard is broken and you can now only type symbols !+-*/[]().
You must submit a code that evaluates to be the string abcdefghijklmnopqrstuvwxyz or print the string... | stackexchange_codegolf |
Imagine this short function to clamp a number between 0 and 255:
c = n => n > 0 ? n < 255 ? n : 255 : 0
Is this the shortest possible version of a clamp function with JavaScript (without ES.Next features)?
P.S: Not sure if it's relevant but, the 0 and 255 are not random, the idea is to clamp a number as an 8-bit unsig... | stackexchange_codegolf |
Introduction
A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. For example, abcb is a perfect word because 1 + 2 + 3 + 2 = 8, and 8 / 4 = 2.
Your task
Given a word as input, output w... | stackexchange_codegolf |
The task is to provide code that evaluates to 0.5 numerically, i.e. the output must be recognized by your chosen language as a numeric value (Number, float, double, etc), not as a string. The catch, the characters 0 through to 9 cannot be used.
PLEASE NOTE: This IS NOT a golfing challenge, this is a popularity contest,... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.