Parallel Lines Illusions: Very Tricky!!!

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2004
Posts: 6
Reputation: Eclipse is an unknown quantity at this point 
Solved Threads: 0
Eclipse's Avatar
Eclipse Eclipse is offline Offline
Newbie Poster

Parallel Lines Illusions: Very Tricky!!!

 
0
  #1
Nov 4th, 2004
Okay, if I could, I would shoot my CS teacher, and then shoot myself.

Reality check. Done.

Anyways, check out this yucky program right here...I don't even know where to begin...we need to create a new drawing pad; and by using two methods, we would have to create this illusion image by using only parallel lines and shaded "rectangles". Here's the link to the assignment, since I can't copy or save his files:

Click on Assignment dated 10/25/04, practice with For Loops

Username: cs2
password: 89106

I know I'm asking you guys to go through alot, but I really need help on this. This is a challenging program, and most of the older kids in my class are having BIG trouble solving this assignment...

I'm going to work on it now and see what stuff I can come up with. But please, if you got spare time, take a quick look at the program and see if you can help. Thanks ALOT!!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 765
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: Parallel Lines Illusions: Very Tricky!!!

 
0
  #2
Nov 8th, 2004
Given the date of the assignment, I think I can assume that it's already been due so I suppose I could try and answer it.
I kind of mixed basic and c++ code structures, but I think something like this would work. The only slightly tedious part is the row's offset. It's just nested loops, nothing really tricky here.

  1. offset = 0
  2. flag = 0
  3. for y = 0 to 7
  4. for x = 0 to 13 step 2
  5. pen.setPosition(x*40 + offset,y*40)
  6. pen.fillRect(40,40)
  7.  
  8. pen.setPosition(0 ,(y+1)*40)
  9. pen.drawLine(0,endOfScreen)
  10. next x
  11. //determine whether to increase or decrease the offset of the row
  12. //offsets by 3 each time
  13. if flag = 0 and offset = 6
  14. {
  15. flag = 1
  16. }
  17. if flag = 1 and offset = 0
  18. {
  19. flag = 0
  20. }
  21. if flag = 0 then offset += 3
  22. if flag = 1 then offset -= 3
  23. next y

As for the circles, I don't know what its suppose to look like.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 6
Reputation: Eclipse is an unknown quantity at this point 
Solved Threads: 0
Eclipse's Avatar
Eclipse Eclipse is offline Offline
Newbie Poster

Re: Parallel Lines Illusions: Very Tricky!!!

 
0
  #3
Nov 8th, 2004
Hmm...thanks for replying JUST in time. Luckily, this is due tomorrow, so at least I got some help for now.

I got the circles part myself...lemme see if your code works, Phaelax. and Thanks ALOT!! ^^
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC