instruction
stringlengths
34
53.1k
You and a friend are playing a game - who can overflow the most containers? There are n containers numbered 1 to n. Each container has a certain maximum capacity of water, in litres. You take turns with your friend to pour discrete amounts of water into the containers. On your turn, you may pour 2 litres of water into ...
There's classic combinatorial result that the number of ways to tile a 2*n strip by 1*2 dominoes is the nth Fibonacci number. You goal is to print all the tilings for a given n, drawn with dashes and vertical lines like these 8 tilings for n=5: |———— |———— ——|—— ——|—— |||—— |||—— ————| ————| ||——| ||——| |——|| |——|...
Countdown Your goal for this code-golf challenge is to count down and meanwhile recycle numbers. Let me explain. First your application reads a number, either as program argument or using stdin. Next you'll simply need to count down like this: 10 9 8 7 6 (in descending order) But wait, there is more! Recycling There ar...
Consider how a word could be arranged on an arbitrarily large Boggle grid if the rule about not using the same letter cube more than once is ignored. Also assume that you have an unlimited number of letter cubes (with all letters present), and Qu is just Q. The word MISSISSIPPI could be arranged using only 6 cubes. Her...
Background Most people on here should be familiar with several base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, the number 1234516 would represent 1*16^4 + 2*16^3 + 3*16^2 + 4*16^1 + 5*16^0 Note that we're usually not expecting the base (here, 16) to change from digit to digit. A gene...
Your job is to encrypt a string using a number key. Your program will receive 2 strings: one containing a sequence of characters to encrypt, and another one containing an even amount of digits (1-9, never 0). The encrypting will work like this: take the string to be encrypt and decode it to binary (ISO-8859-1) for eve...
You are working as a programmer for a bank. Your task is to write a program that handles the transactions from one bank account to another. The program should do the following: Run in an infinite loop waiting for input. The input consists of 3 numbers: Accountnumber1, Accountnumber2 and x the amount of money. e.g. 99...
Inspired by Fibonacci domino tiling, this problem is about generating ASCII art representing another famous combinatorial sequence. A n-step mountain diagram is a drawing of a mountain range, using exactly n '/' and n '\' characters, such that characters sketch a continuous curve which never dips below its initial "alt...
Write a program, that takes 5 numbers as input and outputs the next number in the pattern. Heres a text file with 1835 test patterns, containing 6 numbers separated by commas each line. Using the first 5 numbers calculate the 6th number and then check if it matches. You must get all the test cases correct. There are 3 ...
Given a rectangular text as a word search puzzle and a search string, determine if the text contains the search string. The search string may appear: horizontally, vertically or diagonally forwards or backwards You may write a function or a program and take two strings as input via function argument, ARGV or STDIN. T...
Is there a way in Golfscript to bring all of the diagonals of an array into a single array? For example, for the array [[1 2 3][4 5 6][7 8 9]] return [[7][4 8][1 5 9][2 6][3]] (not necessarily in that order) and for ["ABCD""EFGH""IJKL"] return ["I""EJ""AFK""BGL""CH""D"] (not necessarily in that order). Assume the l...
When you search for something on Google, it conveniently gives a message near the top of the page saying something like About 53,000,000 results (0.22 seconds). (The numbers change depending on what was searched of course.) In this challenge you will write a program that draws a logarithmic ASCII graph of the number of...
Write the shortest parser for the grammar: M -> M + n | n Output must be some representation of a structured value representing the concrete syntax tree produced by the input n+n+n. The code to produce the textual output from the structured value is not necessary. The code to read/validate input is not necessary. Sol...
The Game Most of us know about Frogger, the 80's era arcade game where the objective is to hop a frog safely across a busy highway and a hazard-filled pond to arrive safely at home. A challenge was issued some months ago to develop a Frogger clone. But why clone Frogger when you can play Frogger? :) Consider the follow...
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge We've done run-length encoding before but only considered runs of a single character. Of course, we can sometimes make even greater savings if we consider runs of multip...
The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. The challenge is to write code to output all strings with edit distance exactly k from a fixed string of length 10, where k is a variabl...
Introduction You are the computer science teacher in a large high school and have been tasked to create a system to generate the student timetables. You must, given a JSON dictionary of student names and the subjects they are taking, you must generate a timetable for each of the students. Specifications Each student ta...
Info The numbers 1 to 9 each represent a cell in the Moore's Neighbourhood, with 5 being the central cell. So: 123 456 789 1={-1,-1} 2={-1, 0} 3={-1, 1} 4={ 0,-1} 5={ 0, 0} 6={ 0, 1} 7={ 1,-1} 8={ 1, 0} 9={ 1, 1} The Challenge You may take input via STDIN, ARGV or function argument and either return the result or pr...
This is an extension of Fibonacci Domino Tiling. Your goal is to print all 281 ways to tile a 4x6 rectangle with 1x2 and 2x1 dominoes. Fewest bytes wins. Use the vertical bar | to indicate a space covered by the vertical domino, and an em-dash — (count it as if it were ASCII) or hyphen - for horizontal ones. Example ou...
This is my first contest, so please tell me what I can do to improve. The object of this contest is to write program lines in your language of choice that are both valid code and self-descriptive in English, such as this Golfscript program: This program outputs 4 twice. You may use any language features, libraries, #d...
Let's try this again. The object of this contest is to make two pieces of code that are anagrams of each other (the two must contain the same bytes in a different order), and they will do the following tasks: One must test if an inputted number is happy or prime, and output if the number is either (for example, 7 must...
In the color spelling game, you are shown a list of color names, but rather than reading the words that are written, you have to say the name of the color of the letters. The game is over as soon as you say the wrong color, and the player who spelled the most words correctly wins. To make the game more challeging, each...
In the future, the world will change, there's no doubt about it. For that reason, you have to produce a realistic map of the world n years in the future. The number n should be the number of years in the future and can be input via STDIN or argv. It can be one of four types of maps: satellite (real colours), geographic...
Introduction This is one of my favorite math puzzles. Given a digit (say 3) and the number of times to use that digit (say 5), generate 10 expressions which result to 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 using just +, −, ×, ÷, ^ and √ (root) (brackets are allowed to group operations). For example: (3^3 + 3)/(3 + 3) = (33 -...
Given a string containing decimal numbers: teststring134this 123test string54 100 increment every number in this string by one to give the new string teststring135this 124test string55 101. The string can be provided as: a command line argument STDIN a hard-coded variable or function argument Cover all possible posit...
Output all numbers in certain range containing certain digits Task Take an input of digits through console, prompt, or a file (in the decimal number system). These digits should be separated by spaces. Take an input of the "maximum" through console, prompt, or a file If you use a file, the program must output "[Data t...
Your task is to improvise a hardware random-number generator with whatever hardware you have lieing around. Challenge Write a program with the following properties: It prints either 0 or 1 (and nothing else). The output depends on a physical process and not just the internal state of the computer. There is no relation...
Statement of problem Given a set of unique, consecutive primes (not necessarily including 2), generate the products of all combinations of first powers of these primes — e.g., no repeats — and also 1. For example, given the set { 2, 3, 5, 7 }, you produce { 1, 2, 3, 5, 6, 7, 10, 14, 15, 21, 30, 35, 42, 70, 105, 210 } b...
Your job is to take this number as input (although it should work with any other number too): 1834957034571097518349570345710975183495703457109751834957034571097518349570345710976183495703457109751834957034571097518349570345710975183495703457109751834957034571097618349570345710975183495703457109751834957034571097518349...
Warning: This challenge contains some mild spoilers for The Secret of Monkey Island. Towards the end of the game, you're being led through the catacombs by a magically preserved head of a navigator: You need its eyeball necklace, but the Head is reluctant to give it to you. One way to get it is just to keep begging: ...
Pi times e (or Pie if you like ambiguous notation) to 100 decimal places is: 8.5397342226735670654635508695465744950348885357651149618796011301792286111573308075725638697104739439... (OIES A019609) (argument for possible irrationality) Your task is to write a program that takes in a positive integer N, and outputs Pi*...
I was annoyed the other day when I got a point off in math class because I didn't distribute the factors of my function. That is, I put (x+2)(x-3) when I should have put x^2 - x - 6. Your job is to write a program that takes a string with the expression and convert it to the expanded form so I don't miss future points...
Little Chandler is sad. Draw him a cloud to cheer him up. Note: Drawing a cloud won't actually cheer him up. A circle can be defined as a 3-tuple (x,y,r) where x is the x position of the circle on a Cartesian plane, y is the y position of the circle on a Cartesian plane, and r is the radius of the circle. x and y may b...
When you convert a fraction to a decimal number and you want to store that number, you often have to round it, because you only want to use a certain amount of memory. Let's say you can only store 5 decimal digits, then 5/3 becomes 1.6667. If you can store only 2 decimal digits it will be 1.7 (now assuming that it is ...
Pi is an irrational number, which means that its decimal representation never terminates or repeats itself. Pi truncated to 41 decimal digits (40 places) is 3.1415926535897932384626433832795028841971. If we ignore the decimal point and list the digits as a sequence of positive integers, avoiding duplicates, we get 3 1 ...
The new weather predicting supercomputer has arrived, and it doesn't work. In the meantime your boss wants you to buy the technicians some time by faking the daily wind maps. Your task is to draw a grid of arrows representing wind direction. The grid is: made up of 15px square tiles 8 tiles by 8 tiles 120px square tot...
EDIT : Recently, my question has been proposed as a duplicate of 2048 Bot Challenge. I would like to stress that this question is different from that question, and will require answers to be thought of differently than that question. 2048 Bot Challenge asked the user to create a bot, and it would be run for an hour, w...
Hash Un-hashing The basic goal of this challenge is to exploit the high probability of collision in the Java Hash function to create a list of plausible inputs that created an outputted hash. The program that can print the most results in one hour wins. For example, hashing golf produces the number 3178594. Other 'word...
Create a function or program that makes a grid as close to an square as possible You will be given an integer N as input, whole numbers (1,2,3,25, etc) The output must be a perfect rectangular grid of N letters as close to a square as possible The (wannabe)square must consist of one of the the letters O or X as specif...
The Chaos Game is a simple method to generate fractals. Given a starting point, a length ratio r and a set of 2D points, repeatedly do the following: From your set of points, pick one at random (uniformly). Average that point and the last drawn point (or the starting point) using r and 1 - r as the weights (i.e. r = 0...
Rules Write a program in a language of your choice. That program is designed to rotate a block of text. Example: BOB 90 deg DCB CAT --> OAO DOG CW GTB You may assume the blocks of text are loaded into a variable block. You may assume a square block, but of any size. You may assume the line-endings are...
Suppose your alarm wakes you up one morning, but you hit snooze so you can sleep for 8 more minutes. When it rings again you grudgingly get up and take a shower, which you estimate takes 15 to 17 minutes. You then brush your teeth for exactly 2 minutes, and get dressed, which takes about 3 to 5 minutes. Finally, you ea...
You have a stack of pancakes on a plate with a glob of syrup on top so thick it can't run down the sides. You won't be happy to eat until both faces of each pancake have at least touched the syrup, but right now only one face of the top pancake has. You know that the syrup will never soak through even one pancake, but ...
A flowchart algorithm is a type of pseudocode designed for human readability and makes it easy to see the program flow. For this program, you need to output your own program as a flowchart. You may not read your own source code and the output must be a PNG of any size. The flowchat must be a step by step representation...
For those of you who have seen the popular daytime TV show Countdown, you will know that the contestants are given 9 randomly selected letters and must then find the longest word they can in 30 seconds. Your challenge is, given a string of 9 letters, to find the longest word that is an anagram of the largest subset of ...
If someone facing north at point A in this grid wanted directions to follow the green path (as they can only follow gridlines) to point B you might tell them: Go North, North, West, East, East, South, East, East. or equivalently Go Forward, Forward, Left, Back, Forward, Right, Left, Forward. (Where a command of Right...
I was trying to find the shortest code possible that given a number n, returns the next prime palindrome number (limited to below 100000). If the number itself is a prime palindrome, the code should return the next one. Write the shortest program/function that, when given an input n (less than 100000), returns the next...
Polyglots are programs that are valid in multiple programming languages simultaneously. Most such polyglots are written in such a way that certain constructs of one language are interpreted as comments of another language (e.g. #define in C being interpreted as a comment in several scripting languages). I am curious to...
Consider the digits of any integral base above one, listed in order. Subdivide them exactly in half repeatedly until every chunk of digits has odd length: Base Digits Subdivided Digit Chunks 2 01 0 1 3 012 012 4 0123 0 1 2 3 5 01234...
Write a program that defines a function that can check if a string variable called "anything you want or inputted by the user" is or not a piem. (piem = a story or poem in which the word lengths represent the digits of π (from Wikipedia)) Some examples: myfunction("I am clearly wrong") # False myfunction("How I want a...
Introduction When a room has bare, parallel walls, it can create unpleasant repeating acoustic reflections (echoes). A diffuser is a device mounted on a wall which creates a blocky surface of many different heights. This has the effect of breaking up the reflected sound into many smaller reflections (each with a diff...
I've created a new language called "EasyFlow." Your task is to simplify writing BrainFlow programs by compiling EasyFlow to BrainFlow. That is, you take an EasyFlow program and output a BrainFlow program which does the same thing. EasyFlow is defined as follows: The program starts out with a list of variables. A varia...
Your job is to solve this chess-related game. The setup of the game is a 7x7 tile grid, you start on a random tile and you have to hop on each tile, until you hopped on all 49 tiles. Top left corner is (0,0) Rules: you can hop on each tile once. the only move allowed in the game is to hop two tiles horizontally and on...
Consider these 15 ASCII playing card patterns (ace through Joker, and the back side), where X is a placeholder for the suit symbol: (they look better with less line spacing) ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- ------------- -...
Let's plot a function f(x) = sin(πx) + 0.5 sin(3πx) over the domain [-3,3]. We can interpret this as a loose string lying on a board. Now let's drive n nails into the board at positions (x1, y1) to (xn, yn), where the xi ∈ (-3,3) and yi ∈ [-1,1]. Imagine that there are two eyelets at the end of the string, that is at p...
Your task is to implement a program similar to the nl command-line tool from the GNU core utilities. Standard loopholes are banned. You may not use any built-in or external function, program or utility for numbering the lines of a file or string, such as nl itself or the = command in GNU sed. Specification Input The pr...
This is intended to be an easy, bite-size code-golf. The mex (minimal excluded number) of a finite collection of numbers is the smallest non-negative integer 0, 1, 2, 3, 4, ... that does not appear in the collection. In other words, it's the minimum of the complement. The mex operation is central to the analysis of imp...
Thank you guys so much for your help with calculus. Now I need some help with my upcoming trigonometry test. On the test, I'll need to simplify expressions. I’ll be given input like 4sin(x)/(2cos(x)) and will have to produce a simpler, but equivalent expression (such as 2tan(x)). All angles are in degrees, and we'll pr...
Output is a shape that encloses 1009 pixels. The shape must take the form of a single, closed, non-intersecting loop. Input is a positive non-zero integer. Each input must yield output that is unique — that is, each output must be unique from those generated using a lower input. Victory is decided by the largest in...
Background The Fibonacci tiling is a tiling of the (1D) line using two segments: a short one, S, and a long one, L (their length ratio is the golden ratio, but that's not relevant to this challenge). For a tiling using these two prototiles to actually be a Fibonacci tiling, the following conditions have to be fulfilled...
This challenge is based off of Flow Free. An online version can be found here: http://www.moh97.us/ You will be given a puzzle, and you must return 1 if the puzzle is solvable, or 0 if it is not. To solve a puzzle, the player must create a path to connect each pair of numbers using every empty square exactly once. You...
This javascript code: for(x=1;x<6;x++)for(y=1;y<6;y++)console.log((y==1?'\n':'')+x+'*'+y+'='+x*y); prints the following: 1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 2*1=2 2*2=4 2*3=6 2*4=8 2*5=10 3*1=3 3*2=6 3*3=9 3*4=12 3*5=15 4*1=4 4*2=8 4*3=12 4*4=16 4*5=20 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 2 questions: Is there a smaller ...
Draw something that looks like this: In more precise terms, draw a circle of radius r, with n evenly-spaces tangent lines of length l. Connect the ends of these lines to form a new n-sided regular polygon. Rules r = circle radius n = number of tangent lines - must be evenly spaced around circle (n>=3) l = side length ...
What your function must do: be as short (in bytes) as possible take 3 inputs that are strings: number , fromdigits, todigits assume no digit is repeated in fromdigits or todigits assume fromdigit and todigit contain only alphanumeric characters assume number is a natural number output (a string): number converted to fr...
Inspiration This question is inspired by the cards Throne Room and King's Court from the popular deck-building card game Dominion. As part of one's turn, one plays a sequence of actions. These two particular actions cause the next-played action to repeat two or three times*. Other "generic" actions cause specific ga...
The input is an array of (at least 3, maximum 20) different integers. Each integer is greater than -1000 and smaller than 1000. Your task is to shrink the numbers by "linearly mapping" them from 0.0 to 1.0. This means the smallest number in the array will be mapped to 0.0, the largest to 1.0. You get the array as a par...
EDIT: I posted this question searching for a beautiful, original solution to this problem. Therefore, I accepted a user's edited category "popularity-contest". Making this a search for optimal solutions (i.e. runtime, code size etc.) is not my intention. Copy-paste master John wants to write this phrase multiple times ...
Winner CJam, 74 bytes by Optimizer Task Take an input of an integer n through the console or a file. Find the sum of the nth prime, square, triangular number, and cube. Add to that the factorial of the first decimal place of the square root of n and the xth Fibonacci number, where x is the first digit of the square of...
Goal Your goal is to find the simplest value in an open interval. In other words, given two values a,b with a<b, output the simplest x with a<x<b. This is a code golf, so fewest bytes wins. Simplicity All values in this problem are dyadic rationals, which means their binary expansions are finite, or equivalently, are r...
Task You have a row of numbered boxes, with some filled with items and some empty. Your job is to output the number of boxes from the first to the last box, inclusive, minus the number of boxes of the largest gap between two filled boxes. Rules Your program should handle up to 1000 boxes. Score = size of program in byt...
Draw a series of connected polygons like the one shown above. However, what the above picture does not show is the spiral formed by consecutive vertexes: The limitation of these is that there is only 1 spiral marked. You should mark all the spirals. This can be done by rotating each spiral shown above so that there i...
A sequence of integers is a one-sequence if the difference between any two consecutive numbers in this sequence is -1 or 1 and its first element is 0. More precisely: \$a_1, a_2, ..., a_n\$ is a one-sequence if: $$\forall k \::\: 1\le k<n, |a_k-a_{k+1}| = 1 \\ a_1 = 0$$ Input \$n\$ - number of elements in the sequence...
Challenge You must create a simple model of how disease spreads around a group of people. Rules and Requirements The model must be a 1000 by 1000 2D array with each element being a different person. The user must input three variables using argv: the probability of transmission (how likely someone is going to infect so...
Given three mutually tangent circles, we can always find two more circles which are tangent to all three of those. These two are called Apollonian circles. Note that one of the Apollonian circles might actually be around the three initial circles. Starting from three tangent circles, we can create a fractal called an A...
The challenge: Given an integer N, 1 < N < 2³¹, write code that uses the C preprocessor to determine whether N is prime, and produces a "Hello world" program if N is prime, or an error otherwise. Make the code as short as possible. It's not very hard, so don't worry that there are so many rules; most of them are bo...
Consider 3 dimensional space which has been partitioned by at least two planes which go through the origin. If there are n planes then the number of distinct pyramidal regions this creates is exactly 2 - n + n^2 as long as they are in "general position", a term I make specific below. The challenge is write code that...
Introduction You have the misfortune of being stuck in a runaway car on an obstacle course. All of the car's features are non-responsive, save for the steering system, which is damaged. It can drive straight, or it can turn right. Can the car be guided to safety? Mechanics Your car begins in the upper-left corner of...
The Setup You are given a simple web page with 11 elements: 10 input elements with IDs i1 thru i10, in order one output element with ID out The input elements have value attributes defined in the HTML source. The value of any given input may be any integer from 0 to 10 inclusive. The webpage is equipped with the core...
Goal: Write a piece of code that produces a array containing all integer values in a set range in random order (upper and lower bounds included). Use any language you like, but use as little built-in functions as possible (ie PHP's array_shuffle should be avoided) Rules: All ints in the range must be used once, and on...
I have a problem when posting an answer to a question that already have several answers and/or several comments: The "post your answer" form sits on bottom, the answer is on top. There is an awful lot of "clutter" between them, that are not needed for the act of posting a new answer (yes, I've read the other answers an...
The challenge This challenge is very straightforward. Given four 3-dimensional points, calculate the surface area of the tetrahedron that they form. This is code-golf, so shortest code wins. Standard loopholes apply, with the added stipulation that any built-in function to do this task given four points is prohibited. ...
My family has an e-commerce business. On our own site, we force people to choose their state from a dropdown menu when they enter their address, but through some other channels we use, customers can enter anything they want into the box. My mom loves the invoice templates I made for her, which are automagically generat...
Your mission, should you choose to accept it, is to write code for a GPS receiver. Input The current time, as nanoseconds from the Unix epoch. [EDIT: This is optional, please state whether you require it] Four satellite signals, in the following format: The time the signal was sent, as nanoseconds from the Unix epoch...
Without using any built-in factoring/polynomial functions, factor a polynomial completely into irreducibles over the integers or a finite field. Input Your program/function will receive some prime (or zero) number n as input. The field/ring is the finite field of that order (ie Z/nZ), or just Z if n is 0. Your program ...
Starting with /\ you can create a Sierpinski triangle like pattern by adding a line beneath such that... Any loose branch / or \ splits again into two branches: /\. Any collision of branches \/ dies with nothing (but spaces) under it. Repeating these rules yields /\ /\/\ /\ /\ /\/\/\/\ /\ /\ /\/\...
The challenge is to make a program that sorts a list of words, only that the words need to be in the order of a random given alphabet. Your program will accept a string of comma-separated words and a new alphabet. Your program will output every word in the same way in the new sorted order. Example: Input: home,oval,cat...
NOTE: This question is currently in the SANDBOX. Please bear this in mind before adding new answers. I have a large collection of fine art. My toddler is learning to use scissors and glue; lately she has started playing with my art collection. Fortunately she is really quite good with the scissors and cuts things u...
Your job is to find the location (read index) of a given element X in an array gone through the following transformation process: Take a fully sorted integer array of size N (N is known implicitly) Take any random number of mutually exclusive even index pairs (as in that no index appears in more than 1 pair) from the ...
Because there isn't enough xkcd on PPCG... Challenge The challenge is the same as above - given a menu and a total price, you need to find what the customer ordered. The menu will be supplied as a text file in the format: Name:Price Name:Price The path to the menu file and the total price should be supplied via argv ...
Let's represent a standard masonry brick as [__] (and ignore the fact that the top is open). When these bricks are stacked every other layer is offset by half a brick, as is usual in brick construction: [__][__][__][__] [__][__][__][__] [__][__][__][__] [__][__][__][__] Thus each brick has at most six neighbor...
Game The game is simple. Test the user's response time by asking them to enter the correct value that is displayed on the screen in the shortest time possible. Each round of the game will be as follows: Show Value ----> Get Response ----> Check Response ----> Report Response Time Example ROUND ONE --------- COMPUTER ...
You are given as input a greyscale image. Your task is to find a static or looping pattern in Conway's Game of Life that resembles the input image as closely as possible. Your output can be either a still image or a looping animation in some format that can be converted to gif. The output image dimensions should be the...
This is the second of two challenges about "pulling functions taut". Here is the slightly simpler Part I. Let's drive m nails into a board at positions (x1, y1) to (xm, ym). Tie a rubber band to the first and last of those and stretch around the other nails, such that the band traverses all nails in order. Note that th...
Here is an ASCII saltine cracker: _________________ | . . . | | . . | | . . . | | . . | | . . . | |_________________| Here are two crackers stacked: _________________ | . . . | | . __________|______ | . | . . . | | .| . . ...
Introduction You are the police chief of the NYPD and you have been tasked to position police officers so that all of the streets are patrolled. Your squad is short-staffed, however, meaning that you need to position as little officers as possible. Challenge Given a map of blocks, you must return the smallest number of...
Based on Practical Golf - US States Your task is to find the abbreviation (symbol) of an element given the element name, up to and including ununoctium (118). Use the periodic table on Wikipedia. Thanks to squeamish ossifrage, you can find a full list of elements to abbreviations at http://pastebin.com/DNZMWmuf. You ma...
This challenge is based on actual collision detection I had to write for a simple game recently. Write a program or function which, given two objects, returns a truthy or falsy value depending on whether the two objects are in collision (i.e. intersect) or not. You need to support three types of objects: Line segments...
I downloaded POV-ray and rendered this shiny metal sphere 90s style: Your task is to do the same thing, but to do it by implementing the rendering engine yourself in as few bytes as possible. You don't have to replicate this exact image - any image of a reflective sphere above an infinite checkerboard will do, as long...
The Setup Consider an oddly-shaped box containing 29 numbered cells as shown in Fig. 1 below. Inside this 2D box are two species of square-shaped animals: shubbles and smoles. Fig. 1 (a) shows some shubbles in blue, and some smoles in red. Each creature occupies exactly one grid cell. The box may contain anywhere betw...
(inspired by this SO question) You are given as input a single positive integer n. In as few characters as possible, output a rocket in ASCII art with a head, a tail, and a body composed of n segments. There should be no trailing spaces or newlines. The head and the tail of the rocket are always the same for any value...