6
\$\begingroup\$

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:

enter image description here

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.

\$\endgroup\$
1
  • \$\begingroup\$ Accounting for the view angle is going to be a vexing/fun challenge. \$\endgroup\$ Commented Mar 9, 2014 at 19:47

3 Answers 3

7
\$\begingroup\$

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.)

\$\endgroup\$
4
\$\begingroup\$

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.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ 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! \$\endgroup\$ Commented Mar 9, 2014 at 20:42
  • \$\begingroup\$ Not bad, a lot better than "500km away" answer. At least you can tell what it is! \$\endgroup\$
    – user10766
    Commented Mar 9, 2014 at 20:53
  • \$\begingroup\$ Looks more like a rocket. \$\endgroup\$ Commented Mar 10, 2014 at 4:26
1
\$\begingroup\$

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. enter image description here

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.