instruction
stringlengths
34
53.1k
The Challenge Implement a function which accepts two integers whose values range from 0 - 255 and returns the sum of those integers mod 256. You may only use bitwise negation (~), bitwise or (|), bit shifting operators (>>,<<), and assignment (=). Things you cannot use include (but are not limited to) Addition, subtra...
i've been dabbling with a hypothetical language... now, i want to add a feature/mechanism that can easily format data in as few codes as possible. now, i need to compare my hypothetical language feature with how it's going to be written in other languages. in particular, would it have lesser code? so i just decided i w...
Our classic snake has developed an inbalance of growth hormones. To make matters worse, his tail is frozen in place! Given directional input as specified in Figure 1, write a program to determine where he will grow. Figure 1. Directional input. Program specifications Read the input character by character on STDIN. Af...
This is a short one: Only once in American history has there been a decade in which four of the years were prime numbers. Your program has to output the decade after 1776 where four its years were primes. This is code golf so the shortest code wins. The output must be like so: 1710s or 1980s Note: The answer must b...
Winner: Chilemagic, a massive 21 bytes! You may continue to submit your answer, however you can no longer win. Original post kept: Your goal is to find all numbers in a string, and multiply each one individually by a value input by the user You will not need to worry about decimals The user will input a number and a ...
The Challenge I present to you another spy vs. spy challenge pitting obfuscators versus crackers. In this case, however, the datum to be protected is not an input but an output. The rules of the challenge are simple. Write a routine with the following specifications: The routine may be written in any language but may ...
Objective I have a nice picture that I want to hang on my wall. And I want it to hang there in a spectacular way, so I chose to hang it on n nails where n is any positive integer. But I'm also indecisive, so if I change my mind, I don't want a lot of trouble taking the picture down. Therefore, removing any one of the n...
Task Implement a program in minimum bytes of source or binary code that does voice recognition of a voice sample (me saying "yes", "yeah" or "no" in voice or in whisper, plainly or quirkily) based on training samples with maximum accuracy. The program should read train/yes0.wav, train/no0.wav, train/yes1.wav and so on ...
Your task is to devise a programme that extracts the bits, in order, represented by the first argument based on the set bits represented by the second argument (the mask). Formal Definition: Let the first argument x represent the binary string S=(xn)(xn-1)...(x1) with n>=0 and x1 being the least significant digit and...
There's a 500 rep unofficial bounty for beating the current best answer. Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. Addition x,y -> x+y Reciprocal x -> 1/x (not division x,y -> x/y) Negation x -> -x (not subtraction x,y -> x-y, though y...
Here's one for all you wordsmiths out there! Write a program or function which takes a list of words and produces a list of all possible concatenative decompositions for each word. For example: (Note: This is only a small sampling for illustrative purposes. Actual output is far more voluminous.) afterglow = after + glo...
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge When people use the term "average," they generally mean the arithmetic mean, which is the sum of the numbers divided by the number of numbers. There are, however, many ...
A centered polygonal number is able to be put into an arrangement of multiple concentric polygons, each with a side length of one more than the inner one. For example (image from linked page), the above image has 31 dots, so 31 is a centered pentagonal number. Write a program which receives a number as input (any typi...
My coworker and I work on a legacy piece of software that we hate sometimes. Whenever you run it, debug asserts come flying everywhere, and it's never a guarantee that anything will work. The motivation for this round of code golf came from my coworker saying the following about our software. "It's like every time you ...
Some background Counting rods are small bars (3-14 cm long) that were used by mathematicians from many asian cultures for more than 2000 years to represent any whole number or fraction. (In this chqllenge we'l focus on unsigned integers though) There was also a written version, called rod numerals. Here's how it works:...
This is a chess-KOTH with simplified rules (because chess itself is already complicated, playing it via a simple program doesn't make it easier). At the moment it is limited to java (version 8), but creating a wrapper-class isn't that difficult (in case someone wants to do this). Chessboard The chessboard in the contro...
There are 88 keys on a standard piano and 95 printable ascii characters (hex codes 20 through 7E): !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ('character' refers to any printable-ASCII character from here on) In this JSFiddle I've taken advantage of that and made a ...
Winners (decided 14/09/14) Winning answer by Markuz (Python) - 63 votes Runner up by kuroi neko (PHP) - 55 votes Introduction You are in the world of the book Nineteen Eighty-Four by George Orwell. You are a programmer for the Party and are tasked with writing a program for the telescreens. It should output pro-party m...
This is an optimization/algorithms challenge. Given two sets of points X and Y, which are to be thought of as points on a circle of circumference T, the challenge is to find the rotation which minimizes the distance from the set X to the set Y. Here the distance is just the sum of the absolute distance from each point ...
The task is simply to see how much faster you can calculate n choose n/2 (for even n) than the builtin function in python. Of course for large n this is a rather large number so rather than output the whole number you should output the sum of the digits. For example, for n = 100000, the answer is 135702. For n=1000000...
I like Tetris a lot, but I'm not very good at it. Just once I'd like to see that spaceship take off in front of my own eyes! And since computers are oh-so great at everything, the only possible solution is to make a program to play it for me... except you're going to do that bit for me! Given a tetromino (shape made of...
Some positive integers can be shown to have a property called Chain divisibility. For a number to be chain-divisible by n, it must fulfil three requirements: Each digit divides the number formed by the n  digits that follow it. For example, the number 7143 is chain-divisible by 2 because 7 divides 14 and 1 divides 4...
A station model is a diagram for recording the weather at a certain place and time. Challenge You must write the shortest code possible to graphically output a simplified (explained later) station model. Ticks A tick is a line on the wind barb. A 50 knot tick is a triangle. A 10 knot tick is a line. A 5 knot tick is ...
Welcome to Code Bots 2! You've learned your lesson since the last Code Bots. You've tried to figure out more ways to fit more actions in less lines, and now you finally have it. You're going to make an event-driven Code Bot. Your bot must consist of 24 lines. Each line follows one of the two formats: Condition:Actio...
If you are unfamiliar with hacker typer, see hackertyper.net. In short, it is a program that outputs one chunk of a code base per keystroke for comedic effect. BUT, the hackertyper.net version is far too easy to implement. It simply outputs three characters at a time from an arbitrary piece of code. For this challenge,...
The challenge is to draw the outline of an 'island', generated using a seed as input. Input (seed): string of 6 characters (exactly) allowing only lowercase letters (i.e. abcdefghijklmnopqrstuvwxyz) - examples: 'island', 'aaaaaa', 'jhgcfj' Each seed is to give a unique island (i.e. no two seeds will give the same outp...
Following on from the third order quine challenge, your task is to write an Ouroboros program that uses as many languages as possible. That is, in language A, write a program pA which outputs program pB in language B. Program pB should output program pC in language C, and so on until eventually a program outputs the or...
Your boss managed to read the secret hidden message. He didn't end up firing you, though, he just made you a secretary and forbade you from writing code. But you're a programmer. You need to write code. You must code. Therefore, your code needs to look as similar to English as possible, make sense, and look as little l...
A certain children's game, often called "Huckle Buckle Beanstalk", is played with two players. Here is a brief description of how the game is played: One player is designated the "hider", and the other the "seeker". The seeker goes out of the room while the hider hides a small, pre-selected object, the "treasure". T...
Write a program that takes in a rectangular block of text made up of X's and .'s, such as this rough A: ...... ..XX.. .X..X. .XXXX. .X..X. .X..X. Output a representation of this grid rotated 45 degrees counterclockwise by drawing a slash — forward or backward depending on context — everywhere an X borders a . or the s...
Okey, we all know the normal way to throw a IllegalArgumentException in Java: throw new IllegalArgumentException(); // 37 characters But there must be a shorter (as in less characters) ways to do so. How can we produce a java.lang.IllegalArgumentException with even less code? The code fragment has to compile and run ...
Prior to the discovery of fingerprints and DNA testing, the British police used an anthropometric system to identify repeat offenders. Certain parts of the bodies of criminals were measured and stored in records -- these parts of the body were assumed to not change in size after adulthood. This system was known as bert...
I have a program that generates formatted Brainfuck code. I run my program ./example "S" and the output is +[>+ < +++ ] >--. which prints S in Brainfuck. Your objective is to write a program which accepts a string as input and outputs source code in another language which prints that string. The source code yo...
Given an integer n (where n < 10001) as input, write a program that will output the first n Ulam numbers. An Ulam number is defined as follows: U1 = 1, U2 = 2. For n > 2, Un is the smallest integer which is greater than Un-1 that is the sum of two distinct earlier terms in exactly one way. For example, U3 is 3 (2+1...
Write the shortest program possible that takes in a set of distinct positive integers and outputs an ASCII rendering of concentric hexagons with those side lengths, made from slashes, underscores, spaces, and newlines. The shortest program in bytes as counted by https://mothereff.in/byte-counter wins. Examples (They lo...
Produce the shortest program which takes two signed integers as input (through stdin or as arguments) and displays 3 different outputs depending upon whether the first number is (1) greater than, (2) smaller than, or (3) equal to the second number. The Catch You cannot use any of the following in your program: The sta...
A polyquine is both quine and polyglot.1 You are to write a quine which is valid in at least two different languages. This is code golf, so the shortest answer (in bytes) wins. 1 I made that up. Or rather, Geobits did. Apparently, he wasn't the first one either, though. Rules for Quines Only true quines are accepted. T...
This is a simple one: create the shortest browser script to change every appearance of force on a web page into horse. This script needs to be able to be pasted into the console and work on most modern browsers. You must replace all occurences of the word force and conjugates of the word force (forcing, forced, reinfor...
Consider a square n by n grid graph that looks like this. It is important to notice that this graph is 11 by 11. At any given point a man stands at an intersection and he only ever moves vertically or horizontally by one step at a time to the next intersection. Sadly he has drunk a little too much so he chooses the d...
Yesterday, I bought a harmonica: Figure 1: The harmonica. However, my dreams of being able to play soulful blues harmonica that moves people and causes a grown man to cry were quickly dashed by two problems: The harmonica can only play certain notes; I am depressingly bad at playing the harmonica. Despite my lack of...
Most computers store integers in binary, but output them in decimal. However, decimal is just one representation, we just happen to find it convenient. This challenge is to write some code to output an integer value in shortlex decimal. What's that? http://en.wikipedia.org/wiki/Shortlex_order Shortlex takes the length ...
In Gödel, Escher, Bach, Douglas Hofstadter introduces an integer sequence which is commonly referred to as the figure-figure sequence: 2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, ... You may enjoy working out the definition of the sequence yourself as part of the challenge, but if you can...
Intro Let's play some mini-golf! The golf ball is represented by a . and the hole by a O. You want to get a hole in one on every hole, but you are not good at putting. In fact, you refuse to attempt putting diagonally! Only up, down, and to either side. You plan to cheat by placing extra bumpers \ and / so you can put ...
A 2D board will contain the following objects: ^,>,v, or <: A laser emitter facing up, right, down, or left respectively. There may be more than one. Lasers will travel in a straight line in empty space (empty space is represented with a dot .). Lasers do not pass through emitters. *: A target. Lasers pass through tar...
You are a young programming geek living with your 2 other best friends. Every week, one of you has to do all the chores of the house and you decide whose turn it is by picking a stick. The one who picks the shortest stick loses and does all the chores. As all of you are programmers and love creating puzzles, you have m...
Write a program or function that "reacts" to a given integer n (input via function parameter/args/stdin) The program doesn't care about negative numbers, likes even, dislikes odd numbers and fears the number 13. It should output the following: if n<0: -------------------------- | | | ...
This competition is over. The winner is CJam with 22 characters, beating TwiNight's answer by one character. Congratulations Dennis! An honorable mention goes to Falko, who went totally crazy with the free imports. . A while ago I wanted to know how I can out-type modern smartphones with my Nokia 3310, and while some ...
Inspired from the assortment of other 'Tips for golfing in language xyz'. As usual, please only suggest tips that are specific to OCaml and not programming in general. One tip per answer please.
This is one of several challenges left for the community by Calvin's Hobbies. The curve that an idealised hanging rope or chain makes is a catenary. Image by Bin im Garten, via Wikimedia Commons. Used under the CC-By-SA 3.0 licence. Write a program that will draw a catenary, as an image, in quadrant 1 of the plane g...
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. If the two strings have length n each, it is well known that this can be done in O(n^2) time by dynamic programming. The following Pytho...
This is similar to other "Tips for golfing in <...>" but specifically targeting the newer features in JavaScript brought up in ECMAScript 6 and above. JavaScript inherently is a very verbose language, function(){}, .forEach(), converting string to array, array-like object to array, etc, etc are super bloats and not hea...
Leaderboard User Language Score ========================================= Ell C++11 293,619,555 feersum C++11 100,993,667 Ell C++11 78,824,732 Geobits Java 27,817,255 Ell Python 27,797,402 Peter Taylor...
If you want to build a fence and have different length boards available, there are many different ways to set up your posts. So, given a minimum and maximum board length, a number of boards, and the total length, count how many ways you can arrange them. Input Input is four positive integers: min: The smallest board u...
Recamán's sequence (A005132) is a mathematical sequence, defined as such: A(0) = 0 A(n) = A(n-1) - n if A(n-1) - n > 0 and is new, else A(n) = A(n-1) + n A pretty LaTex version of the above (might be more readable): $$A(n) = \begin{cases}0 & \textrm{if } n = 0 \\ A(n-1) - n & \textrm{if } A(n-1) - n \textrm{ is positi...
What tips do you have for golfing in Applescript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Applescript (e.g. "remove comments" is not an answer).
The ubiquitous 7-segment numerical display can unambiguously display all 16 hexadecimal digits as show in this wikipedia .gif Entries for this challenge will create a circuit diagram using NAND logic gates which transforms the four bits of a hex digit to the inputs for the seven segments. The inputs for the 7 segment ...
What are some clever (brief and idiomatic) approaches to taking a list of strings and returning a single properly punctuated string built from the list, with each element quoted. This came up for me while experimenting with Groovy, for which my too-literal, but illustrative solution is def temp = things.collect({"\'${i...
Electron Configurations Your mission is to accept an element's atomic number as input, and output its electron configuration (e.g. 2,8,8,2 for calcium). Input An atomic number from 1 to 118. You may assume valid input. The atom is not charged (it has as many electrons as protons). You may not expect the input to be sto...
Pigpen Cipher Encryption Your mission is simple: to write a program which receives text as input and outputs an ASCII representation of it in the Pigpen Cipher. Input ASCII-only (no Unicode) characters. You must be able to handle at least 16384 characters and 256 lines. Output Replace all characters which are not new ...
Clem is a minimal stack-based programming language featuring first-class functions. Your objective is to write an interpreter for the Clem language. It should properly execute all examples included in the reference implementation, which is available here. As usual, standard loopholes apply. Smallest entry by byte coun...
This is an easy one. Anagrams are words which have the same characters but in different order. All you have to do is to figure out if two strings are anagram or not. Rules: Take two strings as a function argument, command-line argument or from standard input. Write a function or program which returns truthy value if s...
Penalty shootout Welcome to CG world cup. Your job: Code a penalty shooter and goal keeper! Rules of the game: The goal is 700 cm wide and 200 cm tall. If I have to make a rectangle out of it, the goal is ABCD where A is (0,0), B is (0,200), C is (700,200), D is (700,0). The shooter gives me the coordinate where he wi...
(Continuing on the number sequences code-golf, here is an interesting sequence) Eban Numbers (A006933) are the sequence of numbers whose names (in English) do not contain the letter "e" (i.e., "e" is "banned") The first few numbers in the sequence are: 2, 4, 6, 30, 32, 34, 36, 40, 42, 44, 46, 50, 52, 54, 56 Given an i...
Surprisingly, we haven't had any challenges on graph colouring yet! Given an undirected graph, we can give each vertex a colour such that no two adjacent vertices share the same colour. The smallest number χ of distinct colours necessary to achieve this is called the chromatic number of the graph. For example, the foll...
Curve stitching is the process of "stitching" together multiple straight lines in order to create a curve, like so: For an explanation of curve stitching, visit this website. We will be drawing our curve in the top left of the screen, as shown in the image above. Given an integer n (via STDIN or a function parameter),...
Detect Duplicate Questions Once upon a time, there was a golfing site. It had a problem: people would post similar or identical questions again and again. You have been chosen selected forced conscripted blackmailed requested to automate the process of deciding whether a question is a duplicate of an existing one, by w...
Lets say I was writing something, and I accidentally wrote it in the wrong box: +-------+--------+ | Verbs | Nouns | +-------+--------+ | Truck | | | eat | Banana | | | Car | +-------+--------+ So I, being lazy, merely draw an arrow to the space it should be: +-------+--------+ | Verbs | Nouns | +-...
A radioactive quine is a quine-like program that has an even number of characters and, when run, outputs itself with exactly half of its characters removed. The output itself may be a radioactive quine, so the program can "decay" multiple times. It could be said that the half-life of a radioactive quine is one run, up ...
Problem Imagine 7 buckets lined up in a row. Each bucket can contain at most 2 apples. There are 13 apples labeled 1 through 13. They are distributed among the 7 buckets. For example, {5,4}, {8,10}, {2,9}, {13,3}, {11,7}, {6,0}, {12,1} Where 0 represents the empty space. The order in which the apples appear within eac...
Introduction I can't stand text abbreviations, mainly because for the most part I have no idea what most of them mean. Of course, cut backs need to be made, so if they are necessary to fit the text in the character limit, I'll allow them. Challenge You have to write a program that takes passage of text and determines w...
Given a standard combination lock like the one in the picture. The way to unlock it is to align the 4 numbers in the code on the combination line. After years of loyal service you have been fired from the lock factory and have decided to exact revenge by not jumbling up the locks before you send them off, thus leaving ...
Reducing fractions the wrong way In this code-golf challenge you have to find fractions that can be reduced the wrong way but still end up in the same number. Note: reducing fractions the wrong way does here have an exact definition, see details. Example: 64/16 = 64/16=4/1 = 4 Of course you cannot just strike both 6es ...
Introduction Let's start by arranging all fractions from 0 to 1 in order of lowest denominator, then lowest numerator: 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 5/6, 1/7... Note that duplicates aren't counted, so I haven't listed 2/4, 2/6, 3/6, or 4/6, since they already appeared in their simplified forms (1/2,...
There's a simple digital number lock. After each button press the lock checks if the previous four presses constitute the correct code. I.e. typing 44445 tests two codes: 4444 and 4445. You must brute force it with a code golfed program. Rules Your program must test numbers by printing ASCII digits 0-9 to standard out...
When I see code-golf entries that knock a few characters off, whittling down the code, I go look at the edit history for a side-by-side diff. See and learn :) This challenge is to make a program that produces the prettiest animated diffs. The input will be any ordered series of text versions. The program may be writt...
The Challenge: Make the shortest program to confirm that 12 is the answer. (The puzzle is from Ian Stewart's "Cabinet of Mathematical Curiosities". This is my first code golf question. I hope this type of thing is allowed) In Scrabble the following are the letter scores: AEIOULNRST score 1 each DG score 2 eac...
UPDATE : isaacg's Pyth submission is the winner! Many of you must have heard that there is a cooler version of JavaScript in town (read ES6) which has a method String.prototype.repeat so that you can do "Hello, World!".repeat(3) and get "Hello, World!Hello, World!Hello, World!" as the output. Your job is to write a ...
Programmer's Garden Being a professional software developer, you cannot risk exposing yourself to the harsh non-artificial light of the sun, but you also have a soft spot for flowers, and want to keep your garden in good shape all year round. To this end, a gardener is hired each month to tidy up the flowerbed at the f...
Background Most people on here should be familiar with a few integer base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, a number \$abc.de_{16}\$ would represent $$a\times16^2 + b\times16^1 + c\times16^0 + d\times16^{-1} + e\times16^{-2}$$ However, one can also use non-integer bases, like...
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...