instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Your challenge is to exactly output the following box:
..................................................
..................................................
.. ..
.. ..
.. ++++++++++++++++++++++++++++++++++++++++++ ..
.. ++++++... | stackexchange_codegolf |
Intro (semi fictional)
I'm the solo developer of a game, I'm already struggling with character design as is. Hence I've thought of a smart solution, I'll just use images for regular monsters, outline them a bit and suddenly they are boss monsters! That will save me from thinking up new bosses yay.
However, I have appro... | stackexchange_codegolf |
Challenge description
In this challenge, we only consider love and hate as feelings. If we want to utter a feeling expression of order N, we alternate between these two (starting with hate):
order | expression
1 I hate it.
2 I hate that I love it.
3 I hate that I love that I hate it.
4 I hate t... | stackexchange_codegolf |
A Latin square of order n is text which is arranged as a square of n lines by n columns, contains n different characters, and each character appears once in each line and column. For example, here is a Latin square of order 9:
Code gOlf
ode gOlfC
de gOlfCo
e gOlfCod
gOlfCode
gOlfCode
OlfCode g
lfCode gO
fCode gOl
M... | stackexchange_codegolf |
In LLAMA, you want to dump cards from your hand as quickly as you can, but you might not be able to play what you want.
Each player starts a round with six cards in hand; the deck consists of llama cards and cards numbered 1-6, with eight copies of each. On a turn, the active player can play a card or draw a card. To p... | stackexchange_codegolf |
Normal brackets ((),[],<> and {}) are nice and unambiguous, however someone thought it would be a good idea to use non bracket characters as brackets. These characters, | and ", are ambiguous. For example does
""""
correspond to
(())
or
()()
It is impossible to tell.
Things start to get interesting when you mix ty... | stackexchange_codegolf |
kolmogorov-complexity is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, sta... | stackexchange_codegolf |
This is inspired by an 05AB1E answer by Magic Octupus Urn.
Given two arguments, a positive integer and a string/list of characters:
Translate the number to base-n, where n is the length of the string.
For each character, replace every appearance of the index of that character in the base-n number with that character.
... | stackexchange_codegolf |
So simple: Provide some code that outputs foo and with the reversed source outputs bar. But before you come up with something like this boring python 2:
print "foo"#"rab" tnirp
you should know the score: You multiply the number of bytes with (1 + dead bytes), where dead bytes are bytes that can be changed to most othe... | stackexchange_codegolf |
Challenge
Given a string and a number, divide the string into that many equal-sized parts. For example, if the number is 3, you should divide the string into 3 pieces no matter how long the string is.
If the length of the string does not divide evenly into the number provided, you should round down the size of each pie... | stackexchange_codegolf |
A drug comes in 5mg, 2.5mg, and 1mg sized pills. The drug is taken once a day. The total daily dose will be only one of the following (all in mg):
1, 2, 3, ... 20, 22.5, 25, 27.5, 30, 32.5, 35, 37.5, 40, 42.5, 45, 47.5, 50
In words: any whole number less or equal to 20, then at 2.5mg increments up to 50.
Your task is t... | stackexchange_codegolf |
The challenge
Given a 2d string representing the bottom of a boat as an input, you must determine whether or not the boat will float. This 2D string can be in whatever format is most convenient. (String with newlines, list of string, list of list of chars, etc.) Print a truthy value if it will float, and a falsey value... | stackexchange_codegolf |
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program... | stackexchange_codegolf |
(Despite 60+ questions tagged chess, we don't have a simple n-queens challenge.)
In chess, the N-Queens Puzzle is described as follows: Given an n x n chessboard and n queens, arrange the queens onto the chessboard so that no two queens are threatening each other. Below is an example solution for n = 8, borrowed from W... | stackexchange_codegolf |
Challenge
Write a program or a function that returns or prints a square-random-symmetrical matrix.
Input
N: The size of the matrix i.e 6 x 6
Output
The matrix. You can either print it, return it as string (with the newlines) or as a list/array of lists/arrays.
Rules
You need to use at least N different characters, ... | stackexchange_codegolf |
Background
An interval graph (Wikipedia, MathWorld, GraphClasses) is an undirected graph derived from a set of intervals on a line. Each vertex represents an interval, and an edge is present between two vertices if the corresponding intervals overlap. The following is an example interval graph with corresponding interv... | stackexchange_codegolf |
Your challenge, should you choose to accept it, is, given an integer K >= 1, find non-negative integers A and B such that at least one of the two conditions following hold:
K = 2^A + 2^B
K = 2^A - 2^B
If there does not exist such A and B, your program may behave in any fashion. (To clarify, A and B can be equal.)
Te... | stackexchange_codegolf |
She said s(he) be(lie)ve(d), he said sbeve.
Input
A non-empty string, s. It's guaranteed that s will have only printable ASCII characters and at least one word (defined as [A-Za-z0-9]+) in parentheses, and all parentheses will be closed respectively.
Output
A string containing all non-whitespace characters (whitespa... | stackexchange_codegolf |
Background
A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and each attack causes a specific amount of heads to regrow. The knights have hired you to write a program or function that... | stackexchange_codegolf |
Challenge
Given daily arrival and departure times of every train that reaches a railway station, find the minimum number of platforms required for the railway station so that no train waits.
In other words, find the maximal number of trains simultaneously present in the station.
Input
a pair of lists of times: arrival... | stackexchange_codegolf |
\$ 1089 \$ is a very special number. To prove why, select any 3-digit number whose first and last digits differ by at least 2. Then, reverse the digits, and take the difference of these two numbers. Reverse the digits once more, and add these two numbers together. You will get \$ 1089 \$. The magic is left as an exerci... | 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 |
Take an array which consists of positive integers or arrays, output if it only contains 2s.
Output should be a truthy or falsey value (Sorry if this destroys answers)
Truthy Test Cases
[2]
[2,2]
[[2],[2,2],2]
[]
[[],[]]
Falsey Test Cases
[1]
[22]
[2,2,2,1]
[[1,2],2]
Standard Loopholes Are forbidden.
Default IO rules ... | stackexchange_codegolf |
2019 has come and probably everyone has noticed the peculiarity of this number: it's in fact composed by two sub-numbers (20 and 19) representing a sequence of consecutive descending numbers.
Challenge
Given a number x, return the length of the maximum sequence of consecutive, descending numbers that can be formed by t... | stackexchange_codegolf |
This question is inspired by the fact that I love seeing questions with equal vote and answer counts...
So here's a simple stack-exchange-api challenge for y'all:
Challenge:
Given a codegolf.stackexchange question id, output the ratio between the question's votes and number of answers (e.g. votes/answers).
Specifics:
... | stackexchange_codegolf |
Today Neil Sloane of the OEIS sent out an email asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence A337663 with the keyword "nice".
Here's how this sequence works:
You label \$n\$ cells on the infinite square grid with \$1\$s, and then
place the numbers \$2... | stackexchange_codegolf |
A nonogram is a Japanese puzzle game in which the goal is to draw a black-and-white picture according to a list of contiguous regions, like so:
Define the nonographic magnitude of a row or column to be the number of contiguous black regions in that row or column. For example, the top row has a nonographic magnitude of... | stackexchange_codegolf |
You know those letterboards outside old-style cinemas which show upcoming films - perhaps you have a miniature one in your home?
If you've operated one, you'll know that you can normally add letters from either side of a row. But the slots (in which you slide letters) are thin, so it's impossible to swap the order of ... | stackexchange_codegolf |
I am curious if I am Code Golfing properly. I set the challenge for myself to make a small hashing program into a single statement in Python. I first started off with:
from itertools import permutations
from string import ascii_lowercase
from random import sample
def test():
chars = sample(ascii_lowercase, 9)
... | stackexchange_codegolf |
The challenge is to write codegolf for the permanent of a matrix.
The permanent of an \$n\times n\$ matrix \$A = a_{i,j}\$) is defined as
$$\text{perm}(A) = \sum_{\sigma \in S_n} \prod^n_{i=1} a_{i,\sigma(i)}$$
Here \$S_n\$ represents the set of all permutations of \$[1, n]\$.
As an example (from the wiki):
$$\text{per... | stackexchange_codegolf |
Introduction:
I think everyone knows what a Lava Lamp is, but in case they do not:
(Image source)
They're basically glass tubes that contain wax in a translucent liquid. The bottom part is heated when the lamp is turned on, causing a change in density and thus the wax floats to the top. When it cools down, it falls do... | stackexchange_codegolf |
In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation possible with any other language. In this challenge, we'll be doing somewhat of the opposite, and finding the minimum numbe... | stackexchange_codegolf |
Find the most important character
The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters ()[]{}. Each submission should consist only of non-trivial* characters. Each solution is scored using the formula in the scoring section. Bracketi... | stackexchange_codegolf |
Given a description of the base state of a recursive ASCII pattern, output an expanded state somewhere along the recursion steps.
More specifically: Let the following be an example:
##..
##..
..__
..__
Where # is filled, . is empty, and _ is recursive.
This describes a pattern wherein the top left quarter is filled, t... | stackexchange_codegolf |
Challenge
Given a valid goo.gl shortened link, output the original URL.
Example
goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i... | stackexchange_codegolf |
There is that famous riddle:
A bear walks 1 km south, 1 km east and 1 km north, and comes to the place it started from. What color is the bear?
This one is very old, so I'll generalize it:
A bear walks x km south, y km east and x km north, and comes to the place it started from. This bear thinks that the North Pole ... | stackexchange_codegolf |
Although on codingame.com, Objective C and C are two of the best golfing languages there, so I would like to know some of the best golfing methods (although I am a python person, I am currently trying to learn C++/C)
I am looking for general ways/tips to golf one's code (so please don't post tips such as "remove commen... | stackexchange_codegolf |
Introduction:
Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one. The word-searches in the newspaper have two columns of words, and afte... | stackexchange_codegolf |
Background
Celebrating the release of Dyalog APL 16.0, where the solution to this problem is {⊢⌺(≢⍵)⊢⍵}Explanation
Task
Given a printable ASCII string of odd length n, make an n × n square with the string centered horizontally, duplicated to be centered vertically, and with acrostics of the same string in each row and ... | stackexchange_codegolf |
There have been a couple of previous attempts to ask this question, but neither conforms to modern standards on this site. Per discussion on Meta, I'm reposting it in a way that allows for fair competition under our modern rulesets.
Background
A palindrome is a string that "reads the same forwards and backwards", i.e... | stackexchange_codegolf |
The keitai input method is a method for writing Japanese kana on a 12-key phone keypad. Similar to Western keypads, each kana is assigned to a key; when the key is pressed multiple times, it cycles between all kana assigned to that key.
You will be using the following key-kana assignments, with this order of kana (base... | stackexchange_codegolf |
One of my favorite types of challenges on this site are restricted-source challenges. These challenges impose a computer tractable restriction that the sources of potential answers must pass. I like these challenges so much I have been working on a golfing language designed to win at these challenges for some time no... | stackexchange_codegolf |
Example run added 4/11
Rules Clarification 4/8: All submissions will be competing in one giant free-for-all tournament consisting of as many matches as my computer can perform in 48 hours.
Anyone who's spent any time watching streams on Twitch is aware of the prevalence of DeepBot, and is perhaps even familiar with its... | stackexchange_codegolf |
Write a program that takes in a string and spells that word out using the NATO Phonetic Alphabet.
The mapping is as follows:
'A' -> 'Alfa'
'B' -> 'Bravo'
'C' -> 'Charlie'
'D' -> 'Delta'
'E' -> 'Echo'
'F' -> 'Foxtrot'
'G' -> 'Golf'
'H' -> 'Hotel'
'I' -> 'India'
'J' -> 'Juliett'
'K' -> 'Kilo'
'L' -> 'Lima'
'M' -> 'Mike'... | stackexchange_codegolf |
Today you need to solve a very practical problem: How many loops do you need to have a certain number of sheets on your toilet paper roll? Let's look at some facts:
The diameter of a bare toilet paper cylinder is 3.8cm
The length of one sheet of toilet paper is 10cm.
The thickness of one sheet of toilet paper is 1mm. ... | stackexchange_codegolf |
The Challenge
Given an arbitrary amount of rectangles, output the total count of intersections of those when drawn in a 2D plane.
An intersection here is defined as a point P which is crossed by two lines which are orthogonal to each other and are both not ending in P.
Example
Each rectangle here is denoted by a 2-tupl... | stackexchange_codegolf |
Introduction:
I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post al... | stackexchange_codegolf |
Based on this closed question on stack overflow, what is the shortest way to stimulate scope for variables in an input. For simplicity, print is replaced with >.
copying critical information from the linked source:
[ and ] start and end a new scope.
Within scopes any changes to a variable outside of that scope is no... | stackexchange_codegolf |
Challenge
Given a positive integer, determine whether it is a triangular number, and accordingly output one of any two constant, distinct values.
Definition
A triangular number is a number that can be expressed as the sum of consecutive positive integers, starting at 1. They can also be expressed with the formula \$\fr... | 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 |
2fuck is a simple 2D variation on brainfuck. Like traditional brainfuck, there is an 1D memory tape that extends 30000 bytes to the right from its beginning, consisting of values between 0 and 255.
Arithmetic should wrap around, adding 1 to 255 sets the cell to 0, and moving right from memory cell 29999 should move the... | stackexchange_codegolf |
I use "sentence" here loosely to mean "any sequence of words separated by spaces" and "words" to mean "sequences of alphanumeric (hexatrigesimal) characters unseparated by spaces".
Conversion is from base-36 (0123456789abcdefg...) or (0123456789ABCDEFG...)
Conversion to base-16 (0123456789abcdef) or (0123456789ABCDEF)... | stackexchange_codegolf |
Background
Shadow transform of a 0-based integer sequence \$a(n)\$ is another 0-based integer sequence \$s(n)\$ defined with the following equation:
$$
s(n) = \sum_{i=0}^{n-1}{(1 \text{ if } n \text{ divides } a(i), 0 \text{ otherwise})}
$$
i.e. \$s(n)\$ is the number of terms in \$a(0), \cdots, a(n-1)\$ that are divis... | stackexchange_codegolf |
The following puzzle was invented by Eric Angelini in September 2007.
As mentioned in A131744 :
the sequence is defined by the property that if one writes the English
names for the entries, replaces each letter with its rank in the
alphabet and calculates the absolute values of the differences, one
recovers the sequen... | stackexchange_codegolf |
Imagine you are sitting at a park. Suddenly your car gets hijacked and being driven in different directions. Here are the directions, arrows show which direction goes towards where:
South
|
V
East-> <-West
^
|
North
After being driven, the car stops. Now you have to find out ho... | stackexchange_codegolf |
Mash Up Time!
This is instalment #5 of both my Random Golf of the Day and Optimizer's ASCII Art of the Day series. Your submission(s) in this challenge will count towards both leaderboards (which you can find the linked posts). Of course, you may treat this like any other code golf challenge, and answer it without worr... | stackexchange_codegolf |
Related: Multiply Quaternions
Challenge
Given a string made of ijk, interpret it as the product of imaginary units of quaternion and simplify it into one of the eight possible values 1, -1, i, -i, j, -j, k, -k.
The evaluation rules are as follows:
$$
ii = jj = kk = -1 \\
ij = k, \quad jk = i, \quad ki = j \\
ji = -k, \... | stackexchange_codegolf |
Write a program that groups a string into parentheses cluster. Each cluster should be balanced.
Examples :
split("((())d)") ➞ ["((()))"]
split("(h(e(l)l)o)(w(o)r)l(d)(w)h(a(t)(s)u)p") ➞ ["((()))", "(())", "()", "()", "(()())"]
split("((())())(()(()()))") ➞ ["((())())", "(()(()()))"]
Input may contain letters other t... | stackexchange_codegolf |
Problem
Recreate the UI from a torrent program
Given no input, output the following:
+----------+----------+----------+
|a.exe |##########|seeding |
+----------+----------+----------+
|b.exe 10% |# |leeching |
+----------+----------+----------+
|c.exe |##########|seeding |
+----------+----------+--... | stackexchange_codegolf |
The usual correlation coefficient (in 2d) measures how well a set of points can be described by a line, and if yes, its sign tells us whether we have a positive or negative correlation. But this assumes that coordinates of the points can actually interpreted quantitatively for instance as measurements.
If you cannot do... | stackexchange_codegolf |
Encrypting Challenge
Your encrypting program must be able to do following things:
Input password
Generate random key
Encrypt random key with set key
Then, the decrypting program must be able to these things:
Input encrypted password
Input encrypted random key
Decrypt random key
Decrypt password with decrypted random ... | stackexchange_codegolf |
What I'd like to see is your attempts at writing a kind of "story" that has a fairly easy to read meaning, but also creating a valid code fragment. For example, this (BBC) BASIC code:
LET customer = "sober"
REPEAT
INPUT "more beer"
UNTIL customer = "drunk"
(based on http://img.rakuten.com/PIC/12184048/0/1/300/121840... | stackexchange_codegolf |
Code Python 3, 245 bytes
E=print
def F():
B,C,A=1,1,1;yield 0
while True:yield B;B,C,A=B+C+A+1,C+A+1,A+1
C=int(input())
D=0
for A in range(C):
E(end='*'*(C-(C-A)+1));B=A
while 0<B:E(end=' '+chr(42+B)*B);B-=1
E();D+=1
for A in F():
if D==0:E(end=str(A));break
D-=1
Try it online!
What it does?
Takes a number from... | stackexchange_codegolf |
You have come across an old Indian manuscript, one that describes mounds of buried treasure. The manuscript also tells you the location of the treasure, except that some crucial numbers have been encoded indirectly into the text. You figure out that the text uses a 'Kaadi' system, a restricted subset of the more common... | stackexchange_codegolf |
There is a building with an infinite number of floors and you are the only passenger in an elevator which can lift an infinite number of people. You are going home, but before the elevator gets to your floor, the elevator stops at another floor to allow people to enter the elevator and input their destination floors. Y... | stackexchange_codegolf |
Overview
Some of you might be aware of the Kolakoski Sequence (A000002), a well know self-referential sequence that has the following property:
It is a sequence containing only 1's and 2's, and for each group of 1's and twos, if you add up the length of runs, it equals itself, only half the length. In other words, the... | stackexchange_codegolf |
The world has been invaded by aliens. They are everywhere killing people and taking over the world. You are hiding with your friend.
They have one weakness - the high pitched sounds.
You can't go yell at them, because you'd get caught before, so you remember the state had a conveniently made machine that emits a high p... | stackexchange_codegolf |
Characters in strings are sometimes represented as their ASCII hexadecimal codes. Printable characters have two hex digits in their representation. Swapping those digits leads to another character, which will be our output.
The table of relevant character codes can be found on Wikipedia.
Details
Take a string as input... | stackexchange_codegolf |
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible to end up in a scenario where there are multiple valid answers and you may o... | stackexchange_codegolf |
A frog sits on a lily pad wishing it were on the other side of the river. There are some lily pads of varying sizes between the frog and the other side of the river. Larger lily pads allow the frog to jump further than smaller ones and the frog wishes to reach the other side of the river in as few jumps as possible.
... | stackexchange_codegolf |
Introduction
The \$RADD(n)\$ operation is defined as the sum of \$n + [\$ the number whose decimal representation are the decimal digits of \$n\$ in reverse order \$]\$, see A004086. After reversal, trailing zeros are lost. See Reverse-Then-Add Sequence and A056964.
Not all numbers can be represented as the result of a... | stackexchange_codegolf |
(This is OEIS A057531.)
Your task
Given a positive integer, \$n\$, find the \$n\$th number where the digit sum equals the number of factors
Explanation
For example, let's take 22:
Its factors are \$[1, 2, 11, 22]\$ (length: 4).
Its digit sum is 4.
This means that it is a number where the digit sum equals the number of ... | stackexchange_codegolf |
Create a quine that cannot be golfed. Your score is your byte count, where higher is better. If someone finds a shorter version, their score is your original byte count, and you lose points
Scoring example:
original submission, 34 bytes // score is 34
function(this){self.printquine();}
golfed, 31 bytes ... | stackexchange_codegolf |
ESL gaming, where you can challenge players to play games. I've provided some steps you can take manually to challenge a player. Note that you have to signup for an account and have to be logged in to perform these steps. (Important: you have to sign-up for the ladder before you can challenge on that ladder too. Finall... | stackexchange_codegolf |
Given an array of positive integers and two distinct valid indices, return the array with the two elements corresponding to the two indices swapped.
You may choose to use 0-indexing or 1-indexing, but the testcases below will be 0-indexed.
array m n output
[1,2,3,4] 0 1 [2,1,3,4]
[5,8,9] 0 2 [9,8,5]
[11,... | stackexchange_codegolf |
Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters.
The basic algorithm
For each character in the string:
Check: Does the string contain the character again, after the instance you found?
If so, then modify the string by reversing the s... | stackexchange_codegolf |
Consider the standard equilateral triangle, with nodes labeled using barycentric coordinates:
We can turn this 3 node triangle into a 6 node triangle by adding a new line of 3 vertices (one more than was present on a side of the original 3 node triangle), remove any internal edges (but not internal nodes) and re-norma... | stackexchange_codegolf |
If you visit Code Golf often, you may have heard of Kolmogorov complexity. It's usually defined as the amount of bytes required to express some string in a programming language.
Here the Kolmogorov-complexity of a natural number is defined similarly: the number of bytes required to represent it in a programming languag... | stackexchange_codegolf |
Given an input of a string, output the partial fraction in string form.
The partial fraction decomposition of a rational fraction of the form \$\frac{f(x)}{g(x)}\$, where \$f\$ and \$g\$ are polynomials, is its expression as:
$$\frac{f(x)}{g(x)}=p(x)+\sum_j\frac{f_j(x)}{g_j(x)}$$
In this case \$p\$ is 0, because we ass... | stackexchange_codegolf |
Background
You have just learned what combinatory logic is. Intrigued by the various combinators you spend quite a bit of time learning about them. You finally stumble upon this particular expression:
(S I I (S I I))
You notice that when trying to reduce it to its normal form, it reduces to itself after three steps:
(... | stackexchange_codegolf |
An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$.
Any \$q\$, in fact, can be calculated by the following formula.
$$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lfloor(x-y)/2\rfloo... | stackexchange_codegolf |
Introduction
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies x*x+y*y=1. Because Cryptographers1 are also weird, they love finite fields and sometimes finite rings (it is not like they have much choice though), so let's comb... | stackexchange_codegolf |
I would like to convert ASCII art to something that takes less bytes. I have string like this:
my $string = ' ██ ████ █';
And I would convert this to something like this:
print "█" x 1."█" x 1."█" x 1"█" x 1"█" x 1;
So I would write this in one line and convert to using x operator. How can achieve ... | stackexchange_codegolf |
For more information, watch this video, and go to A276523 for a related sequence.
The Mondrian Puzzle (for an integer n) is the following:
Fit non-congruent rectangles into a n*n square grid. What is the smallest difference possible between the largest and the smallest rectangle?
For 6, the optimal difference for M(6) ... | stackexchange_codegolf |
This is a cops-and-robbers challenge. The Cops' thread to this challenge is here
An interesting question to think about is the following:
If I have a sequence of numbers how many of them do I have to provide before it is clear what sequence I am talking about?
For example if I want to talk about the positive integers... | stackexchange_codegolf |
Given a list of Integers greater than zero, Sort each of the unique values in ascending order, then repeat the process on the remaining duplicate values and append.
Example:
[1,5,2,2,8,3,5,2,9] ==> [1,2,3,5,8,9,2,5,2]
[8,5] ==> [5,8]
[2,2,2] ==> [2,2,2]
| stackexchange_codegolf |
Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original input).
Output must be padded with zeroes to be the same length as the input.
The Order in which the values are displayed d... | stackexchange_codegolf |
Risky is a new language of mine, which features an interesting form of tacit programming. In this challenge, you'll take a Risky program as input, and visualize the parsing.
No knowledge of Risky is needed for this challenge, but it's a pretty interesting language so I'd recommend trying it :p.
Task
Risky's parsing is ... | stackexchange_codegolf |
Inpsired by a youtube video from a fellow PPCG user...
You challenge is to use ASCII-art draw a Minecraft castle wall of Andesite and Diorite. The shape of the wall is the Cantor Set. For reference, the Cantor Set is made by repeating the following N times:
Triple the current step
Replace the middle one with blank spa... | stackexchange_codegolf |
Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program.
The Fibonacci Sequence is the well known sequence
F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2)
Write a program that takes some input n and outputs the nth fibonacci number in qui... | stackexchange_codegolf |
I was just playing the board game Sorry! with some people, and I realized that I could base a few interesting challenges off of it. This one is pretty simple.
You task is simply to output an ascii-art version of a sorry board, placing pieces where I tell you to.
Specs
First, here is an image of an actual Sorry! board f... | stackexchange_codegolf |
Your task: given a number n, generate a '+' sign that is n characters away from its center. If this is confusing, check out the test cases.
Standard methods of input: output must be a string or printed. Standard loopholes apply.
Input: 1
Output: + ] 1 away from center `+`.
Input: 2
Output: + ] 2 a... | stackexchange_codegolf |
This is the robbers thread of this cops and robbers challenge. The cops thread is here.
Related, but hashes numbers instead of strings and uses a different scoring system.
Definitions
A hash collision is when two different strings produce the same hash.
Summary
In this challenge, the cops will make a hash function, wit... | stackexchange_codegolf |
Eyeballing the binary values printed as ovals and sticks is not so easy...
To help with that, you must write a function (or a program) that prints numbers in custom binary representation.
So I want to take a number, say 3 (00000011) and output the bits in user-defined format, for example with space separated pairs:
0... | stackexchange_codegolf |
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape:
div {
width: 200px;
height: 200px;
border-radius: 99% 0;
rotate: 45deg;
background: #d9d9d9;
}
<div></div>
He... | stackexchange_codegolf |
I didn't invent this challenge, but I find it very interesting to solve.
For every input number, e.g.:
4
Generate a range from 1 to that number:
[1 2 3 4]
And then, for every item in that list, generate a list from 1 to that number:
[[1] [1 2] [1 2 3] [1 2 3 4]]
Then, reverse every item of that list.
[[1] [2 1] [3 2... | stackexchange_codegolf |
Background
A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid.
A triangular lattice point is a vertex of a triangle forming the triangular grid.
The origin is a fixed point on the plane, which is one of the ... | stackexchange_codegolf |
Write a program that takes in a string of the four characters ()[] that satisfies these points:
Every left parenthesis ( has a matching right parenthesis ).
Every left bracket [ has a matching right bracket ].
Matching pairs of parentheses and brackets won't overlap. e.g. [(]) is invalid because the matching brackets ... | stackexchange_codegolf |
You are probably familiar with the Cartesian product. It takes two lists and creates a list of all pairs that can be made from an element of the first and an element from the second:
\$
\left[1,2\right] \times \left[3,4\right] = \left[(1,3),(1,4),(2,3),(2,4)\right]
\$
Here the order of the result is such that the pair... | stackexchange_codegolf |
Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses.
For example, given ASTNORDYUVKFMCLWIHEBQGPJXZ as the permutation, and ASTRONAUT as the word, we know that the word was guessed. Only 2 letters (DY) were wrong... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.