rosetta-stone

Code Golf: Phone Number to Words

此生再无相见时 提交于 2019-12-03 05:39:51
Guidelines for code-golf on SO We've all seen phone numbers that are put into words: 1-800-BUY-MORE, etc. What is the shortest amount of code you can write that will produce all the possible combinations of words for a 7 digit US phone number. Input will be a seven-digit integer (or string, if that is simpler), and assume that the input is properly formed. Output will be a list of seven-character strings that For instance, the number 428-5246 would produce GATJAGM GATJAGN GATJAGO GATJAHM GATJAHN GATJAGO GATJAIM GATJAIN GATJAIO and so on..... Winning criterion will be code from any language

Code Golf: Triforce

两盒软妹~` 提交于 2019-12-03 05:30:00
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable. When the input is 1, print the following: *********** ********* ******* ***** *** *

Code Golf: Ulam Spiral

谁说我不能喝 提交于 2019-12-03 04:50:38
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The Challenge The shortest code by character count to output Ulam's spiral with a spiral size given by user input. Ulam's spiral is one method to map prime numbers. The spiral starts from the number 1 being in the center (1 is not a prime) and generating a spiral around it, marking all prime numbers as the character ' *

Code Golf: Lights out

你离开我真会死。 提交于 2019-12-03 04:35:17
Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Learn more . The challenge The shortest code by character count to solve the input lights out board. The lights out board is a 2d square grid of varying size composed of two characters - . for a light that is off and * for a light that is on. To solve the board, all "lights" have to be turned off. Toggling a light (i.e. turning off when it is on, turning on when it is off) is made 5 lights at a time - the light selected

Code Golf: Connecting the dots

烈酒焚心 提交于 2019-12-03 02:59:09
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. You may remember these drawings from when you were a child, but now it's time to let the computer draw them (in full ascii splendour). Have fun! Description: The input are multiple lines (terminated by a newline) which describe a 'field'. There are 'numbers' scattered across this field (seperated by whitespace). All

Code Golf: Beehive

风流意气都作罢 提交于 2019-12-03 02:54:13
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The challenge The shortest code by character count that will generate a beehive from user input. A beehive is defined a a grid of hexagons in a size inputted by the user as two positive numbers greater than zero (no need to validate input). The first number ( W ) represents the width of the beehive - or - how many

Code golf: the Mandelbrot set

百般思念 提交于 2019-12-03 01:53:49
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Usual rules for the code golf. Here is an implementation in python as an example from PIL import Image im = Image.new("RGB", (300,300)) for i in xrange(300): print "i = ",i for j in xrange(300): x0 = float( 4.0*float(i-150)/300.0 -1.0) y0 = float( 4.0*float(j-150)/300.0 +0.0) x=0.0 y=0.0 iteration = 0 max_iteration =

Code Golf: 1x1 black pixel

限于喜欢 提交于 2019-12-02 21:08:43
Recently, I used my favorite image editor to make a 1x1 black pixel (which can come in handy when you want to draw solid boxes in HTML cheaply). Even though I made it a monochrome PNG, it came out to be 120 bytes! I mean, that's kind of steep. 120 bytes. For one pixel . I then converted it to a GIF, which dropped the size down to 43 bytes. Much better, but still... Challenge The shortest image file or program that is or generates a 1x1 black pixel. A submission may be: An image file that represents a 1x1 black pixel. The format chosen must be able to represent larger images than 1x1, and

Code Golf: Ulam Spiral

醉酒当歌 提交于 2019-12-02 19:09:44
The Challenge The shortest code by character count to output Ulam's spiral with a spiral size given by user input. Ulam's spiral is one method to map prime numbers. The spiral starts from the number 1 being in the center (1 is not a prime) and generating a spiral around it, marking all prime numbers as the character ' * '. A non prime will be printed as a space ' '. alt text http://liranuna.com/junk/ulam.gif Test cases Input: 2 Output: * * * * Input: 3 Output: * * * * * ** * * Input: 5 Output: * * * * * * * * * * * ** * * * * * * * * * Code count includes input/output (i.e full program).

Code Golf: Triforce

北城以北 提交于 2019-12-02 17:51:22
This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable. When the input is 1, print the following: *********** ********* ******* ***** *** * Values greater than one should generate multiples of the pattern, ending with the one above, but stacked symmetrically. For example, 3 should print the following: *********** *********** *********** ********* ********* ********* ******* ******* ******* ***** ***** ***** *** *** *** *