Polyspiral: Difference between revisions

Added XPL0 example.
m (→‎{{header|Phix}}: syntax coloured, added online link)
(Added XPL0 example.)
Line 2,403:
 
var Game = Polyspiral.new(640, 640)</lang>
 
=={{header|XPL0}}==
There is no need for the MOD operator shown in the pseudo code for XPL0's
trig functions because they handle argument angles outside 0 to 360
degrees (2 Pi radians).
<lang XPL0>
def Width=640., Height=480.;
def Deg2Rad = 3.141592654/180.;
real Incr, Angle, Length, X, Y, X1, Y1;
int N;
[SetVid($101); \VESA 640x480x8 graphics
Incr:= 0.;
repeat Incr:= Incr+1.;
X:= Width/2.; Y:= Height/2.;
Move(fix(X), fix(Y));
Length:= 5.;
Angle:= Incr;
for N:= 1 to 150 do
[X1:= X + Length*Cos(Angle*Deg2Rad);
Y1:= Y + Length*Sin(Angle*Deg2Rad);
Line(fix(X1), fix(Y1), N+16);
X:= X1; Y:= Y1;
Length:= Length+3.;
Angle:= Angle+Incr;
];
DelayUS(83_333);
Clear;
until KeyHit;
]</lang>
 
{{out}}
<pre>
https://www.youtube.com/watch?v=p1M2VVY3abM
The actual program looks better and runs under MS-DOS, Windows (with EXPL) and RPi.
</pre>
 
 
=={{header|Yabasic}}==
772

edits