instruction stringlengths 34 53.1k |
|---|
In this challenge fake marquee text is text that is shown part by part, in a scrolling-like fashion.
Some examples:
testing 4
t
te
tes
test
esti
stin
ting
ing
ng
g
hello 2
h
he
el
ll
lo
o
foobarz 3
f
fo
foo
oob
oba
bar
arz
rz
z
Something a bit longer 10
S
So
Som
Some
... |
Introduction
In this challenge, you are given a directed graph with self-loops, and your task is to convert it to an undirected graph without self-loops.
Input
Your input is a directed graph with vertex set {0, 1, ..., n-1} for some natural number n ≥ 0 (or {1, 2, ..., n} if you use 1-based indexing).
The graph is give... |
You should write a program or function which given a list of tetris blocks as input outputs or returns the biggest gap between two points in the same height level which the pieces can connect.
The 7 types of tetris pieces are the following:
We will refer to these pieces by the letters I, J, L, O, S, T and Z respective... |
A binary string is a string which contains only characters drawn from 01. A balanced binary string is a binary string which contains exactly as many 0s as 1s.
You are given a positive integer n and an arbitrary number of masks, each of which is 2n characters long, and contains only characters drawn from 012. A binary... |
A magic sequence is a sequence of non-negative integers x[0..n-1] such that there are exactly x[i] instances of i
For instance, 6,2,1,0,0,0,1,0,0,0 is a magic sequence since there are 6 0's, 2 1’s, and so on.
Write a function which when given n, outputs all magic sequences of length n
The program that can produce the ... |
Overview
This is a bot battle to see who can survive the longest. These bots increase their power by being attacked, though, so you need to think carefully before you shoot.
Each turn, you can choose a bot to attack, or defend. Attacking will lower its life and increase its power. Last bot standing wins.
Bots
Each bot ... |
The goal of this challenge is to receive an input and output that input but with sentence order reversed.
Example Input:
Hello friend. What are you doing? I bet it is something I want to do too!
Example Output:
I bet it is something I want to do too! What are you doing? Hello friend.
As you can tell from the examples... |
Scralphabet
A normal bag of Scrabble tiles contains the following letters (? is a blank tile, which can stand for any other letter):
AAAAAAAAABBCCDDDDEEEEEEEEEEEEFFGGGHHIIIIIIIIIJKLLLLMMNNNNNNOOOOOOOOPPQRRRRRRSSSSTTTTTTUUUUVVWWXYYZ??
The letters have the following value:
{"A": 1,"B": 3,"C": 3,"D": 2,"E": 1,"F": 4,"G":... |
You should write a program or function which receives a string describing the floor as input and outputs or returns the area of the simplest meta-tiling which could create the given pattern of the floor.
The floor is a part of a square grid. Every square tile is colored either azure or black (represented by a and b in ... |
Order and Chaos is a variant of Tic-Tac-Toe played on a 6x6 board. What makes the game unique, however, is that both players can place either an X or an O! Each turn (starting with Order), a player places an X or O in any unoccupied square.
Winning is simple. Order wins if there are 5 Xs or Os (vertically, horizontally... |
You goal is to implement the operation of XOR (carryless) multiplication, defined below, in as few bytes as possible.
If we think of bitwise XOR (^) as binary addition without carrying
101 5
^ 1001 9
----
1100 12
5^9=12
we can perform XOR multiplication @ by doing binary long-multiplication but doin... |
Given two strings, a parent string and a query string respectively, your task is to determine how many times the query string, or an anagram of the query string; appears in the parent string, in a case-sensitive search.
Examples of Behaviour
Input 1
AdnBndAndBdaBn
dAn
Output 1
4
Explanation
The substrings are highlig... |
The Doctor, in trying to escape from the Dalek forces has decided to send them in a spin by traveling in various pockets of space in a spiral motion.
Depending on the nature of the available space-time, The Doctor needs to enter into the TARDIS controls the height and width of the section of space and his entry point w... |
Instructions
Given an unknown input string i with a value of either heads or tails, return 1 for heads or -1 for tails with the shortest code.
Sample not golfed code (55b):
if(i == "heads"){
print(1);
}else{
print(-1);
}
Sample golfed code (16b):
print("t">i||-1)
Javascript was used for the example but it's ... |
Once upon a time long long ago... when there was no money or stocks yet, people were trading sheep. Even before (but close to) the invention of abacus, the great-grandfather of Warren Buffet decided it was hard to keep track of sheep. He wanted to collect all his belongings and clear all his debt, so that he could inve... |
Write a function or program that processes a block of text and returns the new text. Smallest valid program wins.
Each line in the block of text will have the following format:
12:34,56
The first number is the line ID, the other two comma separated numbers are references to other lines.
In the input text the numbers c... |
You have to write a function/program that takes input via the stdin/command-line arguments/function arguments, mixes up characters in a string, and then output the final string via the stdout.
Input will first contain a string (not empty or null), a space, and then an even number of non-negative numbers all separated b... |
In this challenge you will take two inputs
One input will be a string of numbers of any length which you will put into an array/table/whatever you call it in your language
Ex:
10 10 145 20 53 102 20
Would become
arraynameofyourchoice = {10, 10, 145, 20, 53, 102, 20}
You can assume the input will have spaces in betwee... |
Credits to Calvin's Hobbies for nudging my challenge idea in the right direction.
Consider a set of points in the plane, which we will call sites, and associate a colour with each site. Now you can paint the entire plane by colouring each point with the colour of the closest site. This is called a Voronoi map (or Voron... |
The Sierpinski triangle is a set of points on the plane which is constructed by starting with a single triangle and repeatedly splitting all triangles into four congruent triangles and removing the centre triangle. The right Sierpinski triangle has corners at (0,0), (0,1) and (1,0), and looks like this:
Some equivale... |
The Specs
Your program must read the image from one file and write the results to another file, the name of at least the first of which should be taken from the input
You may accept and return any image format or formats, as long as you specify in your answers which ones you are using
An exception should be thrown if ... |
Write the shortest program that prints this ASCII art section of a hexagonal tiling or honeycomb:
__
__/ \__
__/ \__/ \__
/ \__/ \__/ \
\__/ \__/ \__/
/ \__/ \__/ \
\__/ \__/ \__/
/ \__/ \__/ \
\__/ \__/ \__/
\__/ \__/
\__/
No input should be taken.
Output to stdout or your lan... |
To each of these nine confusingly similar words, assign a number 1-9 in any way you like:
though
through
thorough
Thoreau
throw
threw
trough
tough
troll
Write a program that takes in a string. If the input is one of these nine words, output the number you assigned to it. If the input is not one of the words above, the... |
The Challenge:
Given any input that can be typed on a keyboard, move the text along by N chars.
Here is the QWERTY keyboard to be used. You can ignore the modifier keys (Shift, Caps, Enter, Delete and Tab). Once you reach one side (for example |) loop back round, so | goes to Q if N = 1.
Spaces do not have to be moved... |
Write the smallest program you can to create affine fractals. You may use any method you feel like that generates the same results as the rules below. You don't have to use any ideas from the suggested methods!
Your program will take two inputs, the first to define the pattern in the format 074 made of three digits fro... |
A simple golf to start the week! You're given three arrays: the base array B, the value array V and the index array I. You should produce another array where the values from V are inserted into B at the indices specified by I. Here is an example:
Base: [5, 1, 4, 1, 3]
Values: [0, 0, 7]
Indices: [5, 0, 3]
The indic... |
You are given a string and two characters. You have to print the string between these characters from the string.
Input
Input will first contain a string (not empty or null). In the next line, there will be two characters separated by a space.
Challenge
Return the string between the two characters
Example
Hello! What's... |
Instructions
Barry is a not so good backend developer in charge of a small API that should give you information about purchases made in a client's shop. However, he hasn't done a great job and your boss tells you to fix it client-side instead. Ideally you should receive comma-separated values such as 927,2,45,90 which ... |
Recently at Puzzling.SE, there was a problem that I wrote about determining which two bottles out of a larger number are poisoned when the poison only activates if both components are drunk. It ended up being quite the ordeal, with most people managing to get it down to 18 or 19 prisoners using completely different alg... |
Oh no! Nemo, our small clown fish is lost in this ASCII ocean and his dad Marlin is trying to find him.
Your task is to get Marlin to Nemo safely. But beware, we have a feeding frenzy Bruce on the loose, so better avoid him at all costs!
Details
You are given a rectangular ASCII ocean grid containing only lowercase alp... |
This is a successor to my previous Code Golf challenge, which may be found here.
This time, you are trying to determine what the contents of colors.txt should be.
Your task is to take from the input the path to an image and a number of colours, and write to colors.txt a list of that many colors chosen for that image.
R... |
Background (F#)
Let there be trees:
type Tree<'T> = Node of 'T * Tree<'T> list
Now lets fold them nicely with a function called...
foldTree f:('a -> 'b -> 'c) -> g:('c -> 'b -> 'b) -> a:'b -> t:Tree<'a> -> 'c
...taking two functions f and g, an initial state a and of course a tree structure t. Similar to the well kno... |
A musical string is any string that can be played on a piano keyboard.
For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like.
So the string feed a dead cabbage is a musical string because every single letter corresponds to one of these nots.
Your challenge is to write a pr... |
A bunch of cars are lined up at a 4-way stop sign waiting to proceed. Everyone is confused about who gets to go next, who is going which way, etc. Clearly suboptimal.
Your job is to schedule the traffic at the stop sign in an optimal fashion.
You receive as input 4 strings of turn requests, one for each of the four c... |
Introduction
Arithmetic Gaol is a special facility that incarcerates positive integers. However, recently, the positive integers have been trying to escape. Therefore the wardens have decided to, um, eliminate some of the positive integers to send a message to the other integers. They have hired a software engineer to ... |
This is a follow-up of
CodeGolf - Ignore the noise #1
the only problem being that Barry has made things even worse for us. Lets see what happened
Update
I've added code to create random input and expected output because I'm not that good at explaining what I want, and I guess that sometimes words are more mislead... |
Challenge
You will be given a table as input, drawn with ASCII | and _. Your task is to set the chairs around it.
Example
Input:
____
| |
| |
| |
| |
|____|
Output:
_^_^_
< >
| |
< >
| |
<_ _ _>
v v
Those chairs are made of <> and v^.
Another example:
The line must have as many chairs ... |
The seam carving algorithm, or a more complex version of it, is used for content-aware image resizing in various graphics programs and libraries. Let's golf it!
Your input will be a rectangular two dimensional array of integers.
Your output will be the same array, one column narrower, with one entry removed from each r... |
This challenge is inspired by a puzzle I played, consisting of foam pieces like these:
which have to be assembled into 3D cubes, like these:
The puzzle pieces can be viewed as grids of 5 * 5 squares, whose middle 3 * 3 squares are always solid, while the 16 squares on the edges can be solid or empty.
A piece will be ... |
Two words are isomorphs if they have the same pattern of letter repetitions. For example, both ESTATE and DUELED have pattern abcdca
ESTATE
DUELED
abcdca
because letters 1 and 6 are the same, letters 3 and 5 are the same, and nothing further. This also means the words are related by a substitution cipher, here with t... |
Write a full program or a function that takes a positive integer N as input via STDIN/command line/ARGV or function arguments and prints an ASCII double knot corresponding to the N to STDOUT.
The ASCII double knot looks like this:
__ __ __ __ __ __
/ \/ \/ \/ \/ \/ \
| /\/ /\/ /\/ /\/ /\/ /\ |
| \/ /\/ /\... |
You are given a string. Output the string with one space per words.
Challenge
Input will be a string (not null or empty), surrounded with quotes(") sent via the stdin. Remove leading and trailing spaces from it. Also, if there are more than one space between two words (or symbols or whatever), trim it to just one space... |
A Flow Snake, also known as a Gosper curve, is a fractal curve, growing exponentially in size with each order/iteration of a simple process. Below are the details about the construction and a few examples for various orders:
Order 1 Flow Snake:
____
\__ \
__/
Order 2 Flow Snake:
____
____ \__ \
\__ \__/ / __
... |
Edit: Allowed to reuse whitespaces.
Your task is to write n programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The kth program should output the (cardinal) number k in standard English in lowercase (with an optional trailing newline). So the first progr... |
Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example:
"Abc" and "Cde" are equivalent because
distance from a-c == 2
distance from b-d == 2
distance from c-e == 2
The capitalization doesn't make any difference.
"... |
This is a rather easy challenge.
Challenge
Input will contain a string (not null or empty) of maximum length 100. Output the number of vowels in each word of the string, separated by spaces.
Rules
The string will not be more than 100 characters in length.
The string will only contain alphabets A-Z , a-z and can also c... |
Any regular hexagon can be tiled with diamonds, for instance like so:
______
/_/_/\_\
/_/\_\/\_\
/\_\/_/\/_/\
\/_/\_\/_/\/
\_\/_/\_\/
\_\_\/_/
We'll consider the above a tiling of size 1 (since the diamonds' sides are made of one / or \ each). The same tiling of size 2 would look like:
____________
... |
Background
(Based on a true, heart-wrenching story)
In my time, I've played around with Lisp and similar languages often. I've written with them, ran them, interpreted them, designed them, and made machines write with them for me... And if there is one thing that bothers me, it's seeing Lisp that does not comply with m... |
Background
An atomic bomb has exploded near the fencepost factory!
Since fenceposts are essential for the survival of our civilization, we must rescue as many as possible.
We are sending radiation-resistant robots to search the area, and it is your task to program their artificial vision.
Input
Your input is a rectangu... |
Your goal is to write a program that, given a number N and a string as input, will return a string containing every Nth word of the original string, starting from the first word.
Sample inputs/outputs:
N = 2, str = "This is a sentence"
"This a"
--
N = 2, str = "The quick brown fox jumped over the lazy dog."
"The brow... |
You are given a multi-dimensional array of integers. Each dimension has a fixed size (so that it would be always rectangular if it is 2D). Your program should calculate the sums in each dimension and append the sums as the new last items in that dimension.
Assume the input and output arrays are A and B, and the size of... |
In today's episode of AAOD, we are going to construct a Chinese Shrine of varying heights.
Consider the following examples for height (N) 1 to 6
N = 1:
.
|
. ]#[ .
\_______/
. ]###[ .
\__]#.-.#[__/
|___| |___|
|___|_|___|
####/_\####
|___|
/_____\
N = 2:
.
... |
K is a programming language in the APL family designed by Arthur Whitney. While the official interpreter is closed-source and commercial, a trial version with a workspace limit of 32 bits of addressing space (which shouldn't pose problems for code golf) can be found at the Kx Systems website. This version bundled as pa... |
Here is another short string related code-golf. You must write a full program that reads a string (from STDIN or as command line arguments, as long as you specify which) and wips the flords around (flips the words around). A valid flord wip must
Flip all of the beginning consonants. (All of the leading consonants up t... |
Finding the Deadlock
When programming a multithreading application one must take good care to avoid deadlocking the various threads when accessing shared resources. A deadlock occurs when a thread attempts to access a resource that's locked in another thread at the same time that the other thread is trying to access a ... |
The contest is over!
Intro
This is an interactive king-of-the-hill contest where the controller is fully contained in a Stack Snippet at the bottom of the question. The controller automatically reads the answers and plays through games. Anyone can run it at any time right in their browser.
The mechanics of this contest... |
It's time... to count the votes!
Today there are local elections in my entire country. Here, the number of seats for each party is decided using the D'Hondt method. Your goal is to implement a program or function that will decide how many seats each party gets, in the shortest amount of bytes.
For this method there are... |
A polyglot is a program which can be run by several different language's interpreters/compilers without failing.
For example, the stackoverflow 404 page contains a polyglot which runs in Python, Perl, Ruby, C, brainfuck and befunge, each time printing 404 to stdout.
Now, my challenge is to create a polyglot which, whe... |
Shrink each word in a string of group of strings to single letters delineated by spaces or punctuation.
Example
I'm a little teapot, short and stout. Here is my handle, here is my spout. When I get all steamed up - hear me shout! Tip me over and pour me out.
becomes
I' a l t, s a s. H i m h, h i m s. W I g a s u -... |
Write a self replicating program, in the source code filename H.*, contianed in an empty folder then manually compile and run or just run the program if your chosen language is dynamic, and it should then just create a new source file, e.*, with the same exact source code, and automatically compile/run that new program... |
Introduction
Clarence is a data entry clerk who works at an internet service provider. His job is to manually enter the IP addresses of all of the ISP's customers into the database. He does this using a keypad which has the following layout:
123
456
789
.0
The distance between the centre of horizontally or vertically a... |
Given the size of the chess board and initial position of the knight, calculate the probability that after k moves the knight will be inside the chess board.
Note:
The knight makes its all 8 possible moves with equal probability.
Once the knight is outside the chess board it cannot come back inside.
Input
Inputs ar... |
Let \$n > 0\$. Let \$X = 1, 2,...,n\$ and \$Y = n+1, n+2, ..., 2n\$. Define \$a(n)\$ as the number of permutations \$p\$ of \$Y\$ such that every element of \$X + p(Y)\$ is prime. For example:
n = 2
X = [1,2]
Y = [3,4]
p_0(Y) = [3,4] => X + p0(Y) = [4,6] => No
p_1(Y) = [4,3] => X + p1(Y) = [5,5] => Yes
a(2) = 1
In as ... |
This is a byte sized challenge where you have to convert an input temperature in one of the three units (Celsius, Kelvin and Fahrenheit) to the other two.
Input
You would be provided with a temperature as a number followed by a unit (separated by space). The temperature can be an integer or a floating point number (23 ... |
...at least for some definition of "self-modification".
The Task
In this challenge, your task is to write three strings A, B and C that satisfy the following properties.
The string B has length at least 1.
For every n ≥ 0, the string ABnC is a valid program (meaning full runnable program or function definition) in you... |
Background:
Every war eventually comes to an end, but the end is never absolute. The Stone Maze Chess scenario takes place after a game of chess is finished. The enemy King is dead and the pieces is lost in vacuity almost out of faith, multiplying. The winning side has moved on except for the Hero who is left behind wi... |
Consider the process of:
Taking a non-negative integer N.
e.g. 27.
Spliting it into integers N - floor(N/2) and floor(N/2) (a 'bigger' and 'smaller' half) and writing them in that order.
e.g.27 becomes 14 13.
Removing the space to join the integers into a new, much larger integer.
e.g. 14 13 becomes 1413.
Repeating st... |
Resistors commonly have color coded bands that are used to identify their resistance in Ohms. In this challenge we'll only consider the normal 4-band, tan, axial-lead resistors. We'll express them as:
xyzt
Where x is the first band for the first significant figure, y is the second band for the second significant figur... |
What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is the shortest way to do this? For example, if 6x6 + 4x3-12 is entered (ignore parsing issues), what would be the shortest a... |
Introduction
My niece wants to make a race car track. She has wooden parts that fit together to form the track. Each part is square shaped and contains a different shape. I'll use the pipe drawing characters to illustrate:
│: the road that goes vertically
─: the road that goes horizontally
┌ ┐ └ ┘: the roads that turn... |
Objective:
A guru once said a perfect code selfie is best shot diagonally from upper left corner. A code selfie is almost like a Quine - but rotated 45 degree clockwise.
Your mission is to code a program that outputs a code selfie.
Rules:
You can use any programming language.
Your programs should not take any input fr... |
This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not.
Your input will have no newlines or trailing spaces:
1954
You will output in any way that you like that clearly tells the user if it is or isn't a leap year (I will accept y or n for y... |
Today's XKCD is a sports-tournament style bracket, where the contestants are well-known names, put into groups of possibly confusing names.
Give the probability that a given contestant will win the entire tournament, based on each contestant in a given round having an equal chance of winning that round.
Input
The name ... |
The Challenge
Consider the following diagram of the Fifteen Puzzle in its solved state:
_____________________
| | | | |
| 1 | 2 | 3 | 4 |
|____|____|____|____|
| | | | |
| 5 | 6 | 7 | 8 |
|____|____|____|____|
| | | | |
| 9 | 10 | 11 | 12 |
|____|____|____|____|
| | | ... |
There are two pieces of wood. Both consist of a straight body and some extra blocks below the body. An example piece with extra blocks at (0-indexed) positions 0,4,7,9,10:
XXXXXXXXXXX
X X X XX
The piece can be represented as a 01 binary sequence with the ith character showing if there is a block at the ith position... |
Background
I have a string in Python which I want to convert to an integer. Normally, I would just use int:
>>> int("123")
123
Unfortunately, this method is not very robust, as it only accepts strings that match -?[0-9]+ (after removing any leading or trailing whitespace). For example, it can't handle input with a dec... |
The species of geese known as Alex A are known for residing in triangular grids consisting of 64 cells:
(Picture taken from this unrelated Project Euler problem.)
We'll label each cell with the numbers 0 to 63 starting from the top row and then moving from left to right on each row below that. So the top cell is 0 and... |
I found this sequence while working on Evolution of OEIS, but never got around to posting it as an answer. After writing a reference implementation in Mathematica, I thought this is a fun exercise to do as a separate challenge though, so here we go.
Let's build a numeric fission reactor! Consider a positive integer N. ... |
This is not a challenge. I'm wondering if it's at all possible to get user input into two separate variables in python (2 or 3) with less than 19 bytes. These are all the shortest I can get:
a,b=input(),input()
a=input();b=input() (newline replaced with semicolon for readability)
i=input;a,b=i(),i()
Is there any short... |
There's the classic run length encoding and decoding.
input output
a3b2c5 aaabbccccc
And that's fairly straight forward and done before.
The challenge is to also account for a non-standard behavior when multiple characters precede the run length (a single digit from 0-9). Each character before the run length digit ... |
Your mission, should you choose to accept it, is to add the minimum number of parentheses, braces, and brackets to make a given string (containing only parentheses, braces, and brackets) have correct brace matching. Ties of symbols added must be broken by having the maximum distance between paired braces. You must retu... |
One of the most common voting systems for single-winner elections is the plurality voting method. Simply put, the candidate with the most votes wins. Plurality voting, however, is mathematically unsound and is liable to create situations in which voters are driven to vote for the "lesser of two evils" as opposed to t... |
This is an endgame board of Settlers of Catan:
Background:
The roads (the long stick pieces) and the settlements (and cities) are rendered by the little huts. We encode the placement of these pieces by using the following scheme: From the top, we have a row horizontal vertices and edges where a road can be placed. The... |
Your job is to take the prime factors of a number taken from input (omitting any exponents equal to 1) then take the prime factors of all of the exponents, and so on, until no composite numbers remain; and then output the result.
To make what I'm asking slightly clearer, here's a javascript program that does it, but, a... |
There are 95 printable ASCII characters:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
In the Consolas font (the Stack Exchange code block default), some of the characters have mirrors around a vertical axis of symmetry:
These pairs of characters are mirrors of each o... |
Define the function f(n) for a positive integer n as follows:
n / 2, if n is even
3 * n + 1, if n is odd
If you repeatedly apply this function to any n greater than 0, the result always seems to converge to 1 (though nobody's been able to prove that yet). This property is known as the Collatz Conjecture.
Define an in... |
Your task in this challenge is to analyize a given "Matchstick Equation" like this one...
... and to find out whether it can be turned into a valid equation by rearranging the matches. If so, you are to output the least number of moves to do so and the resulting equation.
Input
The input is a String that can be read f... |
You are the owner of a restaurant. You are opening in a new area in Cartesia where there is only one main road, known as the y-axis. You want to place your restaurant such that you minimize the total distance from your restaurant and each of the houses in that area.
Input:
The input will be
n, the number of houses
hous... |
This Stack Snippet draws an aliased white rectangle on a black background given parameters for its dimensions, position, angle, and the grid dimensions:
<style>html *{font-family:Consolas,monospace}input{width:24pt;text-align:right;padding:1px}canvas{border:1px solid gray}</style><p>grid w:<input id='gw' type='text' ... |
Write a program that outputs a list of the number of occurrences of each unique character in its source code.
For example, this hypothetical program {Source_Print_1}; should produce this output:
; 1
P 1
S 1
_ 2
c 1
e 1
i 1
n 1
o 1
p 1
r 2
t 1
u 1
{ 1
} 1
The formatting should match this example. No extraneous whitespa... |
Objective:
Code two programs where each of the programs outputs both source codes
interlaced per character like a zipper, a Double-slit Quine. The output from a Double-slit Quine
is starting with the first character from the source code of the first
program. If the source code of one of the programs is shorter i... |
Okay, I recently wrote a Javascript Rubik's Cube scrambler that outputs a 25-move scramble. It's 135 bytes. The Gist is here, but for reference, I have the formatted code:
function(){
for(a=s=y=r=[],m='RLUDFB',x=Math.random;++a<26;y=r,s.push(r+["'",2,''][0|x()*2]))
for(;r==y;r=m[0|x()*5]);
return s.join(' ')
}
A... |
The game of Chinese checkers is played on a board with spaces in the shape of a six-pointed star:
Image from Wikipedia
We can create an ASCII-art representation of this board, using . for empty spots and the letters GYORPB for the six colored starting locations:
G
G G
G G G
G ... |
Introduction
For many centuries, there has been a certain river that has never been mapped. The Guild of Cartographers want to produce a map of the river, however, they have never managed to succeed -- for some reason, all the cartographers they have sent to map the river have been eaten by wild animals in the area. A ... |
As part of his answer to Make an Error Quine!, @Falko proposed the following algorithm:
How to create your own solution in 2 minutes?
Open a new file in an IDE of your choice.
Bang your head onto the keyboard in front of you.
Compile.
Replace the code with the compiler error message.
Repeat steps 3 and 4 until the co... |
Write two programs such that when the bytes of their source code are XOR-d together it produces a third, valid program, all in the same language. The length of each of the three programs in bytes must be identical.
The first program should output A. The second program should output B. The third program should output C.... |
In this challenge, you are required to shift characters in an inputted string n number of times and output the shifted string
Input
Input will first contain a string. In the next line, an integer, which denotes n will be present.
Output
If n is positive, shift the characters in the string to the right n times.
If n is... |
UPDATE:
The gist-files are updated (including new submissions) as the Controller.java did not catch Exceptions (only errors). It does now catch errors and exceptions and also prints them.
This challenge consists of two threads, this is the cat thread, the catcher thread can be found here.
The controller can be download... |
UPDATE:
The gist-files are updated (including new submissions) as the Controller.java did not catch Exceptions (only errors). It does now catch errors and exceptions and also prints them.
This challenge consists of two threads, this is the catcher thread, the cat thread can be found here.
The controller can be download... |
Task
Write a program that reads three integers m, n either from STDIN or as command-line arguments, prints all possible tilings of a rectangle of dimensions m × n by 2 × 1 and 1 × 2 dominos and finally the number of valid tilings.
Dominos of an individual tiling have to be represented by two dashes (-) for 2 × 1 and tw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.