|
|
For loops in BASIC
Is it possible to do:
for i(X) = s(r) to z(o) ??
So I can use one loop in the code to count for all the variables in
array I(x)?
I haven't even looked into it using C. BASIC gives an error. IT
wants a variable, not an array.
I am working on reprogramming my robot for more intelligent path
planning, more efficient exploring, etc.
Being able to use arrays in for loops would make intelligent
breadth first searches easier.
Rich
aiiadict AT hotmail DOT com
http://rich12345.tripod.com
|
|
0
|
|
|
|
Reply
|
aiiadict
|
9/22/2003 7:02:27 PM |
|
On 22 Sep 2003 12:02:27 -0700
aiiadict@hotmail.com (Rich J.) wrote:
> Is it possible to do:
>
> for i(X) = s(r) to z(o) ??
>
> So I can use one loop in the code to count for all the variables in
> array I(x)?
Not in Applesoft. You might want to consider Zbasic. It is compiled,
has much more control (still doesn't do that loop though) has a 64k
and 128k versions, chained programs with tight variable control and
the docs exist online. Plus, it was re-released as freeware.
> I haven't even looked into it using C. BASIC gives an error. IT
> wants a variable, not an array.
I don't think any of the 8 bit languages can handle this type of loop
but GSoft from The ByteWorks might be able to. It is one of the newest
released languages for the IIGS. Well, there is a Python version but I
have no experience with it.
> I am working on reprogramming my robot for more intelligent path
> planning, more efficient exploring, etc.
> Being able to use arrays in for loops would make intelligent
> breadth first searches easier.
I really think Zbasic would be the best as it's fast, easy to read the
code and very flexible.
--
Cheers,
Phoenyx
Ain't nothing like the clasics!
Apple2 user since March 1984
-={ Apple II Forever }=-
Phoenyx' Apple II page
http://www.dcnet2000.com/~quazar/Apple2
|
|
0
|
|
|
|
Reply
|
Phoenyx
|
9/22/2003 7:30:48 PM
|
|
aiiadict@hotmail.com (Rich J.) asked:
>Is it possible to do:
>
>for i(X) = s(r) to z(o) ??
>
>So I can use one loop in the code to count for all the variables in
>array I(x)?
>
>I haven't even looked into it using C. BASIC gives an error. IT
>wants a variable, not an array.
Applesoft requires a simple variable as a FOR counter.
You can work around this, of course, by assigning the array
value to a temporary counter variable, say IX, and then
(if necessary) re-assigning it back to the array value upon
exiting the loop.
For example:
IX=i(X): FOR IX = s(r) to z(o)
....
NEXT IX: i(X)=IX
Any references that would have been made to i(X) inside the loop
should become IX.
-michael
Check out amazing quality sound for 8-bit Apples on my
Home page: http://members.aol.com/MJMahon/
|
|
0
|
|
|
|
Reply
|
mjmahon
|
9/22/2003 8:52:45 PM
|
|
|
2 Replies
240 Views
(page loaded in 0.048 seconds)
|
|
|
|
|
|
|
|
|