|
-
Mar 26th, 2002, 02:05 AM
#1
Thread Starter
Addicted Member
Algorithm problem
I have been fighting to make a clean algorithm see if you can put me on a better path....
A point moves horizontally across the screen starting at an x value of 0 and ending at a x value of 800. As it moves across the screen it crosses say 8 different regions.
So region
1 goes from 0-100
2 goes from 100-200
3 goes from 200-300
4 goes from 300-400
5 goes from 400-500
6 goes from 500-600
7 goes from 600-700
8 goes from 700-800
ok? ok now there is an integer array representing each of these regions int state [8] that is intilized to 0. As the point moves from region 1-2 the first element in the array becomes 1, as it exit 2 and goes to 3 the second element in the array becomes 1 and the first element becomes 2. As it exits 3 and goes to 4, the third element becomes a 1, the second element becomes a 2 and the first becomes a 3. You get the picture?
so it will look like this...
Section 1 2 3 4 5 6 7 8
Value 1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
I have taken a crack at this but I keep coming up with a big mess of variables and for loops, anyone wanna take a psedo code/ c code crack at this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|