# Eiffel Tower in 3D

This challenge asks you to draw the Eiffel Tower in 3D using different ASCII characters to represent the different sides, similar to this cube:

      @@@
@@@@@@@@@
@@@@@@@@@@@@@@@
x@@@@@@@@@@@@&&
xxx@@@@@@@@&&&&
xxxxx@@@&&&&&&&
xxxxxx&&&&&&&&&
xxxxx&&&&&&&
xxx&&&&
x&&


Here is a picture of the Eiffel Tower for you to base your art on: Your program will input a rotational angle of the side view, then print the Tower as if you were looking at it from that angle. The up/down angle does not need to be accounted for.

Score will be calculated as 1.25*votes - 0.25*length as a . Highest score wins.

• Accounting for the view angle is going to be a vexing/fun challenge. – Jonathan Van Matre Mar 9 '14 at 19:47

## 3 Answers

BBC BASIC, 66 chars

Emulator at bbcbasic.co.uk

A=PI/6FORJ=0TO83PRINTTAB(9+EXP(J/40)*SIN(A+J*PI/2),J/4);J MOD4:NEXT


With white space for clarity:

A=PI/6
FOR J=0 TO 83
PRINT TAB(9+EXP(J/40)*SIN(A+J*PI/2),J/4);J MOD4
NEXT


Input is hard coded in radians. Taking user input would add one character, but user would have to input in radians. Removing the MOD4 from the end would still produce a recognisable tower, but might violate the rule regarding character per side.

Basically plots a string of zeros at exp(J/40)*sin(A) vs J/4. Additional values of the sin are added for the remaining three legs. • I hesitated to post this as I thought it was perhaps a little lazy. Then I saw the "500km away" answer and thought, why not! – Level River St Mar 9 '14 at 20:42
• Not bad, a lot better than "500km away" answer. At least you can tell what it is! – user10766 Mar 9 '14 at 20:53
• Looks more like a rocket. – Mukul Kumar Mar 10 '14 at 4:26

# PHP, 364 * 0.25 = 91

Accepts a viewing angle as a query string parameter of the form ?a=0, ?a=45, ?a=90, etc.

<pre><?php
$a=45*floor(.5+intval(@$_GET['a'])/45);
$e=array(array(".","|","==","X|","X|","X/","==|","^||","-./","__//","=====","^^-. /"," |__|"), array(".","|","==","X|","X|","X/","|=|","|^|","|./"," ///",":====",":|-. /","_| |_|")); echo "Angle: {$a}°\n\n";
foreach($e[$a&1] as $s){$p=str_pad($s,7);echo strrev($p).substr(strtr(\$p,'/','\\'),1)."\n";} ?>
</pre>


Examples:

a=135

Angle: 135°

.
|
===
|X|
|X|
/X\
|=|=|
|^|^|
/.|.\
/// \\\
====:====
/ .-|:|-. \
|_|  |_|  |_|


a=200 (rounded to nearest increment = 180°)

Angle: 180°

.
|
===
|X|
|X|
/X\
|===|
||^||
/.-.\
//___\\
=========
/ .-^^^-. \
|__|     |__|


(Yes I know, the angular resolution isn't brilliant. I'll improve on that if I have time.)

# C# - 64 bytes

namespace System{class m{static void h(){Console.Write(".");}}}


Prints the Eiffel Tower viewed from 500 26.5 kilometers away. Takes the rotational angle as an argument.

Example usage:

eiffel.exe 90


# EDIT

I've made an approximation, and it should be about 26.5 kilometers away.

Let's consider the image below, taken from OP and edited to add a "." using the font Monospace 12 without anti-aliasing. The "." is 2 pixels long and 1 pixels wide whereas the tower is 400 pixels long and 663 pixels wide(approximately).

Let's assume the tower is viewed from 100 meters away.

If we want to make it look like a 2x1 box, we would need to make it (again, approximately) 265.5 times smaller(200 times smaller for the height and 531 times smaller for the width).

If we multiply 265.5 with 100 meters, we get 26550 meters, which is 26.5 kilometers.

• There's a bug in your code. The output should be " " when viewed from 500km. – Comintern Mar 9 '14 at 20:21
• This is not funny. – John Dvorak Mar 9 '14 at 20:25
• @Comintern Actually no, it would be smaller than a . but bigger than an empty space. – user3188175 Mar 9 '14 at 20:37
• I'm less than 500km from the Eiffel Tower, but there's not a single pixel in view here :-D – r3mainer Mar 10 '14 at 15:26
• @squeamishossifrage Think of it as a view from space. Or even, assume it's in space. – user3188175 Mar 10 '14 at 15:49