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:
***********
*********
*******
*****
*** ...
The Challenge
Guidelines for code-golf on SO
The shortest code by character count to display a representation of a circle of radius R using the *character, followed by an approximation of π.
Input is a single number, R.
Since most computers seem to have almost 2:1 ratio you should only output lines where y is odd. This means that whe...
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 lines can be consid...
What's more appropriate than a Spiral for Easter Code Golf sessions? Well, I guess almost anything.
The Challenge
The shortest code by character count to display a nice ASCII Spiral made of asterisks ('*').
Input is a single number, R, that will be the x-size of the Spiral. The other dimension (y) is always R-2. The program can assume...
A word is an anagram if the letters in that word can be re-arranged to form a different word.
Task:
The shortest source code by character count to find all sets of anagrams given a word list.
Spaces and new lines should be counted as characters
Use the code ruler
---------10--------20--------30--------40--------50--------60--------7...
Note: This is my first Code Golf challenge/question, so I might not be using the correct format below. I'm not really sure how to tag this particular question, and should this be community wiki? Thanks!
This Code Golf challenge is about solving word searches!
A word search, as defined by Wikipedia, is:
A word search, word find, wor...
I've seen many (code-golf) Perl programs out there and even if I can't read them (Don't know Perl) I wonder how you can manage to get such a small bit of code to do what would take 20 lines in some other programming language.
What is the secret of Perl? Is there a special syntax that allows you to do complex tasks in few keystrokes? Is...
The challenge
The shortest code by character count that will output the numeric equivalent of an Excel column string.
For example, the A column is 1, B is 2, so on and so forth. Once you hit Z, the next column becomes AA, then AB and so on.
Test cases:
A: 1
B: 2
AD: 30
ABC: 731
WTF: 16074
ROFL: 326676
Code count includes ...
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
...
Based on this question: Is there a way to round numbers into a friendly format?
THE CHALLENGE - UPDATED! (removed hundreds abbreviation from spec)
The shortest code by character count that will abbreviate an integer (no decimals).
Code should include the full program.
Relevant range is from 0 - 9,223,372,036,854,775,807 (the upper li...
The challenge:
The shortest code by character count that will generate a series of (pseudo)random numbers using the Middle-Square Method.
The Middle-Square Method of (pseudo)random number generation was first suggested by John Von Neumann in 1946 and is defined as follows:
Rn+1 = mid((Rn)2, m)
For example:
34562 = 11943936
m...
The challenge
The shortest code by character count that will output the numeric solution, given a number and a valid string pattern, using the Ghost Leg method.
Examples
Input: 3,
"| | | | | | | |
|-| |=| | | | |
|-| | |-| |=| |
| |-| |-| | |-|"
Output: 2
Input: 2,
"| | |=| |
|-| |-| |
| |-| | |"
Output: 1
Clarifications
...
I am interested in trying a few code-golf problems, but of a fairly easy level as I'm only a year old in terms of programming. Simple things, but that will make me think. I am comfortable in JavaScript and PHP at the moment.
...
The challenge
The shortest code by character count to draw an ASCII representation of a Code 39 bar code.
Wikipedia article about Code 39: http://en.wikipedia.org/wiki/Code_39
Input
The input will be a string of legal characters for Code 39 bar codes. This means 43 characters are valid: 0-9 A-Z (space) and -.$/+%. The * character w...
Last year (2009), the Google Code Jam featured an interesting problem as the first problem in Round 1B: Decision Tree
As the problem seemed tailored for Lisp-like languages, we spontaneously had an exciting codegolf here on SO, in which a few languages managed to solve the problem in fewer characters than any Lisp variety, using quite a...
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 ...
Write a program that takes 3 integers separated by spaces and perform every single combination of addition, subtraction, multiplication and division operations possible and display the result with the operation combination used.
Example:
$./solution 1 2 3
Results in the following output
1+2+3 = 6
1-2-3 = -4
1*2*3 = 6
1/2/3 = 0 (in...
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 challenge
The shortest code by character count to output a a pattern of diamonds according to the input.
The input is composed of 3 positive numbers representing the size of the diamond and the size of the grid.
A diamond is made from the ASCII characters / and \ with spaces. A diamond of size 1 is:
/\
\/
The size of the grid c...
When thanking someone, you don't want to just send them an e-mail saying "Thanks!", you want to have something FLASHY:
Input: THANKS!!
Output:
TTT H H AAA N N K K SSS !!! !!!
T H H A A NNN K K S !!! !!!
T HHH AAA NNN KK SSS !!! !!!
T H H A A N N K K S
T H H A A N N K K SSS !!! !!!
Write a program to genera...