instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
In Chinese, numbers are written as follows:
1 一 2 二 3 三 4 四 5 五 6 六 7 七 8 八 9 九 10 十
For numbers above 10, it is expressed as the number of tens and the number of ones. If there is only one ten, you do not need to explicitly say one, and if there are no ones, you don't need to put anything after:
11 十一
24 二十四
83 八十三
90... | stackexchange_codegolf |
Robbers' Challenge
Read the cops' challenge first.
In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it produce the correct (case-sensitive) output (except that there may also be an extra trailing newline at the end).
The n... | stackexchange_codegolf |
Robbers' Thread
Your challenge is to find an existing challenge, and implement it in a way such that certain inputs fail. At least one input must not produce the correct output (use the other submissions on the challenge as a reference for this, but be sure to double-check). This must fail consistently, and you must kn... | stackexchange_codegolf |
An Abjad is a writing system where each symbol stands for a consonant, and where vowels are omitted. An impure Abjad is an abjad in which there are additionals symbols for vowels, usually diacritics.
Write a program or function that, given a string of lowercase text (i.e. nothing but ASCII letters from a to z, commas a... | stackexchange_codegolf |
As input you will be given a ragged list of positive integers containing at least one integer at some level. For example:
[[],[[1,2,[3]]],[]]
You should output the depth of the least deep integer. For example if the input is just a list of integers, then the every integer is 1 level deep so the answer is 1. There m... | stackexchange_codegolf |
Antiferromagnetism is what IBM researchers used to jump from a 1 terabyte disk to a 100 terabyte disk in the same amount of atoms.
In materials that exhibit antiferromagnetism, the magnetic moments of atoms or molecules, usually related to the spins of electrons, align in a regular pattern with neighboring spins (on d... | stackexchange_codegolf |
Code-golfing is incredibly fun to do, trying to solve the given problem is one thing but the real challenge is getting your code as short as possible.
Some languages are perfect for golfing because of their short commands, sadly Delphi isn't one of them.
I'm looking for tips that are useful for golfing in Delphi.
Tips... | stackexchange_codegolf |
The name of the challenge was prompted by this GIF and the GIF also gave me the idea.
Your challenge today is to take a input guaranteed to be \$2<=n<=100\$ and output a sequence of x and - characters.
The output for a number N represents a sequence of operations applied to 1 where x means "multiply by 2" and - means "... | stackexchange_codegolf |
The Challenge
Write two programs P and Q such that:
P and Q are written in the same language
The output of P is Q
The output of Q is P
P and Q are both non-empty
Simple enough. Surely that's been done here before. Where this gets interesting is the scoring.
Scoring
P and Q are selfish, they don't want to sheir their... | stackexchange_codegolf |
Piet is an interesting programming language for a number of reasons. Today we will focus on one reason: the roll command. The roll command was originally from PostScript and is a powerful way to manipulate the stack.
The roll command pops the top two elements of the stack and uses them as parameters. We'll call the fir... | stackexchange_codegolf |
Task
You're in charge of making a compass, of sorts.
Imagine your source code as the compass "needle" where running at different orientations produces distinct output.
Supported source code orientations are North, East, South, and West.
Example
Let's say you have source code:
ABCD
J K
WXYZ
We'll consider this the Nor... | stackexchange_codegolf |
The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task
Input
The input will be a list of 4 digits numbers, where each digit represent a portion of decoration:
EMBU
||||
|||+-upper decoration
||+-bottom decoration
|+-mouth/nose
+-eyes
Eyes:
0 - °
1 - ¯
2 - -
3 - ^
4 - ... | stackexchange_codegolf |
Note: Anders Kaseorg warns me that this could be a duplicate of another previous question. It seems so, and I'm sorry I did not find that question before posting this one. Nonetheless, that question only received one answer and this one is simpler, just in case you all want to try this time. I'll understand if this qu... | stackexchange_codegolf |
So, this is a task from one very popular educational site in Russia:
https://acmp.ru/index.asp?main=task&id_task=786&ins=1
Mathematically, you need to find the power of two not exceeding the given number, read from the standard input stream, and output their difference in the standard output stream.
My python3 solution... | stackexchange_codegolf |
The task
Today's special offer: consonants and punctuation for FREE!
Your program or function will be given as input the first 6 paragraphs of Lewis Carroll's famous novel Alice's Adventures in Wonderland, with all vowels [aeiouAEIOU] removed and all other characters left intact.
It must output the original text, byte-... | stackexchange_codegolf |
Robbers thread
In this cops-and-robbers challenge, your task is to write a program h that outputs "Hello Shue!". Next, you have to choose a string i and also write a Shue program p, so that p(i)=h. Your score is len(p)+len(i). Your answer will contain the language of h, i and your score (please write the score as len(p... | stackexchange_codegolf |
Description
There have been quite a few other challenges concerning these numbers before, and I hope this one is not among them.
The n th triangular number equals the sum of all natural numbers up to n, simple stuff. There are a wikipedia page and an entry at OEIS, for those who wish to inform themselves further.
Now, ... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
Santa and the Elves are secretly preparing for a new tourist train service, called "North Pole Railroads". The train will travel through various sightseeing spots near the North Pole.
As a part of this project, they want to know how ma... | stackexchange_codegolf |
Given a string of ASCII art like such (This isn't ASCII art but it will do for the example):
abc
d e
fgh
Jumble it as if it was being displayed on a screen with one character per line, like so:
a
b
c
d
e
f
g
h
Print the result, wait one second, ±0.5 seconds before clearing the terminal and the print the same thing, ... | stackexchange_codegolf |
Introduction
A common puzzle involves a triangular board with 15 holes for tees/pegs as shown in the image below:
Starting with all the pegs in the board except for a hole at the top, the point of the puzzle is to jump pegs over one another like checkers in such a way to leave exactly one peg left. The only valid mov... | stackexchange_codegolf |
Objective
Create a function to reverse string concatenation
Input
Two strings (alphanumeric + spaces), where one should be subtracted for the other.
You can assume that the string to be subtracted will never be larger than the other one.
Output
The result from the subtraction
Subtraction
You should remove one strin... | stackexchange_codegolf |
This is supposed to be a code golf challenge on the simpler end of the spectrum. But I figured it could be nice to bring out some micro-optimisation here.
There are three basic types of DVI connectors: DVI-A (analog), DVI-D (digital) and DVI-I (integrated). Furthermore, there are single-link and dual-link versions of t... | stackexchange_codegolf |
Chat room: https://chat.stackexchange.com/rooms/106513/easter-bunny-challenge
Git repo: https://github.com/ajfaraday/easter_bunny_hunt
The garden is a 2-dimensional grid with 49 rows and 49 columns.
The Easter Bunny™️ is in the center of the garden, minding his own business, holding on to 100 Easter eggs.
Unfortunat... | stackexchange_codegolf |
Inspired by the upcoming winter bash event
Objective
Add a hat ^,´ or ` to a single vowel in each word of the input.
Rules
The hat and the vowel must be chosen at random. Each hat has to appear with the same probability (33%) and the vowels must have the same probability within the valid vowels in the word (if the wo... | stackexchange_codegolf |
United States senators are sorted into three classes, based on what year their six-year term starts. Since each state has two senators, each state has a senator in two of the three classes.
Given a full state name and a class number (1, 2, or 3), output truthy if that state has a senator of that class, and falsey if th... | stackexchange_codegolf |
The coin change problem is very well documented. Given an infinite supply of coins of denominations x_1 to x_m you need to find the number of combinations which add up to y. For example, given x = {1,2,3} and y = 4 we have four combinations:
{1,1,1,1}
{1,1,2}
{1,3}
{2,2}
Introduction
There are several variations of t... | stackexchange_codegolf |
Related: Counting polystrips
Background
Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules:
Connect two cells with number N with a line spanning N cells, so that the two cells are at the two ends of the line.
The number 1 is considered connected t... | stackexchange_codegolf |
This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you accept it, is to write a program/function that outputs/returns its input/args. But again, The tricky part is that if I rot-13 your source code, the output must be returned rot-19.
Your co... | stackexchange_codegolf |
Background
Combinatory logic is a system where a term is written using a finite set of combinators and function application between terms, and reduction rules are defined for each combinator. The well-known S and K combinators have the following reduction rules:
$$
\begin{aligned}
S\;x\;y\;z & \overset{S}{\implies} x\;... | stackexchange_codegolf |
A math Olympiad will be held, and participants are being registered. The highest number of participants is 100. Each participant is given an ID number. It is given in a sequence like \$100, 97, 94, 91, 88, ...., 1\$, and when the first sequence is over, then \$99, 96, 93, 90, 87, ...., 3\$ sequence and so on.
Let's ass... | stackexchange_codegolf |
Similar in spirit to Number of distinct tilings of an n X n square with free n-polyominoes and Partition a square grid into parts of equal area, this challenge will have you count ways of partitioning a triangle in a triangular grid. The goal of this code-golf challenge is to write a program that outputs \$ a(n,m)\$, t... | stackexchange_codegolf |
In 2015 the Portland International Airport began the replacement of their iconic carpet. I want you to write a program to draw their old carpet in as few bytes as possible.
The carpet:
Specifications
Here is a link to a scalable pdf image of one tile. Your output should match the relative dimensions and placement o... | stackexchange_codegolf |
This challenge is inspired by a board game I played some time ago.
The story of this challenge doesn't necessarily have to be read, the goal of the challenge-section should explain everything necessary.
The Story
People are locked inside a large room with a human-devouring monster. The walls of the room are enchanted, ... | stackexchange_codegolf |
Your boss has found out that quite a bunch of his employees (including you) like to steal code from others. He ordered you to write him a program that he can use to find people who steal code from others.
Task:
Write a program/function that detects if somebody copied (part of) his code from somewhere else.
The progra... | stackexchange_codegolf |
The question is simple but the answer maybe not!
suppose that you have the following lists that all of them are ordered (not consecutive):
x = ['one', 'two', 'four']
y = ['two', 'three', 'five']
z = ['one', 'three', 'four']
as you can see there is a logic in each of the above lists for example in x we have the follow... | stackexchange_codegolf |
Triangularity is a new esolang developed by Mr. Xcoder where code structure has to follow a very specific pattern:
For the nth line of code, there must be exactly 2n-1 characters of the program on it. This causes a triangular/pyramid shape, with the first line having only one character and the rest increasing by inc... | stackexchange_codegolf |
You will be given two Arrays / Lists / Vectors of non-negative integers A and B. Your task is to output the highest integer N that appears in both A and B, and is also unique in both A and B.
You may assume that there is at least one such number.
Any reasonable Input and Output method / format is allowed.
These Looph... | stackexchange_codegolf |
We all love horoscopes, don't we? But I have a serious problem in this Horoscope App installed on my Smart Phone that it only displays the icon of the Zodiac Sign for each day's horoscope. Now, I do remember my horoscope, but its hard to remember others' whose horoscope I am interested in.
Challenge
So here is your cha... | stackexchange_codegolf |
Goal
Given an input number, round it off to the nearest number with one significant figure.
Requirements
Input
A floating point number.
Assume the input number results in an output within the data type's limits (ie. ignore overflow errors.)
0 is an invalid input.
Numbers that cannot be accurately represented in the fl... | stackexchange_codegolf |
Inspiration. Posted with permission.
Print one of the possible XKCD calendar "facts":
You can get the raw text and structure from my APL reference implementation or from Explain XKCD's transcript (including the title text just under the illustration).
Rules
At every decision node, there must be an equal (pseudo-)rando... | stackexchange_codegolf |
What tips do people have for golfing in TeX/LaTeX? Please post one tip per answer, each at least somewhat specific to TeX/LaTeX.
Context: I noticed this answer and that there is no tips question for TeX/LaTeX, so I'm creating this one. There's some overlap with the narrower question tips for golfing in TikZ (as TikZ i... | stackexchange_codegolf |
The objective
Given the non-negative integer \$n\$, output the value of the hyperfactorial \$H(n)\$. You don't have to worry about outputs exceeding your language's integer limit.
Background
The hyperfactorial is a variant of the factorial function. is defined as
$$
H(n) = 1^{1} \cdot 2^{2} \cdot 3^{3} \cdot \: \cdots ... | stackexchange_codegolf |
Introduction
This challenge appeared in the 2020 Estonian Open Informatics Olympiad and was created Sandra Schumann. I thought it was interesting because it involves symmetry and is quite hard even to brute force by hand.
The problem author said that it's ok for me to post it here:
Challenge
You may use a modified vers... | stackexchange_codegolf |
...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.
From Wikipedia.
Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed t... | stackexchange_codegolf |
To "function nest" a string, you must:
Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:
H(ello)
Then, repeat this same step for every substring. So we get:
H(ello)
H(e(llo))
H(e(l(lo)))
H(... | stackexchange_codegolf |
The task here is simple: given a target location on an XY grid, and a rectangle on that grid, find the length of the shortest path from the origin to the target which does not intersect the rectangle.
All parameter values are integers. You can assume that neither the target point nor the origin is inside or on the bord... | stackexchange_codegolf |
Consider the sequence 1/2, 1/3 + 1/2, 1/4 + 1/3 + 1/2, and so on. In mathematical symbols, this is
$$S(n)=\sum_{m=2}^{n+1}\frac{1}{m}$$
where S is the function that makes the sequence.
Outputting this sequence as a fraction would not be complicated. To add depth to the challenge, you must output as a repeating decimal.... | stackexchange_codegolf |
At the Code-Golf™ Psychological Society, you are delighted to present a new method of measuring mental age: Abstract Capacity™.
To get the Abstract Capacity of a person, you take their actual age divided by 4, take their IQ divided by 9, then add the two values together. Then, round this sum down to find the Abstract C... | stackexchange_codegolf |
The Challenge
Given an integer, calculate its score as described below.
The score is calculated by raising each digit of the input Integer to the power n, where n denotes the index of the digit in Input (beginning with 1) when counted from left to right (the index of leftmost digit should be 1), and then summing them a... | stackexchange_codegolf |
The Problem:
Two enemy secret agents have devised a wonderful (for you) method of communication!
Here’s how the encryption process works:
1) Take the ascii equivalents of each letter. (No spaces, numbers, or punctuation are sent)
2) For each letter in the message, the ascii equivalent of it and the letter after it (If ... | stackexchange_codegolf |
Notice: This question originally had people write comments with a shorter program, rather than new answers. This has been changed so that people with shorter programs can get reputation too. Hopefully this doesn't become unmanageable...
There have been a couple of OEIS-related questions recently, so here's another:
Pic... | stackexchange_codegolf |
Stolen from @Downgoat with permission
The point of this challenge is to (not) settle the debate on the pronunciation of "gif".
"
The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced jif, it's still commonly disputed.
In this challenge you will be given a set of words that have ... | stackexchange_codegolf |
The following problem is a common interview question, thus dull answers are discouraged. Go short or creative, best if both:
Create the following pattern
###########
## ##
# # # #
# # # #
# # # #
# # #
# # # #
# # # #
# # # #
## ##
###########
In case you cry "dupe",
I see y... | stackexchange_codegolf |
In the hovertext of this xkcd:
There's an "encoding" based on replacing runs of roman numerals with their sums. To do this:
Find all runs of at least 1 roman numeral (IVXLCDM)
Replace them with their sums, as numbers
The Roman Numerals are IVXLCDM, corresponding respectively to 1, 5, 10, 50, 100, 500, 1000. You shou... | stackexchange_codegolf |
The challenge
Given point and a path of points, say whether or not the point is in the polygon that is created by the path.
Also return true if the point is on an edge of the polygon.
Input
A list of pairs of integers.
The first 2 integers represent the point.
The remaining pairs (3rd and 4th, 5th and 6th etc.) represe... | stackexchange_codegolf |
In Bloons Tower Defense 6, the strength of different bloons can be measured by their Red Bloon Equivalent (RBE), or the number of single pops it takes to completely defeat the bloon.
The RBE for the bloon types are as follows (sourced from the wiki)
Bloon
RBE
red
1
blue
2
green
3
yellow
4
pink
5
black... | stackexchange_codegolf |
Task
Given a positive integer number and a threshold, split into every possible way without generating any numbers above the threshold.
Examples
Input: 15008
Threshold: 400
Valid Output:
[[1, 5, 0, 0, 8], [15, 0, 0, 8] [1, 50, 0, 8], [150, 0, 8]]
Invalid outputs:
[[1, 5, 0, 0, 8], [15, 0, 0, 8], [150, 0, 8], [1, 500... | stackexchange_codegolf |
Today, we'll be generating a map for a roguelike RPG!
Example Map:
##########
#### F#
#### ##
## C#C#
# ## #
# C #E #
#### # #
# #
#P #
##########
# are walls, P is the player's starting location, F is the finish that must be reached, C are coins that can be collected, and E are enemies t... | stackexchange_codegolf |
Your task is, given a family tree, to calculate the Coefficient of Inbreeding for a given person in it.
Definition
The Coefficient of Inbreeding is equal to the Coefficient of Relationship of the parents. The Coefficient of Relationship between two people is defined as weighed sum over all common ancestry as follows:
E... | stackexchange_codegolf |
Many of you may have interacted with people from Russia on the internet at some point, and a subset of you may have noticed the slightly odd method they have of expressing themselves.
e.g. удали игру нуб)))
where the ))) are added for emphasis on the previous statement, I have been working on a theory that the ratio of... | stackexchange_codegolf |
\$P_k(n)\$ means the number of partitions of \$n\$ into exactly \$k\$ positive parts. Given \$n\$ and \$k\$, calculate \$P_k(n)\$.
Tip: \$P_k(n) = P_k(n−k) + P_{k−1}(n−1)\$, with initial values \$P_0(0) = 1\$ and \$P_k(n) = 0\$ if \$n \leq 0\$ or \$k \leq 0\$. [Wiki]
Examples
n k Ans
1 1 1
2 2 1
4 ... | stackexchange_codegolf |
CHALLENGE STATUS: OPEN
Comment, open a PR, or otherwise yell at me if I'm missing your bot.
Prisoner's dilemma ... with three choices. Crazy, huh?
Here's our payoff matrix. Player A on the left, B on the top
A,B| C | N | D
---|---|---|---
C |3,3|4,1|0,5
N |1,4|2,2|3,2
D |5,0|2,3|1,1
The payoff matrix is engineered... | stackexchange_codegolf |
There are many generalizations of Conway's Game of Life. One of them is the isotropic non-totalistic rulespace, in which the state of a cell in the next generation depends not just on its state and the amount of alive cells around it, but also the relative positions of the cells around it.
Given an rulestring correspon... | stackexchange_codegolf |
Introduction
My calculator is behaving weird. Sometimes when I type in an 8 it displays a 2. And sometimes when I type in a 6 it displays a +. Some buttons are mixed up!
Could anyone help me determine which?
Challenge:
Input: List of incorrect equations, with correct results.
Output: The two buttons that are swapped.
F... | stackexchange_codegolf |
Write a program or function that, given a string, will strip it of zalgo, if any exists.
Zalgo
For this post, zalgo is defined as any character from the following Unicode ranges:
Combining Diacritical Marks (0300–036F)
Combining Diacritical Marks Extended (1AB0–1AFF)
Combining Diacritical Marks Supplement (1DC0–1DFF)
... | stackexchange_codegolf |
My mom really wants me to eat broccoli, but I hate it and never want to eat it. Mom wants to trick me so she cuts it into small pieces, puts it in a salad and mixes it. Help me find out if the salad contains broccoli!
Input:
Array of mixed letters of all the ingredients. For a single broccoli ingredient it could be:
[c... | stackexchange_codegolf |
Given two non-zero 16-bit integers a and b, decide the smallest number of shift operations needed to turn a into b. A shift is one of the following (big-endian) operations:
shl (shift left): move all bits to the left, adding a 0x0 bit to the right.
shr (shift right): move all bytes to the right, adding a 0x0 bit to th... | stackexchange_codegolf |
Output one random character for each character of source code (as illustrated below). The probability of each character is its frequency in the original source code. Thus the output will be fake source code resembling a quine.
Specification
Restrictions
Standard quine constrains apply. No empty programs or functions.... | stackexchange_codegolf |
Create a program which prints itself, followed by an additional program. This additional program should print the first program, itself, and then a third program. This continues until the nth program, which prints every program in order up to itself, but fails to print a successor.
All programs output by your code shou... | stackexchange_codegolf |
Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original programming language, but instead produce the triangular numbers in one other programming language.
Scoring
Your score will be the... | stackexchange_codegolf |
It is easy to describe a finite state machine that recognizes multiples of 9: keep track of the digit sum (mod 9) and add whatever digit is accepted next. Such a FSM has only 9 states, very simple! By the equivalence between FSM-recognizability and regular languages, there is a regular expression for multiples of 9. Ho... | stackexchange_codegolf |
For this challenge, a word is defined as a string of letters, separated by spaces.
Given a string of words, and an integer i representing an index into that string, output the whole word which contains the character at index i.
For example (using 0-based indexing), with the string code golf, and the index 6, the 7th ch... | stackexchange_codegolf |
The objective is to print a graph from an array of numbers, of the design below. Printing the X and Y scale exactly as in the "design", with padding, is part of the challenge. The input array of numbers can be of virtually any range of integers in X and Y, but not 0 and not negative - though I would suggest keeping it ... | stackexchange_codegolf |
\$BB\$ is the busy beaver function, an uncomputable function.
Write a program which when given an integer \$n\$ as input, will output \$BB(n)\$, with at least \$\frac 2 3\$ probability. You can do whatever (return something wrong, infinite loop, explode, etc.) in other cases.
To help you compute it, you're given a func... | stackexchange_codegolf |
...counted!
You will pass your program a variable which represents a quantity of money in dollars and/or cents and an array of coin values. Your challenge is to output the number of possible combinations of the given array of coin values that would add up to the amount passed to the code. If it is not possible with t... | stackexchange_codegolf |
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique.
To complete a hand and win, the 13 tiles in your hand are combined w... | stackexchange_codegolf |
Let's have a list of positive integers
[6,1,9,3,7,4,6,3,2,7,6,6]
this will represent a river. We would like to skip a stone across this river. We can throw the stone as far as we want and whatever number it lands on it will skip that many places. So if we start by throwing it 2 spaces, it will land on the 1 skip fo... | stackexchange_codegolf |
Generate a 4x12 grid of letters / spaces:
Each die should appear precisely once, location randomly chosen. Locations should be approximate a uniform random permutation of the dice. Display a random (again, approximately uniform) face of each die. Left-justify the face in the 3-character window. For example,
A E A... | stackexchange_codegolf |
Your challenge is to take a name (string) as input, like
Albert Einstein
and output:
Einstein, Albert
Pseudocode:
set in to input
set arr to in split by " "
set last to the last element of arr
remove the last element of arr
set out to arr joined with " "
prepend ", " to out
prepend last to out
output out
More test c... | stackexchange_codegolf |
Write a program using the fewest bytes of source code which given a list of strings finds all elements which are still in the list when any character is deleted.
For example, given a list of all English words boats would be output because oats, bats, bots, boas, boat are all English words and thus would be in the list.... | stackexchange_codegolf |
I think the Collatz Conjecture is already well-known. But what if we invert the rules?
Start with an integer n >= 1.
Repeat the following steps:
If n is even, multiply it by 3 and add 1.
If n is odd, subtract 1 and divide it by 2.
Stop when it reaches 0
Print the iterated numbers.
Test cases:
1 => 1, 0
2 ... | stackexchange_codegolf |
The Prisoner's Dilemma, but with 3 choices, and the payoffs are random!
Each round, your bot recieves a 3x3 grid and chooses a row to play. The grid might be this:
4 5 7
3 1 9
9 9 0
Each number in the grid is between 0 and 10 (inclusive). Your score for the round is grid[your_play][their_play], and your oppone... | stackexchange_codegolf |
Given a level from a simple platform game, your task is to make a program or function to determine if a level is winnable. Platform game levels are 4 characters tall and any number of characters wide. There is exactly one platform for each horizontal space in a level:
======= =
== = = ... | stackexchange_codegolf |
This question is based on a question I asked in Spanish language. Yes, I asked for an algorithm in Spanish Language. :)
In Spain, current license plates have this pattern:
1234 XYZ
where XYZ are three consonants taken from the full set of Spanish consonants (except the 'Ñ', I think).
Sometimes, when traveling with ... | stackexchange_codegolf |
With the recent discussion about the use of compression tools in code golf, I thought it would be a nice challenge to write your own text compressor and decompressor.
Challenge:
Write two programs: one to compress ASCII text into a sequence of bytes, and another to decompress it. The programs need not be in the same l... | stackexchange_codegolf |
proposed by @Adám in chat
Given an even number of finite points return a line \$y=mx+b\$ that evenly splits the points on both sides.
Specs
Take a list of distinct points \$(x,y)\$ (or a list of x-coordinates and a list of y-coordinates), output a possible \$(m,b)\$ pair
Half of the points should be true for \$y>mx+b\... | stackexchange_codegolf |
I have encountered this type of puzzle, that usually involves apples, several times. It goes as follows:
There is a certain number of apples in a basket. Ava takes a third of the apples. Bob takes a quarter of the apples that are left. Finally, Dennis takes one-sixth of the apples left. In the end, there are 10 leftov... | stackexchange_codegolf |
Introduction
Try to convert words to two different unicode fonts.
Challenge
Your task is to transform your input string into the and unicode characters.
All uppercase words should become lowercase words.
For Example: WORD ->
All lowercase words should become words
For example: other words ->
All mixed ... | stackexchange_codegolf |
This is a cops-and-robbers challenge, the cops' thread is here
You can change the word code into golf by changing a letter at a time in four steps:
CODE
COLE
COLD
GOLD
GOLF
Today, we’ll be doing the same thing with programs.
Your challenge is to crack an answer on the cops' thread. Cops will create a series of program... | stackexchange_codegolf |
This task builds on: Find all reflexicons using roman numerals
An autogram is a sentence that lists the count of its own letters. Below is one of the first documented autograms found by Lee Sallows in 1983:
This pangram lists four a’s, one b, one c, two d’s, twenty-nine e’s, eight f’s, three g’s, five h’s, eleven i’s,... | stackexchange_codegolf |
This is the robbers' thread, the cops' thread is here
A polyglot is a program, that without modification, can run in multiple languages.
Robbers' Challenge
First, find a vulnerable cop's answer, then try to find languages that the submission works in, if you found any that weren't listed by the cop, then you just cra... | stackexchange_codegolf |
Overview
The cover of a book will be provided in the following ASCII format:
______
| |
| |
| |
| |
------
The input can be in any reasonable format (eg. a list of strings, a nested list of characters, etc.)
Inside the "borders" of the cover, other printable ascii characters might appear, which contribute ... | stackexchange_codegolf |
This is my attempt to pair code-shuffleboard with code-golf.
You need to write a full program or function that sums all codepoints of the input string. If there is no input, you can output any number, including 0.
Rules
The input will always be in printable ASCII.
The sum of the codepoints of your source must be exact... | stackexchange_codegolf |
I was browsing esolangs, and chanced upon this language: https://github.com/catseye/Quylthulg.
One interesting thing about this language, is that it doesn't use prefix, postfix, or infix, it uses all three of them, calling it "panfix" notation.
Here is an example. To represent normal infix 1+2 in panfix, it becomes: +1... | stackexchange_codegolf |
Your friend has been caught sleeping in class again! As punishment, his computer science teacher has assigned him homework, knowing that he will not be able to solve it due to not having paid any attention.
The assignment seems deceiving simple at first; all that is required is to output the string:
John Doe
Unfortunat... | stackexchange_codegolf |
I recently solved a coding challenge in one of the challenge papers that my IT teacher gave to us. It was a seemingly simple, but fun challenge, so I thought it will make fun golfing.
The task
Given an input of a 2x2 matrix that contains 4 strictly positive integers (i.e. non-negative and non-zero), like this:
$$\begin... | stackexchange_codegolf |
You have to write a program, if its source code is reversed, then it will error.
For example, if your source is ABC, then reversing it and writing CBA should crash/throw an error. And ABC itself should be a vaild program (I mean your primary source should be a valid program). Output of the main source code can be empty... | stackexchange_codegolf |
Inspired by this glove-themed 538 Riddler Express Puzzle.
Task
You are given a positive integer n, and a list A = [a_1, a_2, ..., a_k] of k distinct positive integers.
Then a restricted composition is an ordered list P = [p_1, p_2, ..., p_m] where each p_i is a (not necessarily distinct) member of A, and p_1 + p_2 + ..... | stackexchange_codegolf |
You have a 3x3 grid. Each cell can be colored black or white. Display all 512 of these colorings. Fewest bytes wins.
You can display the grids in any formation as long as they are visually separated and the spacing looks regular. You may use ASCII art or images. Any two distinct visible symbols or colors can be used fo... | stackexchange_codegolf |
As you may know, the typical binary floating point numbers in a computer language are quite different than the typical integer numbers in a computer language. Floating point numbers can represent a much larger range, and can represent fractional amounts, however there is a trade-off that is frequently elided.
The dista... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.