# Challenge

Draw the Olympic Games logo...

...as character (e.g. ASCII) art!

# Sample Output

      * * *               * * *               * * *
*           *       *           *       *           *
*               *   *               *   *               *
*               * * *               * * *               *
*           *   *   *   *       *   *   *   *           *
*       *   *       *   *   *   *       *   *       *
* * *               * * *               * * *
*               *   *               *
*           *       *           *
* * *               * * *


Your art doesn't have to look exactly like mine, but it has to represent the Olympic rings well enough that it's recognizable.

# Rules

• The program must write the art to the console.
• Shortest code (in bytes, any language) wins.
• A solution that prints rings in their respective colors (or a close representation) will be awarded a minus-twenty-point bonus.

The winner will be chosen on February 23rd at the end of the 2014 Winter Olympics.

# Winners

## closed as too broad by Mego♦, Blue, NoOneIsHere, ericw31415, RɪᴋᴇʀMay 23 '16 at 22:47

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

## locked by DennisDec 31 '17 at 20:05

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. See the help center for guidance on writing a good question.

• 20 bonus points. Um, why would I want +20 to my score? – Justin Jan 21 '14 at 7:21
• Hum, this is a trademark… – moala Jan 21 '14 at 9:56
• @moala I think this falls under fair use policy. – Nzall Jan 21 '14 at 14:23
• In color, it's evident that they are interlocking rings, not merely overlapping. Few of the entries so far have accounted for that. – Rob Kennedy Jan 21 '14 at 17:53
• Totally IANAL: ok to write the sofware which draws the O******ic R**gs, not ok to execute it. :-) – Carl Witthoft Jan 21 '14 at 18:53

# Python - 163 characters (thanks to manatwork!)

print("""  000     000     000
0   0   0   0   0   0
0     000     000     0
0   0   0   0   0   0
000     000     000
0   0   0   0
000     000""")


### Output:

  000     000     000
0   0   0   0   0   0
0     000     000     0
0   0   0   0   0   0
000     000     000
0   0   0   0
000     000


Very simple...

