instruction
stringlengths
34
53.1k
Flow Free is an addictive android game where you have to connect pairs of elements together via non-overlapping snakes and fill the entire grid. For a description, see here: https://play.google.com/store/apps/details?id=com.bigduckgames.flow&hl=en I have an ASP (answer set programming) solution which is only a couple ...
Write a 3D version (the game logic being 3D, not the visual representation) of the popular Connect Four game ( http://en.wikipedia.org/wiki/Connect_Four ) where the user can play against the computer. The user may freely chose the dimensions of the game board (width, height, depth) up to a limit of 10 x 10 x 10. The co...
the contest is already finished, so I don't think it's cheating to ask: I am trying to optimize this small contest: pascal triangle I started with 4.72 and worked myself up to 7.48. The best made a 9.05 but in perl, python2 best score is 8.25. Unfortunately they don't let you look at what others did. My current solutio...
The type of regular expression is PCRE. Write a program that output a valid PCRE such that it matches all natural numbers between m and n and does not match anything else. No leading zeros are allowed. For example, let m and n be 123 and 4321, then the program might output 1(2[3-9]|[3-9]\d)|[2-9]\d\d|[123]\d\d\d|4([01...
Given a string of different characters, and a number n, generate all the ordered combinations with repetition, of length 1 to n, using those characters. Another way to define it is to see the given characters as "custom" digits in the base (radix) of the number of characters, then the program should generate all the "n...
Write the shortest function that takes a two-dimensional square array representing the scores of a chess round, and outputs an array of the Neustadtl scores of the players. The two-dimensional array is structured so that array[i][j] is the score earned by the player i against player j. The Neustadtl score is used to ti...
Write the shortest code that implements a: DFA NFA epsilon-NFA The program should accept as input: a string(that we want to see if is accepted or not) the delta function, represented in whichever way it's more convenient. the "set" of final states of the automaton And it should output Accepted! if the string is acc...
Given three sides of a triangle, print area of this triangle. Test cases: In: 2,3,4 Out: 2.90473750965556 In: 3,4,5 Out: 6 Given the sides \$a\$, \$b\$, and \$c\$, you can assume that \$a>0\$, \$b>0\$, \$c>0\$, \$a+b>c\$, \$b+c>a\$, and \$c+a>b\$. This is code-golf, shortest answer per language in bytes wins.
When you hammer a set of nails into a wooden board and wrap a rubber band around them, you get a Convex Hull. Your mission, should you decide to accept it, is to find the Convex Hull of a given set of 2D points. Some rules: Write it as a function, the point's list coordinates (in any format you want) is the argu...
I tried this contest: https://www.hackerrank.com/challenges/secret-language Well, the score in this contest said I made 30 out of 30 points. As the score is calculated with the formula 30*(1000-#chars)/1000 this is impossible. Here is my code: import sys,string as s b='anbycoduepfxgqhvirjzkslwmt' a=s.letters b+=b.upper...
192 is such a number, together with its double (384) and triple (576) they contain each 1-9 digit exactly once. Find all the numbers have this property. No input. Output: 192 384 576 219 438 657 273 546 819 327 654 981
Good Evening Golf Agents, Your mission is on behalf of notorious entertainment giant Eviltronic Arts. As part of their nefarious plan for world enslavement and entertainment, they must sell as many copies of SimStation V as possible. This means that the software must mysteriously stop working, after starting it a few ...
Your function takes a natural number and returns the smallest natural number that has exactly that amount of divisors, including itself. Examples: f(1) = 1 [1] f(2) = 2 [1, 2] f(3) = 4 [1, 2, 4] f(4) = 6 [1, 2, 3, 6] f(5) = 16 [1, 2, 4, 8, 16] f(6) = 12 [1, 2, 3, 4, 6, 12] ... The function doesn't have to return ...
Assuming 'lol' with a variavle number of 'o's. Print a the following phrase: What does 1st, 2nd, 3rd, 4th ... 'o' stand for? Examples: lol -> What does 1st 'o' stand for? loooool -> What does 1st, 2nd, 3rd, 4th, 5th 'o' stand for? So far I managed to write a 128 characters solution in Perl: $l=(<>=~tr/o//);print"...
Objective Requirements A main 'parent' file and a 'child' file. The parent file creates a new child file that contains code that must execute after creation. The child file that is created must delete the existing sibling file. It wants all the attention, afterall. No matter how many times the parent file is executed,...
You are given two functions \$g(x)\$ and \$h(x)\$, each of which takes an integer \$x\$ and returns the number \$ax + b\$ (where \$a\$ and \$b\$ are integers defined in the function). Your task is to write a function \$f(g, h)\$ that takes these two functions, and returns a function \$k(x) = g(h(x))\$, but where the pr...
Good Afternoon Golfgeneers. This is reasonably long and detailed question. Given what it was asking, it needed to be. If you have any questions, please ask them. If there is anything that isn't clear, please alert me to it so I can fix it. This is probably on the tougher side of codegolf. We are building a lightweight ...
Your function or program should take a year as input and return (or print) the date (in the Gregorian calendar) of that years Easter (not the Eastern Orthodox Easter). The date returned should be formatted according to ISO 8601, but with support for years greater than 9999 (such as 312013-04-05 or 20010130), and it onl...
Based on the very successful Twitter image encoding challenge at Stack Overflow. If an image is worth 1000 words, how much of an image can you fit in 114.97 bytes? I challenge you to come up with a general-purpose method to compress images into a standard Twitter comment that contains only printable ASCII text. Rules:...
Create a program with the lowest amount of characters to reverse each word in a string while keeping the order of the words, as well as punctuation and capital letters, in their initial place. By "Order of the words," I mean that each word is split by a empty space (" "), so contractions and such will be treated as one...
Just like jQuery's $.fn.text, write one or two functions that can get and set the text on an element. You can't use textContent or innerText, and even less innerHTML. Plain javascript. No DOM library. It has to work on major browsers. (No need to care about old IE.) Shortest code wins. Enjoy!
A palindrome is some string that is spelled the same way both backwards and forwards. For instance, 'Eva, can I stab bats in a cave?' is a palindrome (EVACANISTAB | BATSINACAVE) For this code golf, using the language of your choice, determine if a given string is a palindrome or not. Edge Cases: Punctuation is not co...
In the spirit of re-implementing classic video games, I would like to invite the community to create their best implementation of Tetris. For reference, a screenshot of the official NES version of Tetris. Required Features A reasonable scoring system must be in place, which rewards multi-line clears more than single-...
I have a script: $ cat ~/zebra.pl #!/bin/perl use Term::ANSIColor; $Term::ANSIColor::EACHLINE = "\n"; my $zebra = 1; # Are zebras black with white stripes, or white with black stripes?! my $black = color('white on_black'); my $blue = color('white on_blue'); while (<>){ chomp($_); $zebra = $zebra == 1 ? 0 :...
Implement the classic rock paper scissors. Conditions: user will input 'r', 'p' or 's' program will output 'r', 'p' or 's' and the result program choice ('r', 'p' or 's') has to be pseudo random (I'm looking at you Howard) result can be represented with any printable character, there should always be three possible re...
Given a set of space-delimited integers, you've gotta either return a function that can generate that sequence, or return "There isn't any such function". Sample input: "1 11 41 79" - x^3+x^2-1 "12 38 78" - 7x^2 + 5x The operations that the functions can contain are: +-/* and exponentiation. If anyone has any other...
Task Write a function to generate names of aliens and their worlds, so that the output is of the form: Greetings Earthfolk, I am ____ of the planet _____. "Rules" Best space-sounding-ness to code length wins. The more diversity the better. Dictionaries/look-up tables count towards code length. Random number generators...
The puzzle is as follows: Create the traditional 'Guess my Number' game in as little keystrokes as possible. The player should input a guess between and including 1 and 100, and the computer should reply with either + (meaning the player needs to guess higher), - (meaning the player needs to guess lower) or = (meaning ...
Simulate cowsay in the default mode. $ cowsay <<< Hello _______ < Hello > ------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || $ perl -e 'print "Long text "x20' | cowsay __________________________________________ / Long text Long text Lon...
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge Your challenge is to implement a program that will input a list of numbers and output a box plot of the data, in as many programming languages as possible. The box plot...
You've probably heard of the classic Eight Queens Puzzle. For those of you who haven't it goes something like this: Position 8 queens on an 8×8 chessboard so that no two queens threaten each other (no two queens appear on the same row, column or diagonal as each other). Here is one answer that is very close: X - ...
Write the shortest program that answers "Hello, World" to a network connection. Conditions: Program shall listen on port 12345 When a client connects, program shall write "Hello, World" to the newly opened socket connection and then close the connection Program shall accept connections in a loop, i.e. handle any numbe...
Taken from Google Code Jam 2013 Qualification Round Problem B: Alice and Bob have a lawn in front of their house, shaped like an N metre by M metre rectangle. Each year, they try to cut the lawn in some interesting pattern. They used to do their cutting with shears, which was very time-consuming; but now they have a n...
Write shortest code to print the following Multiplication Table: 1×1=1 1×2=2 2×2=4 1×3=3 2×3=6 3×3=9 1×4=4 2×4=8 3×4=12 4×4=16 1×5=5 2×5=10 3×5=15 4×5=20 5×5=25 1×6=6 2×6=12 3×6=18 4×6=24 5×6=30 6×6=36 1×7=7 2×7=14 3×7=21 4×7=28 5×7=35 6×7=42 7×7=49 1×8=8 2×8=16 3×8=24 4×8=32 5×8=40 6×8=48 7×8=56 8×8=64 1×9=9 ...
Alex is a Truck Driver who wants to find the quickest way to deliver goods to multiple cities. He knows the distances between his destinations, but you need to write a program to help him find the quickest way to deliver goods to them. Input The first line of input gives the number of cities Alex needs to deliver goods...
Your task is to write a program that will take input like this: a + b * c + a / 2 and will generate the source code for a program that takes user input and then evaluates the expression. The expression can contain the operators +,-,*,/; single-letter lowercase variables; and integers between 0 and 32000. Standard a...
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...
Good Evening Golfers, Your challenge, this evening, is logarithmic, and (as Abed would put it) "Meta" Your goal is to write a program that takes an input from stdin or the command line, and returns the logarithm of that number, in the base of the length of your program in bytes. So, if your program is 10 bytes, it mus...
Write a program that will generate a "true" output iff the input matches the source code of the program, and which generates a "false" output iff the input does not match the source code of the program. This problem can be described as being related to quines, as the program must be able to somehow compute its own sour...
At the end of your interview, the Evil Interviewer tells you, "We make all of our applicants take a short coding test, to see if they really know what they are talking about. Don't worry; it's easy. And if you create a working program, I'll offer you the job immediately." He gestures for you to sit down at a nearby ...
The goal is to display a bézier curve in any classical browser (except maybe old IE versions, because... are they really browsers?) client side. Rules: You must provide one or more files (or their content). These files must contain all the code. The code must work offline, no imports from a remote source. No installat...
Write a snippet, a function, a programm, ... that is obfuscated in a way that it looks clear at the first sight that it does something else. For example: write a bit of code that adds two number, but when you ask someone "what does it do?", he will tell you it prints "Hello, World!". Rules The code must be readable fo...
Output "Mozart - Alla Turca" to stdout (see the sample for "reference implementation") Try to find how to pack both synthesizer and the music into minimal size. Requirements: Format suitable for feeding into aplay -f cd (signed 16-bit little endian, 2 channels); Entire music should be played (no skipped notes or parts...
The goal is to write the smallest program in any language which displays any three dimensional output. It might be graphics, it might be ASCII art, but any reasonable person should immediately and unambiguously recognize it as "something 3d". Opening external files or other resources is not allowed. All output has to b...
I do realise that this is a bit math-y, but - here goes. In mathematics, the hyperoperation sequence is an infinite sequence of arithmetic operations (called hyperoperations) that starts with the unary operation of successor, then continues with the binary operations of addition, multiplication and exponentiation, af...
Problem: Take input text like this: (all input should be considered strings) Upi djpi;f ytu yu[omh pmr yp yjr ;rgy. And figure out if it was offset left or offset right (on a standard qwerty keyboard as pictured below). Also only keys that output something to the screen are considered valid, so these keys: caps, shi...
What general tips do you have for golfing in Tcl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Tcl (e.g. "remove comments" is not an answer). Please post one tip per answer.
Write a program to convert Polish prefix notation to infix notation, then change it to an RPN-to-infix converter in the shortest number of chars. Your score is 100 minus the number of characters changed, added and deleted. Don't write one PPN and one RPN function, then do something like: "I changed rpn(raw_input()) to...
Find the combination of N number of letters that make up the most words of length N. For example: n r u -> run, urn dstu -> dust, stud (these are just examples, not the best combination of 3,4 length sets of letters) The challenge in the case is to start with length N=3 and end at N=11. Which combination of letters ...
A shortest C program, that can crash the Operating system, either on a Windows or a Linux PC... Rules: The code is to be developed in C language, but it may use other api, specific to linux or windows systems. The Operating System is said to have been put out of commission, if either it has come to a state[Standstil...
Write a function to find the solution of e^x given x, and a precision in the form 0.000001. sample input and output: e(4,0.00001) will return 54.5981494762146, and the precision is +/- .00001. The output would be acceptable in the range 54.59814 <= output <= 54.59816, you are not required to truncate the answer to the ...
This anecdote contains the following intriguing exchange: "Fine, Fred," Avi interrupted. "Then how would you change this to avoid duplicate entries?" "Oh, just change that one there to a negative one." While this claim is not accurate in context, I do wonder if there's some plausible code for which that makes sens...
Consider an expression 2^2^...^2 with n operators ^. Operator ^ means exponentiation ("to the power of"). Assume that it has no default assosiativity, so the expression needs to be fully parenthesized to become unambiguous. The number of ways to parenthesize the expression are given by Catalan numbers C_n=(2n)!/(n+1)!/...
Given a list of strings s_0, s_1, ..., s_n find the shortest string S that contains each of s_0, s_1, ..., s_n as a substring. Examples: S('LOREM', 'DOLOR', 'SED', 'DO', 'MAGNA', 'AD', 'DOLORE')='SEDOLOREMAGNAD' S('ABCDE', 'BCD', 'C')='ABCDE' Write the shortest program (or function) that solves this problem. You can...
I figured an "arch" was the best way to describe this pattern of numbers: 1234567887654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1 Formally defined, each line consists of the numbers 1 through 9-n, (n-1)*2 spaces, and the numbers 9-n throug...
For a given natural number n, compute the number of ways how one can express n as a sum of positive natural numbers. For example, for n = 1 there is just one way. For n = 4 we have 5 possible ways: 1 + 1 + 1 + 1 1 + 1 + 2 1 + 3 2 + 2 4 The ordering of terms in a sum doesn't matter, so 1 + 3 and 3 + 1 are considered th...
The challenge is to write the string hello world to your processes standard output, using as few characters of code as possible. The following restrictions apply: The following words may not appear anywhere in the code in any casing (this includes as part of another word) Console Debug Write Print Line Put Your code...
The goal is to write a program that encodes an other program (input) with the fewest character possible. Scoring The score is equal to the different number of characters needed for the output. Lower score is better. Rules No target languages with a limited set of commands. (No Brainf**k, Whitespace etc) Edit: I mean...
Your mission, should you choose to accept it, is to input a series of point pairs that form a graph, like this: A,B C,A B,A A,D A,E F,G C,G You must then output an ASCII visualization of the graph. For example, A,B C,A C,D could be: A-----------------B \ \ C---------D Edit: As...
Write a self-contained program which when given a polynomial and a bound will find all real roots of that polynomial to an absolute error not exceeding the bound. Constraints I know that Mathematica and probably some other languages have a one-symbol solution, and that's boring, so you should stick to primitive operati...
I decided to learn J so that I could better take part in code golfing. Starting it off relatively simple, I tried writing a solution to this problem: Find the sum of all the multiples of 3 or 5 below 1000. After a bit of tinkering, I came up with the following J code that solves it: x=:i.1000 +/x#(0=3|x)+.0=5|x Basi...
Your mission, even if you don't accept it, is to input three numbers from STDIN or file: 5 0.5 6 What you must do is evaluate this: (5a + 0.5b)^6 This basically means that the first two numbers are the coefficients of a and b and the third is the exponent in a binomial expansion. Rules: The first two numbers are e...
Pascal's Pyramid is an extension of Pascal's Triangle to the third dimension. Starting with a 1 as the apex, the elements of each successive layer can be determined by summing the three numbers that are above it. The nth layer contains the coefficients of (a + b + c)^(n-1). You are to create a program that, given an in...
The primorial of a number is the product of all the primes until that number, itself included. Take a number from STDIN as the input and evaluate its primorial, also known as the prime factorial. Don't use libraries. Shortest code wins. Test cases: 1 1 2 2 3 6 4 6 5 30 6 30 7 210 8 210 9 210 10 210 11 2310 12 2310 13 3...
The Factorial Number System, also called factoradic, is a mixed radix numeral system. The factorials determine the place value of a number. In this system, the right most digit can be either 0 or 1, the second rightmost digit can be 0, 1 or 2, and so on. This means that an n digit factoradic number can have a maximum v...
The Problem: Count the number of holes in a connected polygon. Connectivity of the polygon is guaranteed by the condition that every triangle in the input triangulation shares at least 1 side with another triangle and that there is only one such connected set of triangles. Input is a list L of n points in the plane and...
Write a program in your chosen language which plays a perfect game of tic-tac-toe on a 3 * 3 board against a human player. However, every move has to be a different program, generated from the previous iteration. How and in what form you evaluate human input, is up to you, but it has to be read from the standard input....
Circles and squares have a single, definite center point. However, the notion of the center of a triangle has long been discussed. Four different centers were known to the Ancient Greeks: Incenter: The intersection of the angle bisectors of the triangle Centroid: The intersection of the lines from each vertex of the t...
Congratulations, you're now a network administrator! As your first task you will need to configure a firewall to stop any traffic to some blacklisted addresses. Unfortunately, the only firewall at your disposal only takes in rules in this format: x.y.z.t/m ALLOW There's no DENY keyword. If you want to exclude a specifi...
You know that some decimal numbers can't be expressed as IEEE 754 floating points. You also know that arithmetic with floating points can give results that seem to be wrong: System.out.print(4.0-3.1); (source) 0.2 + 0.04 = 0.24000000000000002 (source) While one wrong number with an error that is this small might not ...
In Canada, the penny is no longer circulated. Cash payments are rounded to the nearest 5 cents. Money can be saved by splitting purchases. For example, two $1.02 items cost $2.04 which rounds up to $2.05, but when buying the items in separate purchases, each price rounds to $1.00 for a total of $2.00. However, when ...
If you use OS X then you might be familiar with the infamous hidden ".DS_Store" files that are produced as a result of using Finder. The challenge is to write code that will go through the entire file system and delete any file named ".DS_Store". Classic code golf - shortest code wins. Clarifications: The code does ...
Your task is simple: given a number as an input, you have to print the English name of the chemical element with that atomic number, up to and including ununoctium. For example, for an input of 77, your program has to print Iridium, and nothing else. You can use any language, but no library (or other, in-built feature)...
Welcome to the piNapple bar, Melbourne. All of the finest code golfers are here, with their laptops, sampling cocktails and programming increasingly badly. I feel a special need to reemphasise the last point. Increasingly badly. Alcohol can do funny things to programming logic. So - a few of the Golfers were attempting...
I heva this wierd text where vewols seem to be ratetod : I'm a badly written text. Some lunatic guy played with the order of vowels. Please fix me ! So I'd need a pragrom which can rateto the vewols (and the 'y' letter as it seems) back so that the text is raadeble agian. Ouy can choeso the lungaega of ouyr chieco pr...
Take a following character table: ------------------------------------------------------- | |1233456 | abc | xyz | | | |-------|--------|--------|--------|--------|---------| | |abcdefgh| 1234567| | 12345 | | | abc |xyzabcqw| | | | | | ...
The Routh-Hurwitz is a criteria which serves to prove or disprove the stability of an electric control system. Idea Given a system which has an equation of the form P(s)/Q(s) where P(s) and Q(s) are polynomials of any degree, it is said to be stable if all the roots of the polynomial Q(s) are in the left half of the co...
Background Manufactoria has been marketed as a game, but we code-golfers can see it for what it really is: a two-dimensional programming language. The Manufactoria programming language is based around a single queue, which contains a series of colorful markers. The instruction pointer moves around the game board usin...
This puzzle is the next in my series of Manufactoria challenges. Background Manufactoria is a game / two-dimensional programming language. The player must create programs that will manipulate a queue to arrive at the desired output. It is easy to learn but hard to master, so it lends itself to creating a wide variety...
Skolem sequences A Skolem sequence is a sequence of 2n numbers where every number i between 1 and n occurs exactly twice, and the distance between the two occurrences of i is exactly i steps. Here are some examples of Skolem sequences: 1 1 1 1 4 2 3 2 4 3 16 13 15 12 14 4 7 3 11 4 3 9 10 7 13 12 16 15 14 11 9 8 10 2 6 ...
This, but via template metaprogramming: template <int n> struct insanity { int[][n] permutations; } Generate all numbers with n digits (0-9) such that each digit is either: Zero The first digit Already present Greater than the maximum digit to the left Don't worry about leading zeros either way. Valid examples: 0123...
The challenge is simple: generate a word. Specifications: Word must be pronounceable. This is defined as "alternating between a consonant and a vowel." A consonant is one of the following letters: bcdfghjklmnpqrstvwxz A vowel is one of the following letters: aeiouy Word must be randomly generated. Words must be abl...
Here is a theoretical question - one that doesn't afford an easy answer in any case, not even the trivial one. In Conway's Game of Life, there exist constructs such as the metapixel which allow the Game of Life to simulate any other Game-of-Life rule system as well. In addition, it is known that the Game of Life is Tur...
If a game can result in a win, worth one point; a draw, worth half a point; or a loss, worth no points; how many ways are there of scoring k points in n games? Applicable scenarios include NFL and chess. Input is via stdin, and consists of n and k on separate lines. n will be a non-negative integer. (n ≤ 16) k will be...
Context Chess960 (or Fischer Random Chess) is a variant of chess invented and advocated by former World Chess Champion Bobby Fischer, publicly announced on June 19, 1996 in Buenos Aires, Argentina. It employs the same board and pieces as standard chess; however, the starting position of the pieces on the players' home...
Consider the alphabet A ="()[]{}<>". Think of the characters in the alphabet as opening and closing brackets of 4 different types. Let's say that a string over the alphabet A is balanced if it is empty -or- it is not empty -and- the number of opening and closing brackets of each type match -and- each opening bracket h...
For this code golf, you will receive an input of a fibonacci sequence, that is, a normal Fibonacci sequence but with one number incorrect. See, the sequence is fibbing! Get it? :D Your job is to find out which number is incorrect, and print the index (0-based) of that number. For example: Input : 1 1 2 9 5 8 13 Output:...
The challenge is to display and scroll a sine waveform in the least number of characters. Restrictions: Total height of wave must be at least seven units (characters, pixels, etc). The generated wave must scroll in-place. Additional Rules/Information: The sine wave must be distinguishable from triangle and square ...
Given the integers N and M, can you print all numbers from N to M comma-seperated? The hitch is to use one single expression. The output for N=23 and M=42 should look like this: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 I'll start with Ruby: puts (23..42).to_a.join(', ')
This challenge was inspired by a programming blog I frequent. Please see the original post here: A Programming Puzzle Challenge Define a function \$f:\mathbb{Q}\to\mathbb{Q}\$ such that \$f(f(n)) = -n\$ for all non-zero integers \$n\$, and where \$\mathbb{Q}\$ is the set of rational numbers. Details In whatever lang...
xxd is a utility, bundled with vim, that has been used to encode answers to code golf problems on this site. It converts a binary file into a hex dump and back again. Implement the xxd and xxd -r commands in the programming language(s) of your choice. Scoring is based on the character/byte lengths of a) your program(s)...
Create a program which takes one command-line argument, n, which will be an integer less than 2147483648 (2^31), and then reads a file input.txt and prints the lines of input.txt which contain any substring which is a positive (non-zero) multiple of n. You may choose to ignore multiples greater than 2147483647. Test ca...
Challenge: You Are The Teacher Everyone knows that simple task of receiving a grade, and telling if the student: is approved, will attend the summer school, or failed. In this challenge, you must write a program that does that, but using the maximum of one if statement (also ternary operators count as if). The grad...
Forward: Depending on what language you use and what user you are logged in as this challenge could be dangerous so proceed with Caution! You could delete something, fork bomb yourself, or worse... Challange: Write a program of n bytes which creates n copies of itself on disk, modifies the first byte of the first copy...
You are given an array of strings , you have to construct a single array containing all of them so that the same array of strings can be reconstructed from the large array. The strings may contain any ASCII character. How to determine length of the single large array? Example= let a = ["asd";"dfg";"rew"]. Problem is to...
In pancake sorting the only allowed operation is to reverse the elements of some prefix of the sequence. Or, think of a stack of pancakes: We insert a spatula somewhere in the stack and flip all the pancakes above the spatula. For example, the sequence 6 5 4 1 2 3 can be sorted by first flipping the first 6 elements (...
So I think we've all probably seen this xkcd comic: : This might either be too general or too difficult, I'm not sure. But the challenge is to create a program in any language that creates a window that has at least 2 colors and displays in English words what percentage of the screen is each color. ex. The simplest sol...
Write a Manufactoria program that will accept the empty input tape. But don't do it quickly! I mean, write the program quickly, but don't let it run quickly. The slower the program, the better, as long as it terminates eventually. The example program below takes 3:51 (the "total time" reported by the simulator). h...
Everyone likes a good puzzle. After all, that's the basis for Code Golf and Code Challenge! What better puzzle exists than the famous Rubik's Cube? Well what else but her slightly larger sister, the Rubik's Revenge! Rubik's Revenge Background Released in 1982 following the success of the classic Rubik's Cube invent...
The Four fours puzzle is a popular recreational mathematical puzzle that involves using exactly four 4s (and no other number) and a defined set of operations to reach every number from 0 to a given maximum. In this version, the only following operators are allowed: Any grouping symbols may be used Addition (+), Subtra...