Question from "Test the Whiskers"
parkerparkour
Posts: 7
Hello,
I am following a series of tutorials by Parallax to program my Activitybot. In the Test the Whiskers tutorial there is the following assignment:
Write a for loop with a print call that uses CRSRXY to create this output:
I would really appreciate help with what the code should look like, I am a little stuck. Thanks!
I am following a series of tutorials by Parallax to program my Activitybot. In the Test the Whiskers tutorial there is the following assignment:
Write a for loop with a print call that uses CRSRXY to create this output:
I would really appreciate help with what the code should look like, I am a little stuck. Thanks!
Comments
How to write a FOR/NEXT loop? On page 21, Go to the StartSimple tutorial and try the programming examples, then come back here when you are done.
How to use print? Look at the previous project.
how to use CRSRXY? Study the table on the previous page and look at the example.
Thanks for the response. I think I understand how to use a for loop, a print command, and CRSRXY. What's stumping me is how to combine the components to display the numbers as shown in the picture.
Will do. Thanks!
I would start with the "Try This" example and make changes to it.
As Tom pointed out, what do you notice about the positions for each line? How are they related?
Also, do you see a pattern between the positions and the printed line number?
The upper-left corner of the screen is position 0,0 and increasing values move the cursor towards the lower-right corner.
Great. Thanks.
I tried this (see photo) and did not get the right result. I know I am missing something, most likely with the cursor positioning. Any ideas? Thanks!
To match the screen shot in the first post you want to position the cursor at column 0, row 1 (remember the upper right corner is 0,0) and print the number 1.
Next you want to position the cursor at column 1, row 2 and print 2. Repeat for numbers up to and including 9.
What you program in the last post is doing is print 1 in column 0, row 0.
Then position the cursor in column 1, row 1 and print n. Each value of n (1 through 9) prints at 1,1 overwriting the previous number. You need to fix the arguments of the cursor positioning function.
I would also print n after positioning the cursor (move the n print statement below the cursor statement.
Give it a try, and if you still have problems let us know.
Tom
Very good job but you forgot something.
Look at the position values in the second print statement.
I fixed the position values and it worked. Thanks for the help!
It worked. Thanks!