Re: brain teaser

new topic     » goto parent     » topic index » view thread      » older message » newer message

<html>
<font face=3D"arial" size=3D2>col22 wrote:<br>
&gt;Fill in the missing condition to make the code find if <br>
&gt;the angle &quot;ang&quot; is within the given range minang to
maxang.<br>
&gt;minang =3D playera - veiwang / 2<br>
&gt;maxang =3D playera + veiwang / 2<br>
&gt;if xxxxx missing condition xxxxx then <br>
=A0&gt;=A0 blah<br>
=A0&gt;=A0 blah<br>
&gt;end if<br>
<br>
</font><font size=3D3>looks to me like you need the &quot;range&quot;
function...<br>
<br>
<br>
function range(atom testvalue, atom lower, atom upper)<br>
&nbsp;&nbsp; return (lower&lt;=3Dtestvalue) and (testvalue&lt;=3Dupper)<br>
end function<br>
minang =3D playera - veiwang / 2<br>
maxang =3D playera + veiwang / 2<br>
if range(ang,minang,maxang) then <br>
=A0 blah<br>
=A0 blah<br>
end if<br>
<br>
since you are using the function in an if..then, it cannot operate<br>
(easily) upon sequences, however, it can be easily adapted to<br>
work with sequences and objects (just change the declarations<br>
from atom to object)<br>
the conditional testing would change tho, as you would be<br>
returning sequences of true/false values...<br>
<br>
HTH, take care--Hawke'<br>
<br>
</font></html>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu