Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 character graphics program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
slimshadyy




PostPosted: Tue Mar 19, 2013 6:27 pm   Post subject: character graphics program

What is it you are trying to achieve?
I am trying to write a program for a character graphics program.

Make an asterisk move down to the right at an angle (row and column must change at the same time). When you reach the last row, make it "bounce" off at the corresponding angle.


What is the problem you are having?
I don't know how to write this program.


Describe what you have tried to solve this problem
Nothing really. Don't know where to begin.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Mar 19, 2013 7:13 pm   Post subject: RE:character graphics program

Well, what is the closest thing that you can refer to? Have you wrote _any_ program? How did you start those?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
slimshadyy




PostPosted: Tue Mar 19, 2013 8:12 pm   Post subject: Re: character graphics program

well this is what i have so far

for i : 20..40
locate (i, i)
put " * " . .
end for

i dont know if thats right. and im not sure what to do next.
Tony




PostPosted: Tue Mar 19, 2013 9:49 pm   Post subject: RE:character graphics program

Not a bad start!

You can check if that's right by running the code, and seeing what it does. If something is off, describe what is wrong in detail. That should give you information about what to do next.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
slimshadyy




PostPosted: Thu Mar 21, 2013 10:34 pm   Post subject: Re: character graphics program

i ran the program and added a delay. but i did 'for i : 1..40' instead and the asterisks moved down diagonally to the right from the top left, but how do i make it go to the top right from that spot? so it looks like it's "bouncing" off the edge.

ohh and whenever i run the program is says at the bottom, "Row of 26 is greater than maxrow (25)"
does that mean i'm doing it wrong?



turing.bmp
 Description:
 Filesize:  1000.05 KB
 Viewed:  100 Time(s)

turing.bmp


Tony




PostPosted: Thu Mar 21, 2013 11:01 pm   Post subject: RE:character graphics program

One step at a time.

The window is sized at 25 rows (max row), so drawing something on row 26 is not well defined. The program chooses to end with a helpful error. You can figure out just how big the window is using the maxrow value instead of guessing at the number yourself.

Going up is similar. You can make a second loop and try to figure out how to make those numbers flow in a different direction.

Edit: you can using color to change the color of asterisks for the second loop, just in case the output from the two loops overlaps.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: