instruction stringlengths 34 53.1k |
|---|
emanresu A posted a challenge to reconstruct an ordered list of integers from its unordered set of unordered prefixes. Many users (beginning with xnor's answer) noticed that summing each unordered prefix led to a very short solution. Well, let's cruelly take that possibility away by using data that isn't integers!
A fe... |
You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient.
So you can add pasta, oil, salt then pesto, but not pasta, pesto, salt and oil since pesto already contains salt and oil. You only have one pot per dish, so you can't mix ingredients in on... |
Consider a finite, one-dimensional grid where each cell is marked with one of two symbols (I will use the symbols < and >, but you can use other symbols).
When a pinball is placed on one of the cells, it moves according to the following rules:
If the pinball is on a cell that is marked with <, the pinball moves one ce... |
Consider the problem of N queen on an (NxN) chessboard. Two queens are said to attack each other if they are on the same row, column,
or diagonal. Implements backtracking algorithm to solve the problem i.e. place N non-attacking queens on the board.
|
This will be a bit of a different challenge. Back in 2023, I developed a 2D esolang called Electra, and looking back at my hello world program, (which is 582 bytes by the way) I see a lot of room for golfing. There are some topics that aren't covered in the spec, e.g. in which order the currents are generated/interpret... |
I'm currently converting a Float32Array to an Int32Array for input to a real-time audio raw PCM to MP3 recording application.
new Int32Array([...new Float32Array(b)].map(f=>f<0?f*32768:f*32767)
The examples in the wild I've seen convert each float individually to avoid static, gaps, glitches when the audio recording i... |
Consider an \$(n+1) \times (n+1) \$ grid of points places at non-negative integer coordinates. Given two points in the grid at \$(a, b)\$ and \$(c, d)\$, we know that the distance of the first point to the origin at \$(0, 0)\$ is \$x = \sqrt{a^2 + b^2}\$ and the distance of the second point to the origin is \$y = \sqr... |
Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible number. If neither are a palindrome, \$m\$ is called a palintiple.
For example, \$1089 \cdot 9 = 9801\$, so \$9801\$ is a pa... |
Objective
Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once.
There is a taboo. Do not multiply zero to anything. Adding zero to anything is OK.
Examples
Truthy
List, Solution
[1,1], 1-1
[1,1,... |
Challenge
Create a program that outputs a square grid showing visible and non-visible points \$(x, y)\$ from the origin based on their greatest common divisor (GCD).
A point \$(x, y)\$ is considered visible from the origin \$(0, 0)\$ if the \$\gcd(x, y) = 1\$. Otherwise, it's non-visible.
Input
An integer \$n\$, repre... |
You are given an array A of length N and an array B of length N-1.
You need to output array where items alternates:
A[0], B[0], A[1], B[1], ..., B[N-2], A[N-1]
Restrictions:
N>0
Type of items is not specified, but code should work at least for unsigned integers.
Sample input:
A = [1,2,3,4]
B = [7,8,9]
Sample output:... |
Challenge
In this challenge, we will use a language that is very similar to Brainfuck but slightly different.
This variant of BF does not have any input and output commands; instead, it simply takes a tape as input and modifies it until it halts. The final state of the tape is considered the output of the program.
The... |
Background
The newest version of the C standard, C23, adds preprocessor macros like INT_WIDTH, ULONG_WIDTH, and SIZE_WIDTH that tell you the bit width of various integer types (here, int, unsigned long, and size_t, respectively). However, while the majority of us are stuck with pre-C23 compilers/standard libraries, it... |
Challenge
Given ASCII-encoded text input of any size, detect numbers between -1,000,000,000,000,000,000 and 1,000,000,000,000,000,000 exclusive and rewrite them with thousands separators. Use commas only and ignore leading zeroes. Leave the rest of the input unchanged.
Test cases
Input
Output
Description
123
123... |
If I want to type the string aaa, the least keystrokes I can type it in is 3: a a a. But if I want to type the string aaaaaa, I can do it in 5: a a a ctrl-c ctrl-v, where the ctrl-c refers to copying aaa and the ctrl-v refers to pasting it.
Specifically, starting with an empty "buffer" and an empty "clipboard":
The ke... |
In the poker game there are 1277 unique 'High Card' ranks. It's 1287 (13 over 5) if we include all straights.
The challenge is to write a function which returns an integer value corresponding to the rank of each 'High Card' poker combination including all straights. Possible cards are(in ascending order): '23456789TJQK... |
Objective
Given an expression involving ternary values, evaluate it into a ternary value.
Ternary Values
The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L... |
Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful.
One case per answer.
|
This is the cop's thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer.
Task: Write the shortest safe program that given two inputs \$x,y\$, outputs \$\arg(x+iy)\$, where \$\arg(z)\$ is defined as the angle between the po... |
V1.1: Added criterion to help with tiebreakers, a bit overkill but still.
Task: Crack the scrambled code for calculating the argument of a complex number \$z=x+iy\$ given two inputs.
You must post a comment in the cops’ thread with a link to your working source, mentioning clearly that you have cracked it. In your ans... |
Given a collection of coloured laces, what would be the probability, \$P\$, that Alice won't create any loops if, until impossible, they tie two uniformly chosen, free lace ends of differing colours together?
For the avoidance of doubt:
Each lace will be of only one colour and will have precisely two ends.
Alice does ... |
Introduction:
A typical cartoonish cactus usually looks like this:
One big stem in the middle, with some L-shaped branches sticking out.
We'll use this general shape for this challenge.
Challenge:
Given a pair of words, create an ASCII-art cactus with two upside down alphabets as stem. The first word is the left branc... |
"nimi ale lon toki pona" is a song by YouTuber jan Misali which lists 137 common words in the constructed language Toki Pona. This challenge is not a duplicate of "How high can you count?" or "Alphabet printing challenge" because instead of numbers or single characters, it outputs random (to many programming languages)... |
We will say a string \$x\$ is cyclic maximal if there is no way to cycle its elements to get a lexicographically larger string. In other words there is no \$a\$ and \$b\$ such that \$a \oplus b = x\$ and \$b \oplus a > x\$, where \$\oplus\$ is concatenation.
For example [3,2,3,3] is not cyclic maximal because you can c... |
I recently found this game and have been enjoying it. Basically, there is a grid of colored tiles and you act by clicking on empty spaces. When you click an empty space, the first tile (if any) in each of the four axis-aligned directions is selected. If any color appears more than once, all tiles of that color are dest... |
Objective
Given an integer \$n\$ interpreted as two's complement binary, output two integers, namely the integer consisting of \$n\$'s bits at places of \$2^0, 2^2, 2^4, \cdots\$, and the integer consisting of \$n\$'s bits at places of \$2^1, 2^3, 2^5, \cdots\$.
Note that the input may be negative. Since \$n\$ is inter... |
The game is played on a 1x8 board with the following setup:
KNR..rnk
White's pieces are on the left, while black's pieces are on the right.
The king (K) can move 1 space in any direction.
The knight (N) can jump 2 spaces in any direction, regardless of bordering pieces.
The rook (R) can move any number of spaces in an... |
For the purpose of this challenge, arguments are things you pass to a function at the call site, while parameters are what the function uses in its implementation. Or, more succinctly: arguments = external, parameters = internal.
While there are several modern languages that have support for argument labels for func... |
Given a non-empty string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that map the key to its value. Inside the string the key will always have a value and vice-versa.
How the key is made:
Start with an opening parenthesis (
Contains letters and/or numbers [a-zA-Z0-... |
The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without typing a single digit: just type words with length equal to each digit, modulo 10. For example,
This is a challenge
sets the vari... |
Problem:
Your goal is to add two input numbers without using any of the following math operators: +,-,*,/.
Additionally, you can't use any built-in functions that are designed to replace those math operators.
Scoring:
Smallest code (in number of bytes) wins.
Update
Most of the programs i've seen either concatenate two... |
Being a big fan of the Rubik's cube and of cool art, I've been working on combining the two together to do some really cool stuff. Basically solving miniature Rubik's cubes to form rudimentary pixels in the formation of Rubik's cube art. Examples of such art can be seen via this link: http://google.com/search?q=rubik%2... |
The challenge
Make a JavaScript program that can use a HTML table as a canvas, having each cell a pixel.
You can either input the position and color values in a form or by using the console.
Score calculation
+10 points for not using JQuery
+15 points for the cells scaling equally to keep the same table aspect ratio w... |
Task
Create a program that calculates the factorial of a number using no built-in factorial functions. Easy? The catch is that you must write your entire program (including testing it) in haiku form.
You can use as many haikus as you need, but when pronounced, they must follow the 5-7-5 syllable format.
Scoring
This i... |
As a programmer you certainly know the error of a stack overflow due to an obvious recursion.
But there are certainly many weird and unusual ways to get your favourite language to spit that error out.
Objectives:
Must cause a stack overflow which is clearly visible on the error output.
Not allowed to use an obvious ... |
Your job is to draw a Bézier curve given it's control points. The only criteria is that you actually have to show how to draw the curve from the initial control point to the last one.
Criterias
The result has to be animated, e.g. it has to show the drawing process somehow. The way you do the animation is irrelevant, i... |
There’s already been a question about simulating the Monty Hall Problem. This one is different. The user will play the Monty Hall Problem. Your program will play the role of the host. Montybot, if you like.
Here are the steps:
Pick (randomly) which of the three doors hides the prize.
Output a visual display of three... |
Introduction
There are lots of utilities out there capable of creating a high CPU load to stress-test your processor(s). On Microsoft Windows, you can even use the on-board calculator.exe, enter a large number like 999999999, and press n! several times to make your CPU(s) work overtime.
But what’s in a solution if you ... |
Your program has to print out a number of spaces, followed by a dot and a newline.
The number of spaces is the x position of your dot defined with 0 < x < 30
Every new line is a turn. Your program runs for 30 turns. Your program starts with a random x position and every turn shifts this position randomly by 1 to the le... |
You have to write a program, implementing a function digitsum(int i). The program has to modify its own code (for languages, where this is not possible with f.e. reflection, please be creative) to get itself to solve the goal.
You start with
function digitsum(int i){
return i;
}
and implement an evolutionary algo... |
Happy birthday to Me!
Write a program that prints Happy birthday to me! on its birthday.
The program's birthday is the creation, last modification or compilation time of the program (you choose), and must not be hard-coded.
The date you use as the birthday must not be affected by the program's invocation or execution ... |
This is a very crude text encoding algorithm I came up with the other day. It won't work if the text has more than 256 different characters in it – but it does support Unicode, at least in my Python implementation.
The algorithm:
Find all the unique characters in the text. Let's call this list, unique-chars.
Break the... |
Your challenge is to take some source code as input, and output which programming language it is written in.
For example, you could have the input
class A{public static void main(String[]a){System.out.println("Hello, World!");}}
And output
Java
Your two main goals are diversity (how many programming languages you can... |
Goal
Write a function or program sort an array of integers in descending order by the number of 1's present in their binary representation. No secondary sort condition is necessary.
Example sorted list
(using 16-bit integers)
Dec Bin 1's
16375 0011111111110111 13
15342 00111011111011... |
Problem:
You are making a new phone where people can type in specialized phone numbers, for example, 1-800-program, and they would be converted automatically to a usable phone number, like 1-800-7764726 (for the previous example).
Your program will recieve a string if any length with numbers, letters and dashes, and c... |
Your task – if you choose to accept it – is to have your program print, literally, either one of the following:
E=mc² (if your language supports Unicode (so no HTML trickery, for instance))
E=mc^2 (if your language doesn't support Unicode)
Here are the conditions:
Your program must consist of exactly two expressions... |
Write the shortest program to solve a quartic equation.
A quartic equation is a polynomial equation of the form:
\$ax^4 + bx^3 + cx^2 + dx + e=0\$
A solution for \$x\$ is a number such that the above evaluates to 0.
Rules
The program must take in the 5 floating point coefficients of the equation \$ax^4+bx^3+cx^2+dx+e... |
Inspired by http://xkcd.com/1331/
In this xkcd comic, there are several gifs that all blink with different frequency. I want to know what the period would be if was all a single GIF. Given a list of numbers representing the individual frequencies, output the period of the overall GIF.
Formal Definition
Input:
N
f1
f2
.... |
You are to post an answer you posted that exploited a loophole in the challengers question. Bonus points if it caused them to rewrite the question.
For example, one challenge was to write a program that such that if a random character is removed, it still works, and your score is how many characters it fails on. Some o... |
Problem:
You must make a program that does the following:
takes a large string of lowercase text, and counts all the occurrences of each letter.
then you put the letters in order from greatest to least occurences.
then you take that list and turns it into an encoder/decoder for the text.
then encodes the text with tha... |
The Oscars are coming up soon and we all know who's going to win Best Actor in a Leading Role this year right? The great Leonardo DiCaprio of course! Despite his superb performances in all of his films during his career, he has yet to win an Academy Award. So as tribute and as a way to wish him luck during the Awards C... |
This is an "arrow maze":
v <
> v
> ^
> v
^ < *
The * marks the spot where you will finish. Your goal is to find where the maze starts (hence, reverse maze). In this case, it's the first > on the second line.
v------<
S-+---v |
| >--^
>-+-------v
^ < *
Note that al... |
Your task – should you choose to accept it – is to build a program that parses and evaluates a string (from left to right and of arbitrary length) of tokens that give directions – either left or right. Here are the four possible tokens and their meanings:
> go right one single step
< go left one single step
-> go rig... |
The contest is to make a program or function that takes an arbitrary string
resembling source code and checks to see if the "braces" follow the basic rules for
brace matching. That is, the number of left braces and right braces have to match, and you
can't have a right brace without a corresponding prior left brace.
Yo... |
Write a program that takes a sorted integer array, shuffles all the elements in such a way that for every i there must exist a j such that, one of the following is satisfied:
a[i] < a[j] < a[i+1]
a[i] > a[j] > a[i+1]
i and j are within the bounds of array.
If there are not many distinct elements, you must show an err... |
Problem:
Generate a sentence that can be read and understood. It must contain a subject, verb, and object, and tenses and plurals must match. The program must also be able to generate several different sentences to qualify.
Rules:
Hard-coding the sentences is not permitted, and nor is reading them directly from a file... |
Your challenge here is to draw a trololologram.
You can choose any language.
The answer with more upvotes and the one that exploits more holes wins.
Rules for valid answers:
You can't use any network resource or external file (except the source-code)
You can't post someone else's answer
You can't have it stored in any... |
Your task is to take an input string of ascii characters and output the string as a series of vertical words separated by spaces. An example is shown below:
Given the string:
Hello, World! My name is Foo.
the output should be:
H W M n i F
e o y a s o
l r m o
l l e .
o d
, !
10 bonus points will be awarded if ... |
Write a program that starts itself again when finishes.
There should be no more than one instance of the program running at same time. Not even for a slightest moment of time.
You can ignore any instance that is manually started by user during your cycle. But your code should not do it in your restart cycle.
Progra... |
Here's a fun idea:
Write a simple game (tic-tac-toe, guess the number, etc) that has an easter egg in it, that can be triggered by a specific, special input from the user and does something cool, but the code for the game does not appear to contain any easter eggs (or any obviously obfuscated code) at first glance.
Thi... |
Your task - if you accept it - is to write a program which helps understanding my proposal on meta by calculating the winner of a code-golf-reversed competition. Of course, answers to this question will be treated as proposed, so your program (if correct) can calculate whether your answer will become the accepted answe... |
Your program will receive an ascii shape consisting of only underscores _, pipes |, spaces and newlines \n, which, together, represent a horizontally-aligned, right-angled shape. Together with this shape, on a new line, you will also receive either a positive or a negative integer, whose absolute value will be either ... |
There are some ways which cause an endless high CPU usage such as catching recursion exception. e.g. the following script in Python causes that problem:
def main():
try:
main()
except:
main()
main()
This is an obvious and simple example, but there might be some strange ways to arise such probl... |
In bash, this code posts String to post to http://www.example.com/target:
curl -d "String to post" "http://www.example.com/target"
NOTE: You should use http://www.example.com/target as the URL to POST to, without any change.
I think all other languages that I have knowledge in need a lot more code than this. I'm not b... |
The goal of this code golf is to create a program or function that calculates and outputs the cube root of a number that's given as input.
The rules:
No external resources
No use of built-in cube root functions.
No use of methods/operators that can raise a number to a power (that includes square root, 4th root, etc.).... |
Write a code to display "I Love You".
Without using any built-in tools or functions like echo, System.out.println, printf, ...
You are not allowed to directly call any function throughout the program execution, but the system environment or the compiler-generated code might do. This way, you can put your code in a mai... |
A weird number is a number that the sum of proper divisors is greater than the number itself and no subset of proper divisors sum to that number.
Examples:
70 is a weird number because its proper divisors (1, 2, 5, 7, 10, 14, and 35) sum to 74, which is greater than 70, and no combination of these numbers sum to 70.
1... |
Create a piece of code and a genuinely-looking test for it. However, the test must be flaky: when run multiple times, it must sometimes fail, sometimes succeed.
Be creative and try to hide the flakiness as much as possible. The most popular answer in (at least) 10 days wins.
|
The goal is to calculate all the squares up to x with addition and subtraction.
Rules:
The code must be a function which takes the total number of squares to generate, and returns an array containing all those squares.
You can not use strings, structures, multiplication, division, or built-in functions for calculating... |
You are to write a program that will output source code that is
Larger than the original program (character wise)
Will print another program larger than itself when run (i.e. the new program is also a valid answer to this challenge) indefinitely
This is code-golf, so shortest answer wins.
|
Douglas Adams was born on March 11, 1952, and died when he was just 49. In honor of this wonderful writer, I challenge you to display 42 in the most creative way possible.
You could print it in the log, via some convoluted method, or display it as ASCII art, or anything! Just come up with a creative method of displayin... |
EDIT: If you're using Lisp, I have given some guidelines at the bottom in counting bytes.
Objective: Make the shortest function that splits a string at non-digits and returns an array consisting of only digits in each string, without the use of any regular expressions. Leading zeroes are to be included in each string.
... |
The idea here is to write a little segment that will spit out regular expression patterns when given a string that matches them.
As you might have guessed, this will be a popularity contest, and I'll accept whichever answer has the most upvotes by March 7th
pseudocode Example:
print(reverseRegex('dog'));
//prints /[a-... |
Chris, a cryptic crosswords addict, has a set algorithm for the order in which he solves them.
We will use the above image as a guide.
Chris always starts off with the first across clue, in this case 1 Across. Chris is a capable crossword enthusiast, so it is assumed that he will always know the answer to the clue he... |
The 32-point compass is... interesting, to say the least.
By Denelson83 (Own work) [GFDL or CC-BY-SA-3.0], via Wikimedia Commons
Your challenge is to take a degree measure, and convert it into a direction on the 32-point compass.
Each direction is 11.25 (360 / 32) degrees farther than the previous. For example, N (nor... |
Write a polyglot (code that works in two or more languages) that has a "mid-section" that can be modified to do any computational task. This question is similar to https://stackoverflow.com/questions/1053931/code-golf-shortest-turing-complete-interpreter.
Rules:
The program must be able to preform a computation and pri... |
Task:
Make a random number generator. The catch is that you can't use any built-in randomness functions. Your random numbers must be anything between 0 and 100, though they do not have to be floating point.
Rules:
It must produce a pseudorandom number.
Randomness defined: If you run it x times, then x times again, the... |
The Challenge
You must calculate pi in the shortest length you can. Any language is welcome to join and you can use any formula to calculate pi. It must be able to calculate pi to at least 5 decimal places. Shortest, would be measured in characters. Competition lasts for 48 hours. Begin.
Note: This similar question st... |
In this challenge, you get to create a language. Although you have to provide code in other languages, you will only be rated based on the language. Here are the requirements.
You must invent a programming language that is Turing complete.
You will choose a real (as in existed before this question did) language. It mu... |
The goal is to write a program (anything except explicit brainfuck) which prints Barney Stinson's best rule:
New is always better.
when interpreted normally, but
Legen... wait for it... dary!
When processed with a Brainfuck interpreter.
May the most popular bro win. You have 72 hours to be legendary.
|
It's geeky to see a Boolean Matrix animation, but a live one would be better. Echoing only 1s and 0s create a program that creates an infinite loop of integer matrix.
1s and 0s are randomly echoed like an error.
|
Similar to the images on allrgb.com, make images where each pixel is a unique color (no color is used twice and no color is missing).
Give a program that generates such an image, along with a screenshot or file of the output (upload as PNG).
Create the image purely algorithmically.
Image must be 256×128 (or grid that ... |
Implement a function divide(int a, int b, int c) that prints the base 10 value of a/b. without using any floating point math nor BigInteger/BigDecimal or equivalent libraries whatsoever. At least c accurate characters within the set of 0123456789. must be printed, except for the (possible) exception in point 4 below.
... |
Create the shortest program to check who has won in an nd tic tac toe game.
Your program should work when n (width) and d (dimension number) are in these ranges:
n∈[3,6]∩ℕ ie a number from this list: 3,4,5,6
d∈[2,5]∩ℕ ie a number from this list: 2,3,4,5
n = 3; d = 2 (32 ie 3 by 3):
[][][]
[][][]
[][][]
n = 3; d = 3... |
I am looking for either suggestions or examples of more famous sayings written in code! If you have a website or database of them, please link that below your favorite one!
Examples:
while(!(succeed = try()))
if(lifegivesyou == lemons) {makelemonade();)
|
With the big crash of the universal economy also the demand for custom made planets plunged. The Magratheans had to look after more steady revenues also from a broader class of customers. Therefore, they invented the have-your-own chain of mountain (or short havoc-o-mountains) for people with smaller budget who could n... |
It's the ending of another well played chess game. You're the white player, and you still have a rook and your king. Your opponent only has his king left.
Since you're white, it's your turn. Create a program to play this chess match. Its output can be a sequence of moves, a gif animation, ASCII art or whatever you like... |
Write a function or program that takes in a list and produces a list of the local extremes.
In a list [x_0, x_1, x_2...] a local extreme is an x_i such that x_(i-1) < x_i and x_(i+1) < x_i or x_(i-1) > x_i and x_(i+1) > x_i. Notice that the first and last elements of the list can never be local extremes.
So for some ex... |
Your mission is to write a program that accepts a date in the formats 2014-02-27 (calendar date) and 2014-W09-4 (week date) from standard input and outputs the date in the format it wasn't entered in (to standard output with a trailing newline). The dates must conform to the standard ISO 8601, i.e. with weeks that star... |
A Kaprekar number is an n-digit number k that, when the first n or n-1 digits of k^2 are added to the second n the digits of N^2, the result is N.
Examples:
9^2 = 81. 8+1 = 9.
45^2 = 2025. 20+25 = 45.
297^2 = 88,209. 88+209 = 297
The Kaprekar sequence begins at 1.
Write a program that calculates and outputs the firs... |
Ruby comes with a built-in REPL, which is quite handy.
Your challenge is to crash it in the least amount of code!
The definition of "crash" is "make it exit in an unintended way." This means exit, quit, abort, irb_exit, irb_quit, et. al. are not valid answers.
Furthermore, you may not cause any side-effect to any othe... |
Given an integer array, write a program that determines if it is sorted in ascending order.
Remember that this is a code trolling question.
I am looking for most interesting ways that people come up with.
The answer with most upvotes wins.
This question is inspired by a 'creative' solution that a candidate gave me in a... |
I would like to see who can make Python have a fatal crash with the most creative code. This means that when the program runs, Windows for example, will take over and pop up with something like “IDLE has stopped working”, or Linux will do whatever Linux does when a program crashes.
Rules:
This must be made in Python 2... |
Write a program to output the part of speech of any word inputted to it. I doubt that anyone could get a perfect algorithm, so I will give the code a batch of words in order to ascertain what algorithm is the best.
Weighted Scoring:
+10pts for each word identified correctly: http://www.englishclub.com/grammar/parts-of... |
The challenge is to find the shortest implementation of the game of life in 3D (example). These are the rules:
Cells (in this case, cubes) with only 1 or less neighbours die, as if by lonliness.
If exactly 5 cells surround an empty cell, they breed and fill it.
If a cell has 8 or more neighbours, it dies from overcrowd... |
Your job is to generate a heightmap and show it as a parallel projected, voxel landscape. The rules are the following:
The (heightmap of the) landscape has to be randomly generated
You also have to describe how the algorithm you are using works, so everyone can learn something new here
You have to also either generate... |
Create a Sudoku solution CHECKER
There are oodles of Sudoku SOLVERS here, but I want you to create a solution CHECKER as small as humanly possible (code-golf).
A valid entry will be able to either take a 9x9 array as an argument (passed by reference, serialized on the command line, or however you want to take it) or... |
Your job is to write a program to find the closest number to PI.
Let me clarify.
You will first choose a number type. Let us say you choose Integer (in an actual answer, you cannot). Your program would then have to generate an integer that is closed to PI. For Integers, this would be 3. Not 4; 3.
For every allowed numb... |
Write a program that reads from stdin two integers, each newline terminated, hereafter called "number" and "radix", and:
Prints any fixed message you want if the number is a palindrome in that radix (e.g. true, t, 1)
Prints any different fixed message you want if the number is not a palindrome in that radix (e.g. fals... |
Task:
You must create an interpreter that can parse snippets of a programming language. The language does not need to be complex, but it must include the following syntactical elements:
Ability to assign and read variables (could be as simple as a-z being premade variables)
If statements (elseif and else are not requi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.