instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
What tips do you have for code-golfing in the V lang? I have been trying to find ways to shorten codegolfs on there but can't find any resources on it. Do you guys have any?
Please suggest tips that are at least somewhat specific to the V programming language (e.g. "remove comments" isn't helpful).
Please post one tip ... | stackexchange_codegolf |
Create a program which prints the amount of characters its source has in English words.
If your program is nine letters long it should print "nine".
Capitalization is ignored: in case you're printing "one" (somehow) you can print "one", "oNe", "ONE" or anything else.
Base ten is required.
Proper spacing is also require... | stackexchange_codegolf |
Given a key, and an array of strings, shuffle the array so that it is sorted when each element is XOR'd with the key.
XOR'ing two strings
To XOR a string by a key, XOR each of the character values of the string by its pair in the key, assuming that the key repeats forever. For example, abcde^123 looks like:
a ... | stackexchange_codegolf |
Consider a non-empty binary matrix M and a natural number n. For the purposes of this challenge, M is said to have blockiness n if it can be built using adjacent square blocks of size n, where each block has equal entries; and it cannot be formed using square blocks of any larger size. Intuitively, n can be thought of ... | stackexchange_codegolf |
Given a sequence of the bases Adenine, Cytosine, Guanine and Thymine (encoded as ACGT), you're to produce an ASCII art representation of a corresponding double strand of DNA.
The strand will extend vertically. The left-hand strand is the one you are given as input. The right-hand strand will be its complement. For thos... | stackexchange_codegolf |
This is a problem that the Hacker Cup team made for the 2018 Facebook Hacker Cup, but we ended up not using it (though Ethan struggles through a variety of other challenges). Normally code size isn't a factor in the Hacker Cup, but we thought this would make for an interesting code golf challenge. We look forward to se... | stackexchange_codegolf |
Given an integer \$x_1\$ and some black box function \$f: ℤ → ℤ\$ find a fixed point of \$f\$ in the sequence defined by \$x_{k+1} := f(x_k)\$.
Details
A value \$x\$ is said to be a fixed point of \$f\$ if \$x = f(x)\$.
For instance if \$f(x) = \text{round}(\frac{x}{\pi})\$ and we have a starting point \$x_1 = 10\$ t... | stackexchange_codegolf |
Picture of me drafting this challenge with my advanced drawing skills.
Background
The Stickman wars happened long ago, when Earth's dominant species was made of nothing but sticks. Historians regret the fact that there were no painters or cameras back then, we could use some pictures of that war in today's history bo... | stackexchange_codegolf |
A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by the binomial coefficients:
$$p_n = {x \choose n} = \frac{x(x-1)\cdots(x-n+1)}{n!}$$
For instance:
\$p_0 = 1\$
\$p_1 = x\... | stackexchange_codegolf |
Write a script that outputs A to stdout infinitely.
There should be no newlines or separators between the characters.
Standard loopholes apply.
This is code-golf. The shortest solution in each language wins.
| stackexchange_codegolf |
A great Python golfing tip is to omit needless spaces. But if you are like me, you don't always have the time to search for which spaces to remove. If only there was a way to speed up the process...
Task
Given a single line of Python, as input, return/output a new line which omits all needless spaces. The table below s... | stackexchange_codegolf |
I love functional programming in Octave, but it's rather unwieldy in practice. I'm wondering about the shortest way to define an anonymous recursive function.
I have some ideas, but I'm wondering if there is a way to combine these ideas to make them even shorter (or equally short but more versatile). For the sake of th... | stackexchange_codegolf |
My birthday is in a month, and this is a slice of tasty cake.
.-""-.
.-" "-.
|""--.. "-.
| ""--.. "-.
|""--.. ""--..\
| ""--.. |
| ""--..|
""--.. |
""--.. |
""--..|
In the fewest number of bytes, construct this slice of cake for me. Y... | stackexchange_codegolf |
Your program has to have an year like 1957 to be the input and then output the century of that year.
For example:
In: 1946
Out: 20
In: 1705
Out: 18
In: 1900
Out: 19
In: 100
Out: 1
In: 2001
Out 21
because 1946 is in the 20th century.
Keep in mind that 2000 should be 20th century or 1900 should be in 19th century.
There... | stackexchange_codegolf |
I found this YouTube video with a table on it showing some card suits with ampersands. You might not understand what it is about, but I still want to make a challenge about it.
The input is two suits, being one of the following:
heart
diamond
spade
club
You can do anything for any other input.
Then the output is their... | stackexchange_codegolf |
Write the shortest program that prints the sound my alarm clock makes, and stops after an inputted number of beeps.
For reference, here is the sound my alarm makes:
beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep bee... | stackexchange_codegolf |
Task:
Consider the problem: "given a chessboard with one square missing, cut it into 21 L-triominoes". There is a well-known constructive proof that this can be done for any square chessboard size that is a power of two. It works by splitting the chessboard into a smaller chessboard with the hole in it and one big trio... | stackexchange_codegolf |
Introduction
In this challenge you should split an integer into two pieces. Since nobody likes getting the smaller piece of cake, your goal is to be as fair as possible. For example if you wanted to split the integer 7129 into two pieces, there are 3 possible ways of doing so.
7,129, 71,29 and 712,9 are all possibiliti... | stackexchange_codegolf |
This is the cop's thread. The robber's thread is here.
Write a code that takes an input n and creates a n-by-n "snake matrix".
A snake matrix is a matrix that follows this pattern:
3-by-3:
1 2 3
6 5 4
7 8 9
and 4-by-4:
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
The exact output format is optiona... | stackexchange_codegolf |
Background: the Ramsey number \$R(r,s)\$ gives the minimum number of vertices \$v\$ in the complete graph \$K_v\$ such that a red/blue edge coloring of \$K_v\$ has at least one red \$K_r\$ or one blue \$K_s\$. Bounds for larger \$r, s\$ are very difficult to establish.
Your task is to output the number \$R(r,s)\$ for ... | stackexchange_codegolf |
Your task is, to count how many pluses I have.
What Pluses?
The no plus: 0 Points
-
The naïve Plus: 1 Point
+
The double Plus: 2 Points
+
+++
+
The mega double plus: 3 Points
+
+++
+
+ + +
+++++++++
+ + +
+
+++
+
Pluses of higher order than 3 must be ignored.
Rules
Input will ... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
Santa is delivering presents to an infinite two-dimensional grid of houses. The delivery begins delivering a present to the ... | stackexchange_codegolf |
Write a program that when given a string \$S\$, it generates a program of the same language as itself.
The generated program, when given a continuous substring of \$S\$, should predict the next character in an occurence of the subtring in \$S\$. You are guaranteed that this substring occurs exactly once in \$S\$ and do... | stackexchange_codegolf |
In the description of this challenge, the following board will be used as a reference for positions:
ABC
DEF
GHI
For instance, in a game of ordinary tic-tac-toe, B E A C G D F H I describes the following:
-X- -X- XX- XXO XXO XXO XXO XXO XXO
--- -O- -O- -O- -O- OO- OOX OOX OOX
--- --- ... | stackexchange_codegolf |
Challenge
Given the number of an XKCD comic, output the title text of that comic (the mouseover text).
However, the program must throw an error when given the numbers 859 or 404.
Rules
The number given will always be an existing comic (except 404).
Your program must not throw an error for any other numbers than 859 or... | stackexchange_codegolf |
Your task is to write a program that will output a readable list of every five letter words with the structure:
consonant - vowel - consonant - vowel - consonant
The output should be sorted alphabetically with one word per line and no words repeated twice. It can be lowercase or uppercase but not mixed. So the list cou... | stackexchange_codegolf |
Goal
Write a function or a program that when given a string, for example "The quick brown fox jumps over the lazy dog", outputs:
T h e q u
i
e r t h e c
v k
o l
a b
s z r
p y o
m g o d w
u n
... | stackexchange_codegolf |
Challenge
You find yourself in a bash terminal, and want to do some simple tests
on sqlite3.
So you issue the following command:
echo "CREATE TABLE T (id INT NON NULL PRIMARY KEY)" | sqlite3 test.db
Now you want to insert the first N integers (starting from 0, excluding N) into the table T.
For convenience, you execut... | stackexchange_codegolf |
We define a Collatz-like sequence s with 4 positive integers:
n starting value
d > 1 divisor
m > 1 multiplier
i increment
(In the original Collatz sequence d = 2 m = 3 and i = 1.)
Given these integers s will be created in the following manner:
s(0) = n
if k > 0 and s(k-1) mod d = 0 then s(k) = s(k-1) / d
if k > 0 an... | stackexchange_codegolf |
Halley's Comet is the only comet that may appear (i.e. become visible to the naked eye on Earth) twice in a human lifetime. The orbital period of Halley's Comet is not constant: it has varied between 75 to 79 Earth years since the first definite apparition was recorded in 240 BCE. This variability is mainly driven by g... | stackexchange_codegolf |
Challenge
Given an image of the Moon as input, output the phase of the Moon.
Phases of the Moon
Your program will be supplied one of these images in png format and you must output the phase exactly as given:
new moon
hexdump
waxing crescent
hexdump
first quarter
hexdump
waxing gibbous
hexdump
full moon
hexdump... | stackexchange_codegolf |
Inspired by a question (now closed) at Stack Overflow.
Given a square matrix, let its double trace be defined as the sum of the entries from its main diagonal and its anti-diagonal. These are marked with X in the following examples:
X · · X
· X X ·
· X X ·
X · · X
X · · · X
· X · X ·
· · X · ·
· X · X ·
X · · · X
No... | 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 |
An easy way to understand the unit n-dimensional hypercube is to consider the region of space in n dimensions that you can get if every coordinate component lies in [0, 1]. So for one dimension it's the line segment from 0 to 1, for two dimensions it's the square with corners (0, 0) and (1, 1), etc.
Write a program or ... | stackexchange_codegolf |
Background
Three years ago, this guy Tom Murphy got it into his head to extend the idea of a portmanteau to all words in a language and called this a portmantout (portmanteau plus tout [French for all]). Defining English as a list of 108,709 words, he managed to find a sequence of 611,820 letters with the following two... | stackexchange_codegolf |
To quote http://brainfuck.org/utm.b:
A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer m is chosen, and so is a function P that maps each a[i] for 1<=i<=n to a string P(a[i]) over the alphabet A. Now:
if the string being transformed has fewer than m ele... | stackexchange_codegolf |
Your task is to implement integer sequence A130826:
an is the smallest positive integer such that an - n is an entire multiple of 3 and twice the number of divisors of (an - n) / 3 gives the nth term in the first differences of the sequence produced by the Flavius Josephus sieve.
Lost yet? Well, it's actually quite e... | stackexchange_codegolf |
Challenge
The challenge is simple, using http://isup.me, determine whether an inputted website is up or down.
If the site is up, you should return a truthy value and if the site is down, you should return a falsey value.
Rules
The input will be a web address such as stackexchange.com or google.co.uk. The input will nev... | stackexchange_codegolf |
The Lost Numbers are 4, 8, 15, 16, 23, 42. Your goal is to create an expression to output them all.
Your allowed characters are 0123456789, ^+-*/, (), % for modulo and n as the single variable allowed. Modified PEMDAS ()^*/%+- is the precedence and / is normal division (3/2 = 1.5). 0^0 = 1 although division by 0 is und... | stackexchange_codegolf |
We all know scoring by characters is ripe for abuse. Let's prove this.
The Challenge
Output the following:
"m8V}G=D@7G1lAI,v08`
#(hNb0A8T!g;==SVaG5~
g"jUF!bmRY(3I@na?2S{
fJVzo/GQYU%ybpfUq3aG
Yza[jc,WJ$bP^7r};Da}
V-!Z+Nk:`/poc}d/X:G\
sWX{dbAUv6,i]%RG$hRp
),bd+?/{U1tU[;<;u.Nk
ZFPIOzJ/HimL!nexc,ls
HM%k3D$n2|R,8L?'eI_n
qs.... | stackexchange_codegolf |
Don't you hate it when you can't remember how to craft something in Minecraft? Well, time to remedy that!
Task
Your task is to take an input, either as a 1D or 2D list and output what item is a result of the crafting table!
Input
You may take input as either a string or a list of length 9 or a 2D nested array.
If you t... | stackexchange_codegolf |
Consider this nested array
[[1,2,4],[1,2,3],[2,3]]
In each subarray in which 1 appears, a 2 appears. You might say that 1's presence is dependent on 2's presence.
The converse is not true, as 2 appears in a subarray without 1.
Additionally, 3 is dependent on 2, and 4 is dependent on 1 and 2.
Task
Given a list of lists ... | stackexchange_codegolf |
You might already be familiar with the game: Basketball FRVR in facebook. There are two types of score you can make:
A virgin-shot:(we call it so in our country :D) When the ball enters the basket without touching the rim or
A stale shot: When the ball enters the basket, but after touching the rim.
The game is over ... | stackexchange_codegolf |
I honestly don't know what the point of this sort of calculation would be, but it should make fun golfing. Shortest code wins.
Input (in no particular order)
An array of integers, a (All elements will be integers less than the length of the array.)
An index therein, i
An iteration count, n
Processing
Store a number ... | stackexchange_codegolf |
Some of you may be familiar with the way that a motorcycle shifts. But for those who don't, It looks like this
6
5
4
3
2
N
1
Now I want to know what gear I am in after performing a few up and down shifts.
The program should work from neutral.
Sample input:
V^^
Sample output:
2
As you can see I downshifted once from ... | stackexchange_codegolf |
Suppose you have two six-sided dice. Roll the pair 100 times, calculating the sum of each pair. Print out the number of times each sum occurred.
If a sum was never rolled, you must include a zero or some way to identify that that particular sum was never rolled.
Example Output:
[3, 3, 9, 11, 15, 15, 11, 15, 7, 8, 3]
... | stackexchange_codegolf |
This is the robbers' thread. The cops' thread goes here.
In the cops thread, the task was to create a program that outputs printable ASCII characters in ascending order. The robbers task is to unscramble the code the cops used to produce this output.
The cracked code doesn't have to be identical, as long as it has the ... | stackexchange_codegolf |
Background
Entombed is an Atari 2600 game released in 1982, with the goal of navigating through a continuous mirrored maze as it scrolls upwards. In recent times, the game has been subject to research — despite the strict hardware limitations of the Atari 2600, it somehow manages to create solvable mazes every time. By... | stackexchange_codegolf |
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values.
The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial... | stackexchange_codegolf |
The task is simple: print The quick brown fox jumps over the lazy dog using as few distinct characters in your source code as possible.
print "The quick brown fox jumps over the lazy dog" has a score of 29 characters, as all 26 lowercase letters appear at least once, as well as an uppercase T, spaces, and quote charact... | stackexchange_codegolf |
For some part of history people in France used a decimal clock. with the clock having 10 hour day, 100 minutes an hour and 100 seconds per minute. Though this clock simplified calculations a bit the idea wasn't appreciated by most of the world which used our current 24 hour, 60 minute hour, and 60 second minute. And he... | stackexchange_codegolf |
The goal of this challenge is to take a positive integer n and output (in lexicographic order) all sequences \$S = [a_1, a_2, ..., a_t]\$ of distinct positive integers such that \$\max(S) = n\$.
For example, for an input n = 3 your program should output the following eleven sequences in the following order:
[
[1, 2, ... | stackexchange_codegolf |
I guess you could call this the next challenge in the "Irreducible series".
Hello World
Challenge
Create a cat subject to the constraint that it is irreducible.
A cat program C is considered irreducible if there does not exist a cat (in the same programming language as C) that can be constructed by removing character... | stackexchange_codegolf |
You are an evil wizard, doing evil wizard business, when suddenly your crystal ball alerts you of a hero on their way to defeat you. To crush their hopes and dreams, you decide to trap the hero in a maze. You could just make a big maze but where would be the fun in that? Instead, you decide you want to make the maze as... | stackexchange_codegolf |
We once made a Hexagony template without actually knowing it. But after a bit of experience with Hexagony, it becomes apparent that it is not enough; sometimes the source code is too short for the given hexagon, and you get totally unexpected results.
So I came up with an idea: a template that gives a hint when the cod... | stackexchange_codegolf |
Is there any javascript-like language? Something that can be interpreted by browsers?
| stackexchange_codegolf |
(Note: this challenge is distinct from my other challenge (Draw a path made from direction changers) because of it's rendering of direction (horizontal or vertical), crossing points and single or double paths.)
Let's start with a frame drawn in Ascii characters. For this challenge it will always be 20 characters wide ... | stackexchange_codegolf |
Challenge:
Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal places.
The size of the ASCII-art root also depends on \$A\$ and \$B\$.
Example:
\$a=123\$, \$b=1234\$
____
123 /123... | stackexchange_codegolf |
Your task is to write the shortest algorithm in a language of your choosing that accomplishes the following:
Given two matrices it must return the euclidean distance matrix. The euclidean distance between two points in the same coordinate system can be described by the following equation:
\$D = \sqrt{ (x_2-x_1)^2 + (y_... | stackexchange_codegolf |
You know nothing The things I do for "Chaos is a ladder" is a memorable line from the television series Game of Thrones.
The purpose of this challenge is to build a ladder from chaos, in ASCII art.
The challenge
Input
Ladder width, W >= 3 (integer)
Step height, H >= 2 (integer)
Number of rungs, N >= 2 (integer).
Outp... | stackexchange_codegolf |
The one dimensional twitter waterflow problem is this:
You are given an array that represents a hill in the sense that the ith entry is the height of the ith location of the hill. When it rains, water logs in the hills, and you need to figure out how much water would log.
For example, after raining, the array 2 5 3 4 3... | stackexchange_codegolf |
This is my first challenge, so I'm keeping it fairly simple.
If you've ever typed telnet towel.blinkenlights.nl on your command line and pressed enter, you will have experienced the joy of asciimation. Asciimation is, quite simply, doing an animation with ascii art. Today we will be doing a very basic asciimation of a ... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red and green like this:
GRRRGRRGRG
GGRGGGRRGR
GRRGRGRGRG
GGRRGRGRGG
GRGGRGRGGG
RRGRGRGRRG
RRRGRGRGGG
RGGRGGRRRG
RGGGRRRRRG... | stackexchange_codegolf |
It's holiday season. A mall is empty except of air, money, and a very clever thief that is you.
The mall consists of n floors. Each floor can be represented as a rectangular 2D grid. All floors have the same 2D dimensions. You are somewhere inside the building. Your job, as a hard-working thief, is to collect c coins a... | stackexchange_codegolf |
The flick input method is a way of inputting Japanese kana on a modern smartphone. It is arranged in a 12-key layout, with the following labels:
あかさ
たなは
まやら
小わ、
When a key is tapped, it produces its respective kana. However, when the key is flicked in one of the four cardinal directions (up, down, left, right) it prod... | stackexchange_codegolf |
Many electronic devices, specially old ones, will show a blinking 12:00 when the time has not been set. The purpose of this challenge is to recreate this.
Specifically, the task is to display 12:00 and --:-- alternatively in an infinite loop.
The period should be 1 second, divided evenly in two periods of 0.5 seconds. ... | stackexchange_codegolf |
There are radiation hardened quines, palindromic quines, but has anyone tried both?!
I think not!
Rules
So the challenge here is to make a quine that if any symbol is deleted it prints its original source code, and the quine needs to be the same read forward and backwards(before radiation damage)! All code will be scor... | stackexchange_codegolf |
Challenge: Given an expressions made of additions and multiplications, output an expression that is a sum of products. The output must be equivalent to the input modulo the law of distribution. For example, \$1 + ((2 + 5\times 6) \times(3+4))\$ becomes \$1 + 2 \times 3 + 2 \times 4 + 5\times6\times3 + 5 \times 6 \times... | stackexchange_codegolf |
Challenge
Implement a program that given three strings a, b, and c, substitutes all instances of the substring b in a with c.
In other words, implement Ruby's String#gsub with strings instead of regexes (a.gsub b, c).
Rules
Standard loopholes apply.
You may not use a builtin that performs this exact task.
This is code... | stackexchange_codegolf |
In this contest you have to write a program, that accepts a black and white pixel image, and tries to alter it, such that the white shape forms star domain, with as few changes as possible.
Allowed changes are turning white pixels into black ones and turning black pixels into white ones.
The output must again consist o... | stackexchange_codegolf |
Write a function (or a whole program) that outputs (or prints) an ASCII art of the initial position of Mölkky pins.
Output :
__ __ __
__(07)__(09)__(08)__
(05)__(11)__(12)__(06)
| (03)__(10)__(04) |
| | (01) (02) | |
|__| | | | | |__|
|__| |__| |__|
|__| |__|
Rules :
This is code-go... | stackexchange_codegolf |
Task
Write a function or a program to find the number of rotations required by a wheel to travel a given distance, given its radius.
Rules
Input can be 2 positive rational numbers and can be taken in any convenient format.
Both inputs are of same unit.
There must not be any digits 0-9 in your code.
The output will be a... | stackexchange_codegolf |
In set theory, a set is an unordered group of unique elements. A pure set is either the empty set \$\{\}\$ or a set containing only pure sets, like \$\{\{\},\{\{\}\}\}\$.
Your challenge is to write a program that enumerates all pure sets, in some order of your choice. Standard sequence rules apply - you may:
Output al... | stackexchange_codegolf |
The cop's thread is here
The robber's task is to find a program of size equal to or less than the cop's program, which, when given an itself as input, produces the same output as the cop's program.
Additionally, even if a cop's answer is provisionally marked Safe and has been revealed, you can still crack it by finding... | stackexchange_codegolf |
from Wikipedia, a number is called B-powersmooth if all prime powers \$p^v\$ that divide the number satisfy \$p^v \leq B\$. B-powersmoothness is important, for example, for Pollard's p-1 factorization algorithm.
Task
your task is to get two numbers, \$n\$ and \$B\$, and output if \$n\$ is \$B\$-powersmooth.
Rules
You ... | stackexchange_codegolf |
Identify each letter of the English alphabet with the number denoting its position in the alphabet, that is,
a = 1, b = 2, c = 3, ..., z = 26
(no distinction between lower and upper case letters is made). Every other character is identified with 0.
The "sum" of a word is the sum of its characters, for example: the su... | stackexchange_codegolf |
I was playing around with cellular automaton and I found one that had some interesting behavior. Here's how it works:
It reads a binary string from left to right, if it encounters a 1 followed by 2 other values it will append a 0 to the result and continue reading. If it encounters a 0 (or there are less than 3 value... | stackexchange_codegolf |
Challenge
Given two positive integers \$1 \le m \le 12\$ and \$1\le d \le 31\$, representing a month and days into the month, output the amount of days that have passed since January 1st, on a non-leap year. You can assume that the number of days passed will always be constrained by the number of days in the month (so ... | stackexchange_codegolf |
This challenge was xnor's idea, taken from Digital Trauma's challenge donation thread.
Your challenge is to write a program that, as xnor put it, "procedurally generate[s] the splotchy black-and-white marbled pattern on the covers of composition notebooks":
Your program can either display it on the screen or save it ... | stackexchange_codegolf |
Background
BitCycle is a two-dimensional Turing-complete programming language involves moving bits around a playfield.
Because I am too lazy to write BitCycle programs myself, you will be writing a program which outputs BitCycle programs for me! Unfortunately, the storage space on my computer is only about a bit, so yo... | stackexchange_codegolf |
The first magic card trick I ever learned as a child was the following:
Have 1 deck of cards where the pattern on the back is not vertically symmetric.
Organize all cards to be facing one direction.
Ask an individual to, "pick a card, any card, memorize it and give it back to you".
Proceed to put it into the deck (in ... | stackexchange_codegolf |
Languages, such as C++, have introduced a new comparison operator: <=>.
This operator returns -1, 0, or 1† when comparing two items together:
−1 means the left-hand side is smaller,
0 when both values are equal,
+1 means the right-hand side is smaller.
Here is what I have been coming up with in x86-64:
556: 48 8b... | stackexchange_codegolf |
In North America, most electrical outlets/receptacles follow standards set by NEMA. For this challenge, you'll be given a few properties of a device you need to plug in, and your program (or function) should return all of the outlets that would be compatible.
For this challenge, an outlet has three properties: voltage,... | stackexchange_codegolf |
As in this challenge, the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is divided into \$b\$ segments (denoted \$\{3,5+\}_{b,0}\$ here) and projecting onto the unit sphere. Your pro... | stackexchange_codegolf |
Related
From Wikipedia:
In number theory, the Calkin–Wilf tree is a tree in which the vertices correspond one-to-one to the positive rational numbers. The tree is rooted at the number \$1\$, and any rational number expressed in simplest terms as the fraction \$\frac{a}{b}\$ has as its two children the numbers \$\frac{... | stackexchange_codegolf |
As part of its compression algorithm, the JPEG standard unrolls a matrix into a vector along antidiagonals of alternating direction:
Your task is to take the unrolled vector along with the matrix dimensions and reconstruct the corresponding matrix. As an example:
[1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3], 4, 3
should yiel... | stackexchange_codegolf |
Modern hardware can perform multiplication very fast in a constant latency of 3~4 cycles. But some tiny chips for embedded environments sometimes lack hardware multiplication, which has to be emulated by a series of instructions.
Goal
You are given a primitive CPU with a set of basic operations. Your job is to implemen... | stackexchange_codegolf |
This challenge is inspired by xkcd:
Challenge:
You'll simulate the copying a large file (1 Gigabyte). The transfer rate will vary between 10 kB/second to 100 MB/second.
Your task is to output the time remaining of the file transfer. The output should look like:
Time remaining: 03:12 (meaning it's 3 minutes and 12 s... | stackexchange_codegolf |
A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible scramble states. Due to the way a 2x2 only has two layers, doing one turn on one face is equivalent (without considering the p... | stackexchange_codegolf |
Piano keys are 3 characters wide, and 7 characters tall. However, if every key was 3 charactes wide, there wouldn't be enough room for the black keys. That's why some of the white keys have parts of them cut out. There are 3 types of white keys.
Keys with the right half missing (R):
____
| |
| |
| |
| |
| |
|... | stackexchange_codegolf |
A001057 is one way to represent an integer as a natural number. It lists them according to the following pattern:
0, 1, -1, 2, -2, 3, -3, 4, -4, ...
In this challenge, you'll take two distinct integers as input and return which is at a higher index in this enumeration.
Take -2 and 1 as an example: -2 comes after 1, so... | stackexchange_codegolf |
This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a hypercube of some dimension.
Background
A hypercube is a generalization of a square.
A \$0\$-cube is a single point.
A \$1\$... | stackexchange_codegolf |
Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu.
It seems like a good idea to share some tips for golfing in Thunno 2.
Please, one tip per answer, and no tips like “remove comments and whitespace”.
Links:
Tutorial
List of commands
Attempt This... | stackexchange_codegolf |
Given two natural numbers (less than 100) as input print the sequence of intermediate results obtained when computing the sum of the two numbers using only the following operations1:
n <-> (m+1) for integers nand m satisfying that equation
(a+b)+c <-> a+(b+c) for integers a,b and c (associative law)
You are not allow... | stackexchange_codegolf |
The idea of this is mainly from BIO 2017 q1. I got the idea for posting this challenge from my Binary Sequences challenge, since lots of people seemed to like it.
Also, this is the first challenge I've posted without posting on the sandbox. I'll delete it if no one likes it.
Rules
Take in a sequence of digits in ternar... | stackexchange_codegolf |
In the board game Pandemic, an outbreak occurs when a city contains more than 3 disease cubes. When the outbreak occurs, any disease cubes in the city in excess of 3 are removed, and each city connected to it gains one disease cube. This means that chain reactions can, and will occur.
Important note: Each city may onl... | stackexchange_codegolf |
I am looking for a more efficient way of computing the following.
Let A and B be two vectors of non-negative integers of length a and b.
Let A0 and B0 be the padded versions of A and B, so that we pad the vectors by 0, until their lengths are a+b.
We now want to compute sort(A0 + pB0) where pB0 ranges over all distinct... | stackexchange_codegolf |
The idea of this challenge is simple: create a bot to play the card game Euchre.
For those of you who don't already know them, I've written out the rules to Euchre here as they pertain to this challenge.
I recommend using python or something similar, but the only real restriction is that it has to be compatible with th... | stackexchange_codegolf |
You are to write a program that, when given an integer between 1 and 5 (or 0 and 4 if you wish to use 0-indexing), outputs one of Code, Golf, and, Coding or Challenges. Each input can map to any of the five outputs. However, the mapping must be one to one (each input goes to a different output) and consistent when runn... | stackexchange_codegolf |
You are given 4 positive integers: volume of the first container (v1), volume of the second container (v2), volume of the liquid in the first container (l1), and volume of the liquid in the second container (l2). Your task is to move some of the liquid from container 1 to container 2, making the amount of empty space i... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.