I'd like a homework pizza with everything on it, but no loops So there was a "please do my homework question" on StackOverflow that lead to an idea. As everyone knows loops are quite expensive, in some places they can get as high as $12.99 an iterations, so to save money there shouldn't be any loops.

So, lets do the homework, but in the least intuitive way.


  Write a program that decides, among competing candidate pizzas, which is the
  best deal, in the sense of the smallest cost per unit area. Pizzas come in three shapes:
  round, square, and oval (elliptical). The area of an oval is pi*ab/4, where:
   a and b are the longer and shorter dimensions of the oval.


The rest of the specifications are in the linked PDF, which I can add in if needed. The input and output should conform to the assignment.

As per breadboxes suggestion the I/O has changed a bit to be more golfy.


Your program must accept input for each pizza (lower case is a literal, uppercase is an argument):


In all of the below: C is the cost for that pizza in drachma (a float), and all units of length are in attoparsecs (~3cm).
C s L - a square pizza, with a size length L
C r D - a round pizza, with diameter D
C o L S - an oval pizza, with long side L and short side R, all ovals have an area of pi*L*S/4 (for some reason).
An empty string denotes that there are no more pizzas.

For each pizza, print out the area in attoparsecs, a literal @ and the cost in Drachma per square attoparsecs (just numbers, units not required).
After the user indicates there are no more pizzas, print the index of cheapest pizza (starting at 1).
Pi may be approximated to 3.1415


An example run would be (&gt; indicates input, &lt; is output, but these don't need to be printed to screen):

&gt; 13.59 r 14.2
&lt; 158.37 @ 0.086
&gt; 14.04 s 12.3
&lt; 151.29 @ 0.093
&gt; 12.39 o 14.1 8.3
&lt; 91.92 @ 0.135
&gt;
&lt; 1


Spaces are optional in output, but the @ symbol must be in the output of the pizza

However, you can't use any traditional loops. Recursion, gotos or list comprehension are all fine, but any thing that is syntactically a loop like a for, while or do ... while are all strictly forbidden.

Shortest code wins.
HTML/JavaScript, 160 bytes

(linebreaks/indentation only added here do prevent scrolling)

&lt;input onchange='window.n++||(n=1,L=1e9);s=this.value.split(" ");d=s[2];
        a=[5.5/7*d*(s[3]||d),d*d][1*(s[1]=="s")];c=s[0]/a;alert(a!=a?m:a+"@"+c);
        L&lt;c||(L=c,m=n)'&gt;


The input is a text box (press Enter to submit); the output is an alert box.

A few caveats (or cheats, if you will):


Pi/4 is 5.5/7
in some cases, it assumes that the pizzas have non-zero areas
it's not possible to enter the same pizza twice in a row (because that won't trigger a change event)
note that defocusing the input also counts as "enter"
assumes that at least one pizza costs less than a billion Drachmas per square attoparsecs
no fault tolerance for the input whatsoever
you could argue that it's not qualified because it uses the browser's event loop