### 1. Spiral

```I would greatly appreciate it anyone could send me a small program to
generate a black and white spiral.

Thank you,

John Waldrep
JDWaldo at aol.com
```

### 2. Re: Spiral

```On Sat, 9 Nov 1996, John Waldrep wrote:

>      I would greatly appreciate it anyone could send me a small program to
> generate a black and white spiral.
>

Could you be a little more specific?  What kind of spiral?, How big? How
many turns? How dense?  What are you using it for?

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria
```

### 3. Re: Spiral

```On Sat, 9 Nov 1996, John Waldrep wrote:
>
>      I would greatly appreciate it anyone could send me a small program to
> generate a black and white spiral.

You never gave us any more info, so here's a Black and GREEN 2D spiral:
The general equation for a spiral in polar coordinates is r=theta, which
is x=r*(sin(theta)) y=r*(cos(theta)) in rectangular.  To display this on
the screen, you need to multiply x and y by a size factor and add an
offset shift the coordinate axis to the center of the screen.  In this
example the we're in 640x480x16 color mode, so we add 320 to x and 240 to
y to center the spiral on the screen.

-- spiral.ex
without type_check

include graphics.e
include select.e
include get.e
constant GRAPHICS_MODE = 18 -- VGA
atom size
atom x
atom y
-- switch to graphics screen
if not select_mode(GRAPHICS_MODE) then
puts(1, "needs VGA graphics\n")
abort(1)
end if

-- spiral
for i = 1 to 10 by .5 do --do the spiral is different sizes
size =i
for r = 0 to 80 by .01  do
x=size*r*sin(r)+320 y=size*r*cos(r)+240
pixel(10,{x,y})
end for

--Don't clear the screen the last time.
if i <10 then clear_screen() end if

end for
x=wait_key()

if graphics_mode(-1) then
end if
---------------------------------
see, I didn't go to college for nothing...
It cost me THOUSANDS AND THOUSANDS of dollars...
(yes, I have a math degree)

Michael Packard
Lord Generic Productions
lgp at exo.com http://exo.com/~lgp
A Crash Course in Game Design and Production
http://exo.com/~lgp/euphoria
```

### 4. Re: Spiral

```--=====================_847703058==_

>On Sat, 9 Nov 1996, John Waldrep wrote:
>
>      I would greatly appreciate it anyone could send me a small program to
> generate a black and white spiral.
>

May be you want to do some hypnotism?

The following program draw a rotating spiral.

--=====================_847703058==_
```

### 5. Re: Spiral

```Este es un mensaje multipartes en formato MIME.

--------------379F6CD31019
Content-Transfer-Encoding: quoted-printable

With regards to the request for a spiral program by John Waldrep and=20
following reply by Michael Pack, I attach a short, untidy program, with=20
no type checking or otherwise but produces a simple spiral of different=20
size, turns etc.=20

However, interestingly it will not draw in BLACK! I imagine that this is=20
because BLACK is transparent. Can anybody clarify / confirm this?

Saludos (Spanish for cheers)

P.S. I have only been using Euphoria for the first time last week and am=20
very impressed. So far the only dispointment is the speed of the output=20
of text to the screen and input from the key board. (The buffer fills=20
faster than Euphoria can read it.) I=B4d imagine that this is because it =
is=20
controlled through DOS and not direct. Anybody got a solution or include=20
that might help?

--------------379F6CD31019
Content-Disposition: inline; filename="SPIRAL.EX"

include get.e
include graphics.e

atom check
integer turns,step,size_x,size_y
constant pi=3.141596
constant rad=pi/180  -- To convert from Radians to Degrees when multiplied by

function input(sequence text) -- To print a message a return a number from user
sequence inp,cur
inp={1,0}
puts (1,text)                   -- message on screen
while inp[1] do                 -- repeat until valid number
cur=get_position()              -- back to position if not valid
inp = get (0)
position (cur[1],cur[2])
end while
return inp[2]
end function

-- Main part of program sorry about lazy structuring of the program but I will
-- leave something for you to do

turns=input("Number of spiral turns ")
step=input("\nSpiral steps ")
size_x=input("\nMax size x of spiral (1-320) ")
size_y=input("\nMax size y of spiral (1-200) ")

clear_screen()
integer color,x,y,x_old,y_old

check=graphics_mode(256)
bk_color(BLUE) clear_screen()

color=BROWN       -- I dont know why BLACK dosent work. (Transparent?)
for a=1 to 360*turns by step do
if color=BROWN then color=WHITE else color=BROWN end if --Each step a color

if a=1 then x_old=x y_old=y end if
draw_line(color,{{x_old,y_old},{x,y}})
x_old=x  y_old=y
end for
check=wait_key()

--------------379F6CD31019--
```