instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
From the subreddit r/SpeedOfLobsters:
Edit the text of an image to create a new phrase
This meme format/style is pretty self-explanatory. Simply have a browse through the subreddit if you need more examples. However, when coming up with ideas, it can be quite difficult to decide exactly which letters to keep and whic... | stackexchange_codegolf |
Write a program that accesses Project Gutenberg's KJV Bible, either from a file called pg10.txt in the working directory or in any other way that is typical for the language, takes a Bible verse reference as input, and prints the corresponding verse, with no newlines except optionally one at the end, as output.
The sta... | stackexchange_codegolf |
This challenge like some of my previous challenges will have you counting free polyforms, which are generalizations of Tetris pieces.
This code-golf challenge will have you count polyomino-like polyforms on hypercubes. In particular, this challenge is to write a program that takes in three parameters:
n, which represe... | stackexchange_codegolf |
You know it: keyboard or mouse input is just too mainstream to create Random Numbers through human behavior.
Create the most unique (Pseudo)Random Number Generator that create its numbers through human behavior.
Web-API's are not restricted! Anyone should use the code provided, so any special hardware is restricted. (I... | stackexchange_codegolf |
Given a permutation of the alphabet and an input string, encrypt the input string by replacing all characters with the one's you've been given.
The capitalization should be kept the same and non-letters are not to be changed.
[hnvwyajzpuetroifqkxmblgcsd], "Hello, World!" -> "Zytti, Giktw!"
As [abcdefghijklmnopqrstuvwx... | stackexchange_codegolf |
Introduction
I found a really interesting puzzle it was called Busy Brain Beaver. But it has been 3 years since the latest activity and there are some things I didn't like about it. So I decided to make a new one.
The Rules
I want this one to be more brainfuck focused:
Your goal is to make a brainfuck program that out... | stackexchange_codegolf |
Gematria is an ancient Jewish method to determine a numeric value of a letter sequence, using a fixed value for each letter. Gematria is originally applied to Hebrew letters, but for the context of this challenge, we'll use Latin script instead. There are many ways to implement Gematria in Latin script, but let's defin... | stackexchange_codegolf |
On the TV cooking show Guy's Grocery Games, the chefs cannot begin shopping until Guy Fieri, the show's host, says "Three, two, one, go!" However, the words do not have to be all together. He often "hides" the words in things like this (based on a real example, but not quoting verbatim):
There are three of you here; a... | stackexchange_codegolf |
Introduction
Super Mario 64 has a heavily overcomplicated RNG, ably explained here by Pannenkoek.
I thought it might be interesting to implement it.
Challenge
Implement the RNG function, except for the two special cases. (Not part of the below description; everything below is what you should implement.)
Input and outp... | stackexchange_codegolf |
Challenge
I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform.
The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ... | stackexchange_codegolf |
My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. For example if my phone number were
abaababbab
Then by repeatedly removing ab we would eventually get nothing (I encluse ... | stackexchange_codegolf |
A complete deterministic finite automaton is a machine, with some states. Each state in the automaton has, for each character in the alphabet, a pointer to a state (not necessarily a different one). The automaton starts at some state, and then reads a string, character by character. For each character, the automaton mo... | stackexchange_codegolf |
Intro
More complex than A square of text since this requires padding and input has unknown data type.
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's tenth problem.
I have explicit permission to post this ch... | stackexchange_codegolf |
Introduction
Book cipher
A Book cipher is a very unique method of a encipher. Here's how's it done:
You have a book / a document or a article (something full of text, the more pages of text the better).
You have a message to convey (a secret, of some sort)
You simply-put read trough the text and the secret message (ma... | stackexchange_codegolf |
V1.1: Added criterion to help with tiebreakers, a bit overkill but still.
Task: Crack the scrambled code for calculating the argument of a complex number \$z=x+iy\$ given two inputs.
You must post a comment in the cops’ thread with a link to your working source, mentioning clearly that you have cracked it. In your ans... | stackexchange_codegolf |
Write a program that tests if a number n is prime by checking that none of the integers between 2 and n-1 (inclusive) divide n (you must use this algorithm!). The input to STDIN should be an integer n (strictly) greater than 1. The output to STDOUT should be prime if n is prime and not prime if n is not prime.
Even tho... | stackexchange_codegolf |
Given an integral polynomial of degree strictly greater than one, completely decompose it into a composition of integral polynomials of degree strictly greater than one.
Details
An integral polynomial is a polynomial with only integers as coefficients.
Given two polynomials p and q the composition is defined by (p∘q)(... | stackexchange_codegolf |
Barbrack
Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system Barbrack.
What's that?
Barbrack is a numbering system I made up that can represent non-negative integers. Zero is represented wi... | stackexchange_codegolf |
<< Prev Next >>
Santa was able to remanufacture all of the presents that the elves stole overnight! Now he has to send them to the assembly line for packaging. He usually has a camera to supervise the assembly line both to make sure the elves are doing a good job and because assembly line pictures look nice on advertis... | stackexchange_codegolf |
You are given an array \$A\$, which may contain duplicate elements. In each swap, you may swap the value of any two indices \$i, j\$ (i.e. switch the values of \$A_i\$ and \$A_j\$). What is the least amount of swaps needed to sort the array, and what are the corresponding swapped indices?
Scoring
This is code-golf, so ... | stackexchange_codegolf |
Introduction
A code page maps integer values to a specific character. We can visualize a code page like this:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+... | stackexchange_codegolf |
Your function must accept three numbers in any order:
A signed real number (or ±Infinity) - The number (N) for which you have to generate a number from the range
A signed integer - Minimum of the range
A signed integer - Maximum of the range
Input:
The minimum of the range will always be less than the maximum of the... | stackexchange_codegolf |
Given a URI like:
postgres://username:password@hostname:PORT/dbname
Extract it all into an array data-structure, like so:
['postgres', 'username', 'password', 'hostname', 'PORT', 'dbname']
More info: http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
Rules
No use of external libraries or web-services
Scoring
Y... | stackexchange_codegolf |
Write a program or function that takes in a quadratic equation and prints its factorized roots. The input can be taken in from any reasonable source, such as a function parameter, stdin, or a command line argument.
Edit: This is not intended to be a duplicate of other quadratic equation questions. While others simply p... | stackexchange_codegolf |
Given two arrays of non-negative integers \$A = [A_1,A_2,\ldots,A_n]\$ and \$R = [R_1,R_2,\ldots,R_n]\$ which are equal in length, return an array which has the element \$A_1\$ repeated \$R_1\$ times, then element \$A_2\$ repeated \$R_2\$ times, all the way up to \$A_n\$.
Standard loopholes are forbidden. As this is co... | stackexchange_codegolf |
Challenge:
Given a list of integer, sort descending by their single largest digit(s). The order for numbers with the same largest digit are then sorted by second largest digit, etc.
We ignore duplicated digits in numbers. And if all digits in a number are the same, the order of those numbers in the list can be in any w... | stackexchange_codegolf |
I've been playing around with a robot on the coordinate plane. This robot is able to tell me if it goes left, right, up, or down by reporting back a string consisting of the letters L, R, U, and D, such as DLURRDLURDLLLRRLRLDURRU. Each character represents a movement of one unit. However, it seems that the robot is goi... | stackexchange_codegolf |
I have noticed that there are a disproportionate number of computer languages based on English. I propose to fix this by translating existing computer languages into foreign languages!
Pick a computer language that uses English keywords/functions
Pick any natural* language other than English
Write a program that trans... | stackexchange_codegolf |
King of the Cards
Code available here!
In this King of the Hill challenge, you must write a bot that can play Crazy Eights. This is a card game often played by children, in which the objective is to empty your hand.
How to Play
The game of Crazy Eights is deceptively simple. At the beginning of the game, each player ge... | stackexchange_codegolf |
Somehow, we don't yet have a challenge for finding the inverse of an arbitrarily-sized square matrix, despite having ones for 3x3 and 4x4, as well as a more complex version.
Your task is, given a square \$n\times n\$ non-singular matrix \$M\$, output the matrix \$M^{-1}\$ that satisfies
$$MM^{-1} = I_n$$
There are a nu... | stackexchange_codegolf |
Othello/Reversi is a board game in which players take turn placing pieces of a color (dark or light) on the 8x8 board. The possible moves are positions where there are one or more pieces of the opponent's color in a straight (horizontal, vertical, or diagonal) line between that position and a piece of the player's colo... | stackexchange_codegolf |
Write a program or function that outputs/returns the first 10000 prime-indexed prime numbers.
If we call the nth prime p(n), this list is
3, 5, 11, 17, 31, 41, 59 ... 1366661
because
p(p(1)) = p(2) = 3
p(p(2)) = p(3) = 5
p(p(3)) = p(5) = 11
p(p(4)) = p(7) = 17
...
p(p(10000)) = p(104729) = 1366661
Standard loopholes... | stackexchange_codegolf |
https://www.youtube.com/watch?v=6vAhPeqlODg
Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th
Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb ... | stackexchange_codegolf |
Given a square string, produce all the output for the string at every stage of unfurling.
The string must unfurl in a clockwise direction one quarter turn at a time.
Examples
Input:
A
Output:
A
Note: I'll also accept the input duplicated for this particular test case only if this helps reduce your byte count.
Input:
... | stackexchange_codegolf |
One of my favorite memes is the bouncing DVD logo. Yet silly but extremely satisfying, a DVD logo keeps bouncing on a screen and if you ever happened to watch this screensaver, you were most likely anxiously waiting for the logo to exactly hit the corner.
I know part of the fun is the waiting, but let's try to predict... | 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 |
Load an image into this stack snippet and move your mouse over it. A black curve that follows the hue angle, starting at your cursor point, will be drawn:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><style>canvas{border:1px solid black;}</style>Load an image: <input type='f... | 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 |
Challenge
Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length.
Test Cases
1234500362000440 → 1234523623441
123450036200044 → 123452362344
000000000000 → 12
0123456789 → 1123456789
1234567890 → 1234567891
123456789 → 123456789
010203004050 → 1... | stackexchange_codegolf |
Story
In an unnamed company, some people use Java and some use C++. This was always a nuisance, and they kept on arguing which single language they should all be using. To settle the dispute, the management decided that they'll buy a translator program that will be able to rewrite their C++ programs to Java and vice ve... | stackexchange_codegolf |
Task
Make code given on the command line that takes an unpacked hex value as input and evals that in Perl. Like this:
perl -e 'map{eval}pack q/h*/,q/072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622/'
But with one additional restriction: Your c... | stackexchange_codegolf |
In Bgil Midol's question, the score of a sequence of slice is defined as
sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3
Such scoring method makes multiple slices possibly take less score, e.g.
[::25] 75
[::5][::5] 30
Given the length of a string, an upper bound of number of slices1, and the one slice i... | stackexchange_codegolf |
Add++ is the Language of the Month for January 2022, and so I'm asking for tips for golfing in it. Please stick to tips specific to Add++, and avoid general tips such as "remove whitespace" or "avoid comments".
Please post separate tips as individual answers
| stackexchange_codegolf |
Given a "T" shape on an x * y number grid, with length W on the top bar and H on the stem of the T, with the bottom of the T on the square numbered n: calculate the total of all of the numbers in the T shape. W must be an odd number and all must be positive integers.
Here are some examples of valid T's on a 9*9 grid:
... | stackexchange_codegolf |
This is not the same as m-ss-ng-lette-s
Challenge:
Given a string with masked characters, generate all possible words, inclusive of non-meaningfull words.
Rules:
The sequence of the characters in the string does not change.
The masked character (*) will be one of an English alphabets [a-z].
There are no line breaks, s... | 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
Mathematicians are interested in all kinds of algebraic structures, e.g. groups, rings, boolean algebras. Generally, we have several operations (addition, multiplication, meet, join, etc.), and some equational relationships on the operations (e.g. associativity of multiplication). This makes up an algebraic ... | stackexchange_codegolf |
I've been enslaved in a quine factory. The other workers and I can't communicate with the outside world, we can only slave away making quines all day. The masters will reject any work that isn't a proper quine. I'll have to put messages into the quines I make to let people know we're trapped here.
The Challenge
Help us... | stackexchange_codegolf |
In this challenge you will be asked to take a knot and determine if it can be colored in a particular way.
First we draw a diagram of the knot. We use the standard way of drawing knots where we put gaps in strands where they pass under each other. Here is an example of some knots drawn this way:
Taken with permissio... | stackexchange_codegolf |
You have n coins which each weigh either -1 or 1. Each is labelled from 0 to n-1 so you can tell the coins apart. You have one (magic) weighing device as well. At the first turn you can put as many coins as you like on the weighing device which is able to measure both negative and positive weights and it will tell yo... | stackexchange_codegolf |
A polyglot is a program that can be run in 2 or more different programming languages.
What general tips do you have for making polyglots, or choosing languages that are easy to write polyglots for a specific task?
Please post the tips that could be applied in most situations. I.e. they shouldn't work only in polyglots ... | stackexchange_codegolf |
Lets say you saw your friend enter his or her password into their Android phone. You don't remember how they made the pattern but you remember what the pattern looks like. Being the concerned friend that you are you want to know how secure their password is. Your job is to calculate all the ways that a particular pa... | stackexchange_codegolf |
My daughter had the following assignment for her math homework. Imagine six friends living on a line, named E, F, G, H, J and K. Their positions on the line are as indicated (not to scale) below:
Thus, F lives five units from E, and two units from G, and so forth.
Your assignment: craft a program that identifies a pat... | stackexchange_codegolf |
On Math Stack Exchange, I asked a question about the smallest region that can contain all free n-ominos.
I'd like to add this sequence to the On-Line Encyclopedia of Integer Sequences once I have more terms.
Example
A nine-cell region is the smallest subset of the plane that can contain all twelve free 5-ominoes, as i... | stackexchange_codegolf |
Your task is to fill the bucket with numbers upto a given input.
Rules
Numbers occupy the leftmost position then rightmost, then leftmost and so on.
After overflow, the numbers start to gather around the bucket in a similar manner. They occupy position diagonally.
The examples should make it clear what the expected out... | stackexchange_codegolf |
Challenge
Output the person on PPCG who has cast the most upvotes and the person who has cast the most downvotes.
Voters
You should only look at the people who have cast more than 1000 votes in total.
To find the person who upvotes the most, you should the find the person with the highest upvotes/total votes value. Sim... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
As soon as the Elves get bored with the last week's game, Bin comes up with a new game. The rules are similar, except the Elves are supposed to say the numbers that have its "left side" equal to its "right side" when written in binary.... | stackexchange_codegolf |
Despite having 17 questions tagged anagrams, we still don't have this question, so here it is.
Your Task
You must write a program or function that, when receiving a string, prints out all possible anagrams of it. For the purposes of this question, an anagram is a string that contains the same character as the original... | stackexchange_codegolf |
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as short as we could, but I'd like to see if there are any shorter solutions any of you can come up with.
Rules:
You must use ... | stackexchange_codegolf |
Background
"Fly straight, dammit" (OEIS A133058) is a sequence of integers, which has these rules:
\$a_0 = a_1 = 1\$
\$a_n = a_{n-1}+n+1\$ if \$gcd(a_{n-1}, n) = 1\$
Otherwise, \$a_n = \frac{a_{n-1}}{gcd(a_{n-1}, n)}\$
In pseudocode:
a[0] = a[1] = 1
if gcd(a[n-1], n) == 1 then
a[n] = a[n-1] + n + 1
else
a[... | stackexchange_codegolf |
Objective
Given a date, spell it out in Romanized Japanese.
I/O Format
The input format is flexible. The output format is <month spelling> <day spelling>; note the space. You can freely mix cases in output. You may output trailing newline.
Mapping
Months
Month
Spelling
January
Ichigatsu
February
Nigatsu
Mar... | stackexchange_codegolf |
[I decided to salvage Ben Reich's question How many unique ways are there to achieve a score in Football? but it ended up being so different that it's only suitable as its own question not spliced into his.]
Challenge: Given a number, calculate how many order-independent ways there are to score that number as a winning... | stackexchange_codegolf |
Background
Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation to make programming easier and faster.
The challenge
Let's look at snippet written by Joe a moment ago:
0+++++1+++++0[3+... | stackexchange_codegolf |
My fifth-grade daughter is learning about codes and ciphers. She has reached the point of decoding a ciphertext that has been encoded with the Caesar cipher where the offset is not provided in advance.
Without computers this can be time-consuming, especially for long blocks of text. Luckily, we do have computers, and l... | stackexchange_codegolf |
The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome.
eg.1
input: "12131331"
output: "33", "121", "131", "313", "1331"
eg.2
input: "3333"
output: "33", "333", "3333"
| stackexchange_codegolf |
Write a program or function where a matrix A (maximum value of dimensions of the matrix is 100) is transformed to a new matrix B. Each element of the new matrix B is the sum of the positive neighbors of the corresponding element of the matrix A.
Only neighbors in the four orthogonal directions are considered, and the e... | stackexchange_codegolf |
Given one line that consists of only letters, process as following:
You maintain a string that's empty at the beginning.
If the next input character is in the string, remove it from the string.
If the next input character isn't in the string, append it to the string.
Output the final state of the string.
You can saf... | stackexchange_codegolf |
Given a start word and a target word, print the "mutation chain" that starts at the start word and ends at the target word.
You may assume both words are lowercase and only have alphabetic characters.
Define a "mutation" as the removal of an character, the insertion of a character, or the altering of a character.
For e... | stackexchange_codegolf |
Consider a positive integer N written in base b. A sequence is generated from this number by finding the largest digit d in the expansion of N and writing N in base d+1, repeating until the base the number is written in can be decreased no further. For example, the sequence generated by 346 (10) in starting base 16 has... | stackexchange_codegolf |
Let's say you are given an integer array. Create a function to determine the largest sum of any array's adjacent subarrays. For instance, the contiguous subarray with the largest sum is [4, -1, 2, 1] in the array [-2, 1, -3, 4, -1, 2, 1, -5, 4].
You can employ a variant of Kadane's algorithm to resolve this issue. The ... | stackexchange_codegolf |
Write a program that, when run in different languages, outputs a different byte permutation of the code in each language. The exact source code is counted as one permutation.
Here "different language" can be different version(Py 2 and Py 3) or different standard flags. It's different output that forces different versio... | 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 |
You have found the path through the forest and now plan on travelling along it. However, just before you start on your journey, the ground turns into lava.
You manage to scurry up the nearest tree (the trees have inexplicably not burnt up), but now you are faced with a problem: how can you get out of the forest when t... | stackexchange_codegolf |
Related.
Given a positive integer \$n\$, output all integers \$b\$ (such that \$1<b<n-1\$) where \$n\$ can be written as the sum of any number of consecutive powers of \$b\$.
Example:
Let's say \$n=39\$.
\$3^1+3^2+3^3\$
\$= 3 + 9 + 27\$
\$= 39\$
This does not work for any other \$b\$, so our output is [3].
Test cases... | stackexchange_codegolf |
Tomorrow is the Mid-Autumn festival, and in the spirit of that holiday, I will introduce a gambling game that we (people from Xiamen) play during the holiday!
Rules
The game is played with six 6-sided dice. Different combinations of numbers have different ranks, with a special emphasis on fours and ones. Your job is to... | stackexchange_codegolf |
Write a program or function that takes in a 4×4 text grid consisting of exactly 4 A's, 4 B's, 4 C's, and 4 D's, such as:
ACDC
BBCA
BADD
ABCD
The ABCD's may be in any arrangement but there will always be 4 of each. You can assume the input is valid. If desired you can also assume it has a trailing newline and/or that i... | stackexchange_codegolf |
Given an input integer n >= 10, output the average of all deduplicated rotations of the integer.
For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two rotations). The average of those is (123 + 231 + 312) / 3 or 222.
As another example, take 4928. The rotations are 4928, 9284,... | stackexchange_codegolf |
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or upperca... | stackexchange_codegolf |
Related
You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But luckily, you have a bit of ingenuity...
Write a program or function that when given an array of unique, positive numbe... | stackexchange_codegolf |
In this challenge, bots must survive as long as possible. In each turn, the bot with the most HP is eliminated.
This challenge is inspired by the Smallest unique number KoTH.
Results
After 100,000 rounds:
Jack: 63390
The Follower: 4942
The Algorithm: 2452
The Randomiser: 140
Toe Tipping: 0
EZ: 0
The Average: 0
LowProfi... | stackexchange_codegolf |
Input description
A string (for best results, all characters should be printable and be the same width).
Output description
A character star following the pattern:
0 0 0
1 1 1
222
0123210
222
1 1 1
0 0 0
where 0, 1 ... are subsequent characters of the string. The output does not necessarily have to be ... | stackexchange_codegolf |
Intro
In Objective-C (a superset of C and an object-oriented language), I can create an object called a UIWebView. There is a method for this object called loadHTMLString: in which I can load actual HTML into the UIWebView object itself. I can also inject Javascript into it using the method stringByEvaluatingJavaScript... | stackexchange_codegolf |
This is the robbers' challenge. To post a cop, go here.
In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans... | stackexchange_codegolf |
Introduction
Doppelkopf is a traditional German card game for 4 players. The deck consists of 48 cards (9, 10, Jack, Queen, King, Ace of each suit while every card is in the game twice), so each player gets 12 at the start of a round.
There are always 2 teams which are determined by the distribution of the Queens of Cl... | stackexchange_codegolf |
Gomoku or Five in a row is a board game played by two players on a \$15 \times 15\$ grid with black and white stones. Whoever is able to place \$5\$ stones in a row (horizontal, vertical or diagonal) wins the game.
Rules
In this KoTH we'll play the Swap2 rule, meaning that a game consists of two phases: In the initial ... | 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 |
For a 2 dimensional array we will call the elements in either the first row or the last column the "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4} & \color{red}{\... | stackexchange_codegolf |
Someone I know has no coding experience, but has proposed an algorithm* to determine the character limit of text fields they find online. They copy a string containing the numbers from 1 to 1,000 inclusive, not separated in any way, and they read the last few digits it displays.
For example, after pasting, they might s... | stackexchange_codegolf |
Most people are familiar with the trope about counting sheep to fall asleep. There's a herd of sheep, some of them jumping over a fence, and you count the sheep as they jump. Supposedly, this helps quiet your mind and gets you into a sleep-like state so that you'll fall asleep.
Here's an ASCII sheep facing to the right... | stackexchange_codegolf |
Github
You have probably played, and may even have written a program to play, a simple number guessing game. If so, this probably looks familiar:
Try to guess my number (1 to 100)!
Please enter a guess: 50
Too small, guess again!
Please enter a guess: 75
Too big, guess again!
Please enter a guess: 63
Correct!
(Obvious... | stackexchange_codegolf |
Given a nonnegative integer n, your solution must output a program in your chosen language whose output has n times as many bytes as the outputted program.
Rules
You must specify the language and encoding of the programs your solution outputs, and you may not choose different languages or encodings for different input... | stackexchange_codegolf |
A Fermi-Dirac Prime is a prime power of the form \$p^{2^k}\$, where \$p\$ is prime and \$k \geq 0\$, or in other words, a prime to the power of an integer power of two. They are listed as integer sequence A050376. While a normal prime factorization generally does not contain a set of distinct primes (for example \$24=2... | stackexchange_codegolf |
This is the first part of a three part challenge. The next parts will be released on August 13 and 14.
This challenge series was inspired by another challenge series. You can view the original one at Random Golf of the Day #1: Shuffle an Array.
Instructions
Your goal in this code golf is to reverse a URL, but not full... | stackexchange_codegolf |
Let's assume that
$$
f(x) = \frac{Ax+B}{Cx+D}
$$
Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants.
Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(x)\$, To do this first we assume,
$$
y = f(x)
\\\rightarrow y=\frac{Ax+B}{Cx+D}
\\\rightarrow Cxy+Dy=Ax+B
\\\rightarrow... | stackexchange_codegolf |
The Method of Finite Differences is a technique used to find the next term in a sequence of numbers, given that the sequence is governed by consecutive values of a certain polynomial. Given a list of n terms, the Method will be able to determine the degree of the polynomial, which is a maximum of n+1.
The Method works ... | stackexchange_codegolf |
Introduction
Write a solver for the Hitori puzzles using least bytes.
Challenge
Your task is write a solver for the Hitori (ひとり, the word for "alone" in Japanese; the meaning of the game name is "Leave me alone") logical puzzles. The rules are as follows:
You are presented with a n-by-n grid of cells, each cell contai... | stackexchange_codegolf |
Consider an \$n \times n\$ grid of integers which is part of an infinite grid. The top left coordinate of the \$n \times n\$ grid of integers is \$(0, 0)\$.
The task is to find a circle which when overlaid on the grid gives the largest sum of values inside it. The constraints are:
The circle has its centre at \$(x, x... | stackexchange_codegolf |
Given two strings \$A\$ and \$B\$ with edit (Levenshtein) distance \$x\$, find a third string with edit distance \$a\$ to \$A\$ and edit distance \$b\$ to \$B\$ so that \$a+b=x\$ and \$a=int(x/2)\$ (that is half of \$x\$ rounded down to the nearest integer).
The input is the two strings \$A\$ and \$B\$ and their edit d... | stackexchange_codegolf |
Consider the positive integer powers of five in decimal. Here are the first 25, right aligned:
X 5^X
1 5
2 25
3 125
4 625
5 3125
6 15625
7 78125
8 390625
9 1953125
10 ... | stackexchange_codegolf |
The goal of this challenge is to extend the OEIS sequence A334581.
Number of ways to choose \$3\$ points that form an equilateral triangle from the \$\binom{n+2}{3}\$ points in a regular tetrahedral grid of side length \$n\$.
The sequence begins 0, 0, 4, 24, 84, 224, 516, 1068, ...
Example
For example, if we take sid... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.