• 1) Count it manually. 2) Use a text editor which displays text size or absolute character position. (Midnight Commander's built-in editor displays absolute positions too: move the cursor at the end of text and the absolute position will be equal with the size.) 3) Save it in a file and look at its size. Or if is already posted, Code Golf UserScript Enhancement Pack tells it. – manatwork Jan 22 '14 at 17:14
• I just used len() – tasteslikejava Jan 22 '14 at 17:16
• len() said it was 170 characters... – tasteslikejava Jan 22 '14 at 17:18
• MCEdit says 176. No idea what I miscalculated earlier. – manatwork Jan 22 '14 at 17:19
• Regarding your code, you can spare: 2 characters by changing for "…" to """…""" and using literal newlines instead of \n; 11 characters by removing trailing spaces from each line's end. pastebin.com/9wQmB2N1 (See RAW Paste Data – their syntax highlight seems to alter the code.) – manatwork Jan 22 '14 at 17:29

# Coffeescript 123

Input:

for t in[y=124830,137313,146673,y,17160,15600]
n=t.toString 2;k=31-n.length;n=0+n while k--;console.log n.replace /0/g,' '


Output:

   1111  1111  1111
1    11    11    1
1   1111  1111   1
1111  1111  1111
1    11    1
1111  1111


Screenshot:

### Javascript 136

Input:

r=[y=124830,137313,146673,y,17160,15600]
for(i in r){
n=r[i].toString(2)
k=31-n.length
while(k--)n=0+n
console.log(n.replace(/0/g,' '))}


## Python (318-20)

def f(s,i,j,c):
for (k,l) in zip([i,i,i+1,i+1,i+2,i+2,i+3,i+3,i+4,i+4,i+5,i+5],[j+2,i+3,j+1,j+4,j,j+5,j,j+5,j+1,j+4,j+2,j+3]):s[k][l]=c+'+'+'\033[0m'
a=[];
for i in range(9):a+=[14*[' ']]
for i in [0,4,8]:f(a,0,i,'\033[9%im'%((4*i+4)%5))
for i in [2,6]:f(a,3,i, '\033[9%im'%((i+1)%5))
for l in a:print''.join(l)


a is a matrix of strings, the function f modifies it by drawing a circle at location i,j with color c using ansi color codes. Finally a is printed.

R - 70

Using CRAN-R statistics. Unfortunately the output goes to X and not to the console. I resubmitted this answer to the Olympic Games Logo - Free Style Edition

Anyhow, here is the code:

l=c(1,9);plot(3:7,c(6,4,6,4,6),col=c(4,7,1,3,2),cex=10,ylim=l,xlim=l)


• "The program must write the art to the console." – klingt.net Jan 21 '14 at 22:45
• The challenge calls for ASCII art... – Igby Largeman Jan 21 '14 at 23:23
• Indeed, this program does not write art to the console and is therefor obsolete for this contest. – CousinCocaine Jan 22 '14 at 8:00

# C - 230 bytes

Not a winner, but draws in a non-intuitive way:

#include <stdio.h>
#include <math.h>
#define D(p,q) ((int)hypot(x-(p),y-(q))==8)
int main(){int y,x;for(y=0;y<29;y++){for(x=0;x<61;x++)putchar((D(10,10)||D(30,10)||D(50,10)||D(20,18)||D(40,18))?'*':' ');putchar('\n');}return 0;}


To compile, gcc -o ologo ologo.c -lm.

Output:

    *********           *********           *********
**       **         **       **         **       **
*           *       *           *       *           *
*             *     *             *     *             *
**             **   **             **   **             **
*               *   *               *   *               *
*               *   *               *   *               *
*               *   *               *   *               *
*             *********           *********             *
*            ** *   * **         ** *   * **            *
*           *   *   *   *       *   *   *   *           *
*          *    *   *    *     *    *   *    *          *
**        **   **   **   **   **   **   **   **        **
*        *    *     *    *   *    *     *    *        *
*       *   *       *   *   *   *       *   *       *
**     * **         ** *   * **         ** *     **
*********           *********           *********
*               *   *               *
*               *   *               *
*               *   *               *
**             **   **             **
*             *     *             *
*           *       *           *
**       **         **       **
*********           *********


using PASCAL / DELPHI

program Project_olympic_rings;
{$APPTYPE CONSOLE} {$R *.res}
uses
System.SysUtils;
begin
writeln(' O O O ' + #10 + '  O O ');
end.


• You can shorten that by removing lines 3, 4, 5, and 8 since they contribute nothing. You can also remove the string concatenation since string and char literals can be written adjacently. There's also a shorter way to write line breaks. In total: program O;{$APPTYPE CONSOLE}begin writeln('O O O'^M' O O')end. 62 characters – Rob Kennedy Jan 22 '14 at 16:35 • Or in plain Pascal, 34 characters: begin write('O O O'#10' O O') end. – manatwork Jan 22 '14 at 19:01 # PowerShell, 555 bytes Certainly not the shortest, but it's PowerShell with real circle functions and some color! cls c 8 8 1 c 16 8 2 c 24 8 3 c 12 15 4 c 20 15 5 w 30 30 . 6 function global:c ([int]$x,[int]$y,[int]$n) {
foreach ($i in 1..360) {$t = [math]::pi * ($i / 180) w ($x + 5 * [math]::cos($t)) ($y + 5 * [math]::sin($t)) *$n
}
}
function global:w ([int]$x,[int]$y,[string]$c,[int]$n) {
$p=$host.ui.rawui.cursorposition
$p.x=$x
$p.y=$y
$host.ui.rawui.cursorposition=$p
$h="green" switch ($n){ 1 {$h = "blue" } 2 {$h = "black" } 3 {$h = "red" } 4 {$h = "yellow" } 5 {$h = "green" }} write-host$c -f $h -nonewline }  • Nitpick: the rings aren't supposed to be linked to their neighbors to the left and right. – Blazemonger Jan 24 '14 at 15:19 • Great point, really shows how much I'm into sports. Is it bad etiquette to edit my answer? – chrixbittinx Jan 24 '14 at 17:04 • Don't see why it would be. – Blazemonger Jan 24 '14 at 17:56 LAZARUS / FREE PASCAL (with color support , unit CRT) program P; uses crt; procedure R(c : Byte); begin TextColor(c); write('O '); end; begin R(blue); R(white); R(red); writeln; write(' '); r(yellow); r(green); end.  • As this is a code-golf challenge better reduce those 179 characters. For example to 115: pastebin.com/kuQM4TiN And please mention your code's length and score too in your answers header line. – manatwork Jan 23 '14 at 10:28 # HTML+CSS (222 ch) First go at code golf so it's not golfed nearly enough but I hadn't spotted anyone using HTML+CSS yet so meh.. <style>a{margin:-8px;font-size:4em}a:first-child{color:blue}a:nth-child(3){color:red}a:nth-child(4){color:#ff0}a:last-child{color:#060}a:nth-child(n+4){position:relative;top:-.8em;left:.2em}</style><a>O<a>O<a>O<br><a>O<a>O  Someone can probably golf it more. (size for example was just to make it look better!) ## Jquery 503 chars good challenge! since I'm a web developer, I used the tools that I use each day... html/jquery/js check out my answer at jsfiddle.net http://jsfiddle.net/rYcVV/5/ screenshot of rings attached... code minified <div id="rings"/><div id="rings"/>var color=["#06f","#000","red","#fa0","#193"],lefty=[150,300,450,225,380],toppy=[50,50,50,100,100];for(var j=0;j<color.length;j++){for(var i=0;i<36;i++){$("#rings").append('<span class="x'+j+'" style="color:'+color[j]+";;display:inline-block;position:absolute;left:"+lefty[j]+"px;top:"+toppy[j]+'px;height:150px;transform-origin: bottom bottom;width:15px;">*</span>')}}for(var m=0;m<color.length;m++){for(var k=0;k<36;k++){$($("span.x"+m)[k]).css("transform","rotate("+(10*k)+"deg)")}}; 

• corrected missing jquery library thanks. – J nui Jan 30 '14 at 11:43
• Maybe you should mention that requires Chrome. The output is equally ugly in Explorer, Firefox and Opera. – manatwork Jan 30 '14 at 11:48
• wow, you're a bit of a hater aren't you? I just looked at that link with internet explorer 9 and it looked the same as in chrome. jsfiddle.net/rYcVV/1 , firefox does not look very good tho. – J nui Jan 30 '14 at 11:51
• Sorry if you felt any hate in my comment, but I really believe this is ugly: i.stack.imgur.com/WoVO9.png Taken in Explorer 11. – manatwork Jan 30 '14 at 12:01

## Mathematica, 132

Further golfing of swish's fine method:

x_~f~y_:=Boole[E<Norm@{#-x,#2-y}<4.3]&~Array~{13,30}

Grid@Replace[Hue/@{E,{0,0,0},0,π,.3}.f@@@{5|5,5|15,5|25,9|10,9|20},0->"",c_+_.:>Style["*",c]},{2}]


# Bash / base64 / zcat, 125

$base64 -d<<<H4sIAKc54FIAA1NQUFDQAkMEwMrnUoCLEaS5UHUrKODlcxG0G4dqLahZWjj4Ckiuxq0KxgKpJT4sUH2M3V+oclhpJDW47AIAX9PRBqIBAAA=|zcat * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *$


# TeX, 169

\color{blue}\put(0,2){\circle{5}}\color{black}\put(6,2){\circle{5}}\color{red}\put(12,2){\circle{5}}\color{yellow}\put(2,0){\circle{5}}\color{green}\put(9,0){\circle{5}}


Converting the resulting image to ASCII characters:

# Java

public class Converter {
public static String convertImage(BufferedImage img)  {
BufferedImage image = img;

char[] tones = new char[]{'*', '*', '*', '*', '*',  ' '};
int tone = 0;

StringBuilder stringBuilder = new StringBuilder();

Color color;

for (double y = 0; y < image.getHeight(); y++) {
for (double x = 0; x < image.getWidth(); x++) {
color = new Color(image.getRGB((int) x, (int) y));

tone = (color.getRed() + color.getGreen() + color.getBlue()) / 3;
tone = tone / (256 / tones.length - 1);

while (tone > tones.length - 1) tone--;

stringBuilder.append(tones[tone] + " ");
}
stringBuilder.append("\n");
}
return stringBuilder.toString();
}

public static void main(String args[ ]) {
BufferedImage image = null;
Writer writer;
try {

writer = new BufferedWriter(new FileWriter(new File("C:\\ascii-conversion.txt")));
writer.append((convertImage(image)));
writer.close();

} catch (IOException e) {
e.printStackTrace();
}

}
}


it gives -

          * * * * * *                             * * * * * *                             * * * * * *
* *             * *                     * *             * *                     * *             * *
*                     *                 *                     *                 *                     *
*                         *             *                         *             *                         *
*                         *             *                         *             *                         *
*                             *         *                             *         *                             *
*                             *         *                             *         *                             *
*                             * * * * * * *                           * * * * * * *                           *
*                           * *         *   * *                     * *         *   * *                       *
*                         *   *         *       *                 *   *         *       *                     *
*                       *     *         *         *             *     *         *         *                   *
*                     *   *             *       *             *   *             *       *                 *
*                   *     *             *         *         *     *             *         *               *
*                 *   *                 *       *         *   *                 *       *             *
* *             * *                     * *   *         * *                     * *   *         * *
* * * * * * *                           * * * * * * *                           * * * * * *
*                             *         *                             *
*                             *         *                             *
*                         *             *                         *
*                         *             *                         *
*                     *                 *                     *
* *             * *                     * *             * *
* * * * * *                             * * * * * *


# C# [202]

Basic foreach loop in C#

class P{static void Main(){foreach(var i in new[]{0x3c7f1fc7,0x37ddf77d,0x2fe3f8fe,0x379ce73d,0x3c7f1fc7,0x3fbeefbf,0x3fe3f8ff})System.Console.WriteLine(System.Convert.ToString(i,2).Replace('1',' '));}}


Result Below

    000       000       000
0     0   0     0   0     0
0       000       000       0
0    00   00   00   00    0
000       000       000
0     0   0     0
000       000


Linq Version 215 Characters

namespace System.Linq{class P{static void Main(){new[]{0x3c7f1fc7,0x37ddf77d,0x2fe3f8fe,0x379ce73d,0x3c7f1fc7,0x3fbeefbf,0x3fe3f8ff}.ToList().ForEach(i=>Console.WriteLine(Convert.ToString(i,2).Replace('1',' ')));}}}


# Math

|f(x)|=sqrt(1-x^2)
f(x+2)
f(x-2)
f(x+1)-1
f(x-1)-1


For the output to be able to be graphed with a computer I had to add:

g(x)=-f(x)
g(x+2)
g(x-2)
g(x+1)-1
g(x-1)-1


And remove the |'s from the first line.

But they don't really have to be there.

PROCESSING B/W (78 characters)

No output to the console but still fun to participate. Colours add a lot to the code so it is not worth the 20 points in this case.

float i,s=9,k=1;for(i=1;i<6;i++){k=i;if(i>3){s=13;k=i*1-2.5;}text("O",k*8,s);}

Colour (150-20=130 characters)

float r=0,g=0,b=255,i,s=9,k=1;for(i=1;i<6;i++){k=i;if(i>3){s=12;k=k-2.5;g=255;r=(5-i)*255;}if(i==3){r=255;}if(i==2){b=0;}fill(r,g,b);text("O",k*9,s);}

# PHP, 90 bytes

This matches the sample output exactly.

The code is displayed in a screenshot as it contains control characters that I can't post on Stack Exchange. Here is a longer, equivalent version using character codes that I can post here:

<?echo gzinflate("SP\0\1-0D\58Åx¹\x14P\\$´Ðhœb¼\\˜æ)(\x10%†M+‘NFÕª…†q‰Aµb*\"d\x08\\#Yáª€%Üð\4Š‚\2v-8‚_X§\0");


That is 109 bytes but the version in the screenshot using control characters is 90 bytes.

• Instead of making a screenshot of your editor, paste in the code! – klingt.net Jan 23 '14 at 9:00
• I took a screenshot because it contains control characters that wouldn't be visible here. – Alex Barrett Jan 23 '14 at 9:21
• ... Isn't it cheating to write the program in binary? – SamB Jan 27 '14 at 7:55
• @SamB - It is well within the rules currently listed. – Alex Barrett Jan 27 '14 at 15:59

# gnuplot 42 characters

se te du
uns bor
uns tic
p '-' w ell not
1 4
2 3
3 4
4 3
5 4
e


Output:

             **                       **                      **
******  ******           ******  ******          ******  ******
***              ***     ***              ***    ***              ***
***                  *** ***                  ******                  ***
*                      * *                      **                      *
*                      ***                      **                      **
*                **************           **************                **
*             ***      * *     ***     ***      **      ***             *
***         ***      *** ***     *** ***      ******      ***         ***
***       *      ***     ***     * *      ***    ***      *       ***
**************           **************          **************
**                      ***                      **
*                      * *                      *
***                  *** ***                  ***
***              ***     ***              ***
**************           **************


# Shorter version (with axes) 27 characters

se te du
p '-' w ell
1 4
2 3
3 4
4 3
5 4
e


Output:

  5.5 ++----------+----------+-----------+----------+-----------+---------++
+           +          +           +          +           '-' ****** +
5 ++                                                                  ++
|     ************           ************           ************     |
|  ***            ***     ***            ***     ***            ***  |
4.5 +**                  ** **                  ** **                  **+
**                    ***                    ***                    **
4 *+                     *                      *                     +*
*                ************           ************                 *
3.5 **            ***     ***    ***     ***     ***    ***             **
|**         **       ** **      ** **       ** **      **          **|
|  ***     **     ***     ***    ***     ***     ***    **      ***  |
3 ++    ************           ************           ************    ++
|          *                      *                      *           |
2.5 ++         **                    ***                    **          ++
|           **                  ** **                  **            |
|             ***            ***     ***            ***              |
2 ++               ************           ************                ++
+           +          +           +          +           +          +
1.5 ++----------+----------+-----------+----------+-----------+---------++
0           1          2           3          4           5          6


# HTML + CSS ( 209 characters )

This isn't really much better than the other HTML / CSS attempt, but I wanted to try this for myself! removing font size will again shrink down a teeny bit.

<style>e:after{content:'o';font-size:2em}e{position:absolute;color:#00f}e>e{left:9px;color:#000}e e e{color:red}e e e e{left:-4px;top:9px;color:#0F0}e e e e e{left:-9px;top:0;color:#ff0}</style><e><e><e><e><e>


fiddle: http://jsfiddle.net/rV4eQ/

it's not really kosher code, but the e seemed fun to use.

# PERL, 15 characters

say"O O O
O O"


To be invoked with -E.

O O O
O O


# TI-Basic (15 bytes)

This really ought to be a comment on @bb94 's answer, but I don't have the reputation for that yet.

ClrHome
Disp "O O O
" O O


I saved a byte by omitting a closing quote and using the fact that programs print the final line without being explicitly told to. This also avoids the "Done" that would be printed otherwise.