Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 23 Dec 2009 09:33:51 am    Post subject:

If you had a normal "list" in a For statement such as For(I,1,16. and if you displayed the value of I for each loop it would display 1 2 3 4 5.... I have an idea which I am unable to get running. I have a list called OVER. I want to insert into OVER a"0" in places where I do not want to run code in my program. For example OVER might contain 1,0,3,0,5.. NOTE HERE

In the code after my For statement I and after the code I need from you, I have statements like this:

{6,32,8,9,10,3,12,16,6,4,42,7,8,6,7,11}→⌊FN002

Looking at NOTE HERE I want to use the "6" in ⌊FN002 but not the "32" because there is a "0" in OVER. Similarly the"8" but not the "9" The first thing I tried was:

If OVER(I)=0
I+1=I

That does not work.
Back to top
thepenguin77


Advanced Newbie


Joined: 17 Jul 2009
Posts: 72

Posted: 23 Dec 2009 09:54:18 am    Post subject:

You were close on what to do.

If OVER(I)=0
End

Or to optimize:

If not(Over(I
End

This just loops if the number at I is 0.
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 23 Dec 2009 10:51:27 am    Post subject:

I would like you to consider the fact that there is a lot of code after your end statement. It is my view that with the end statement the remaining code in the program will not run.

What say you?
Back to top
thepenguin77


Advanced Newbie


Joined: 17 Jul 2009
Posts: 72

Posted: 23 Dec 2009 11:54:39 am    Post subject:

The End statement only gets acknowledged if the If statement is true. So if the If is not true it skips the End and runs the rest of your program.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 23 Dec 2009 12:24:51 pm    Post subject:

If you just don't want to acknowledge certain results, and since I know your project, and can therefore understand that, then you would need to do like thepenguin77 said, except instead of doing end after that, you need to do this:

For(I,1,16
If Over(I):Then
// Code to check goes here.
End

That way, if Over(I)=0, your code won't run.
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 23 Dec 2009 05:04:02 pm    Post subject:

I am at my daughters for christmas. Without my computer with TI connect. I will test and respond when I get home.
Back to top
Bhaliar


Member


Joined: 16 Nov 2009
Posts: 221

Posted: 26 Dec 2009 01:48:01 am    Post subject:

I'd like to point out that an end code is merely there to stop conditionals. If the conditional is true and coded one way, it will do everything between the conditional and the End, then continue on. If not it goes to the end and continues.
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 26 Dec 2009 11:25:53 am    Post subject:

I already have an "end" at the end of my program. Do I add another?
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 26 Dec 2009 06:55:29 pm    Post subject:

Please show us your code.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 27 Dec 2009 11:29:36 am    Post subject:

A block which uses an End and is arbitrarily placed within the confines of another block would look like this:

:While A≠Z
:code goes here
:Repeat M=N
:code goes here
:End
:code goes here
:End

If you have an End-able section at the tail end of the inside of another section, then two adjacent End's are necessary:

:Repeat N=1
:code goes here
:For(X,1,2
:code goes here
:End
:End

:While I>10
:code goes here
:If K=21
:Then
:code goes here
:End
:End


Last edited by Guest on 01 Jul 2010 09:59:46 am; edited 1 time in total
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 28 Dec 2009 10:21:52 pm    Post subject:

Here is all the code in all it's glory. It skips. However when I input the answer for particular and answer with the correct answer The program responds telling me that I put in the wrong answer. Then the programs displays the same problem in the same location. This time I put in the same answer and the program tells me that was the correct answer.

So here is all the code with some comments. Fire away with questions.

":YOU ROCK:YOU ARE AWESOME:WAY TO GO!:YOU ARE GOOD:"→Str1 // these are the congratulation messages
ClrDraw:CoordOff:GridOff:AxesOff:ZStandard:Full:FnOff:ClrHome:While 0:setup graph screen:End
Output(1,1,"REDUE 2 1
1:prgmCENTEXT // this is a program that randomly select on of these massages each time there is no error
prgmINITPLA1
6→L
prgmPUTO //puts in the "0" in OVER1
Output(1,1,⌊OVER1 // checks to see if it is ok
Pause
ClrHome
For(J,1,dim(⌊OVER1// i do not think this is necessary because OVER1 always has 16 elements
If ⌊OVER1(J)=0 // as requested
End
prgmCLEAR6 // all the clears are just enough spaces to clear a row. In this case row 6 on the graph screen
prgmLA10SMAL // This a small line program that makes all the frames around the flash cards/ problems. There are 10 flash cards on each graph screen
W+1→W
//from here on down until further notice the program lays out all the 16 flashcards. This is where the skipping should take place
{6,32,8,9,10,3,12,16,6,4,42,7,8,6,7,11}→⌊FN002:While 0:FIRST NUMBER IN MATH PROBLEM:End
{20,20,20,20,20,42,42,42,42,42,20,20,20,20,20,42}→⌊FY002:While 0:Y VALUE FOR STARTING POINT OF PROBLEM & LOCATION OF FIRST NUMBER:End
{4,24,43,62,81,4,24,43,62,81,4,24,43,62,81,4}→⌊FX002:While 0:X VALUE FOR STARTING POINT OF PROBLEM & LOCATION OF FIRST NUMBER:End
Text(⌊FY002(J),⌊FX002(J),⌊FN002(J)
{6,32,8,18,20,6,24,1,1,8,42,14,16,12,8,12}→⌊SN002:While 0:SECOND NUMBER IN MATH:End
{26,26,26,34,34,57,57,50,50,57,26,34,34,34,34,57}→⌊SY002:While 0:VERTICAL VALUES FOR SECOND NUMBERS:End
Text(⌊SY002(J),⌊FX002(J),⌊SN002(J):While 0:PRINT SECOND NUMBER:End
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}→⌊SS002:While 0:THIS SETS THE OPERATOR SINE '1' FOR + , '2' FOR - AND '3' FOR X :End
If ⌊SS002(J)=1 // this says that all the sines are + for all the programs in REDUE21
Text(⌊FY002(J)+6,⌊FX002(J)-4,"+":While 0:PRINT +:End
If ⌊SS002(J)=2
Text(⌊FY002(J)+6,⌊FX002(J)-4,"":While 0:PRINT :End
If ⌊SS002(J)=3
Text(⌊FY002(J)+6,⌊FX002(J)-4,"x":While 0:PRINT X:End
// below are the little lines in each flash card that fall below the the two numbers in each flash card
{1,21,40,59,78,1,21,40,59,78,1,21,40,59,78,1}→⌊X1002:While 0:THESE ARE THE START VALUES FOR LINE VARIABLES:End
{33,33,33,33,33,56,56,56,56,56,33,33,33,33,33,56}→⌊Y1002:While 0:VERTICAL VALUES:End
{17,36,55,74,94,17,36,55,74,94,17,36,55,74,94,17}→⌊X2002:While 0:THESE ARE THE STOP VALUES FOR LINE STATEMENTS:End
Line(⌊X1002(J),⌊Y1002(J),⌊X2002(J),⌊Y1002(J)
{12,64,16,9,10,3,12,17,7,4,84,7,8,6,1,1}→⌊AN002:While 0:THE ANSWERS ARE STORED HERE:End
{34,34,34,26,26,49,49,57,57,49,34,26,26,26,26,49}→⌊UD002 //this is the vertical values of the ? mark
Text(⌊UD002(J),⌊FX002(J),"?" // this is the prompt for the child. they should 1) recognize the prompt as a call to action 2) decide on an answer 3) input the correct number from the keyboard and press good 105 in less that 3 seconds so that JONL5 will hold that J number
prgmSTARTIME // here is where the processing of the data begins. Note the ? mark above. This starts the timer
prgmGETNUM1 // this program returns the input from the child and stops the timer
prgmSTEP31 // a list called JONL4 holds all reaction times. If JONL4>3 that is an error condition and JONL5 will hold that value
prgmDISTIME1 // this displays the particular reaction time and the total of all reaction times thus far.
If expr(Str9)=⌊AN002(J) //expr(Str9) is the number returned by the child in GETNUM1 ANOO2(J) is the correct answer
Then
2:prgmCENTEXT // this displays a congratulation message with a correct answer.
Text(⌊UD002(J),⌊FX002(J),⌊AN002(J) // this writes over the ? mark.
Else
// all this stuff below I call the error bucket as opposed to the long times in JONL5
Text(⌊UD002(J),⌊FX002(J),⌊AN002(J) // this line puts in the correct answer
E+1→E // This a carry over which I do not use any longer
prgmCLEAR6
Text(6,0,⌊AN002(J)," NOT ",expr(Str9) // this line tells the child of their mistake
J→⌊JONL1(1+dim(⌊JONL1 // JONL1 holds all the J values where an error occurred
End // this is the end of this the For, next ,else loop
Pause // this pause gives the child a chance to see what has happened in the execution of a particular flash card. They can see reaction time on line 12 of the graph screen and congratulatory messages or error messages on line 6 of the graph screen.
3:prgmCENTEXT //this clears line sis
4:prgmCENTEXT // steps to the next message to be called in the next loop
ClrDraw
End
prgmSUMRED21 // this routine is supposed to Combine JONL1 and JONL5 to make a new value of OVER1 and recall REDUE21. Since the original code has a "0" in space 2 there should be no such value here, but there is. I assume that when we solve the repeating issue this will correct itself.
End// then end :biggrin:
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 29 Dec 2009 11:31:40 am    Post subject:

I have found a bug in REDUE21. I do not know why or how to fix it.

I my initialization Program I did this:

ClrList ⌊JONL5
SetUpEditor ⌊JONL5

The bug centers around this block of code.

For(J,1,dim(⌊JONL4
If 3<⌊JONL4(J
J→⌊JONL5(1+dim(⌊JONL5
End

What it supposed to do is to index JONL5 whenever JONL4 is > three seconds.

Well L4 holds {3,4,4,3,2,3,3, 2,3,3,3,4}

If everything were working correctly JONL5 would hold {2 3 12} because these are the only values where JONL4 is > three seconds.

JONL5 holds{2,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,12}

You can see JONL5 got the first and last numbers correct. I have no idea where this other stuff comes from.
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 30 Dec 2009 07:30:26 am    Post subject:

Is there any suggested test that I can run that will help us find the cause of this problem. For example put a STOP someplace in REDUE21 and look at OVER1, JONL! , JONL4 and JONL5
Back to top
john massey


Advanced Newbie


Joined: 26 Jul 2009
Posts: 50

Posted: 30 Dec 2009 01:52:50 pm    Post subject:

I took my own suggestion and inserted the following code at the end of the loop in REDUE21
If J=5:STOP

I wrote a little program that uses OUTPUT statements to look at the values which exist at the time of the stop instead of messing with it on the home screen. It looks like this:

Output(1,1,"L4 "
Output(1,5,⌊JONL4 // JONL4 holds reaction times. These values are OK for example in my test it contained 4 6 3 3 3
Output(3,1,"L5 "
Output(3,5,⌊JONL5 // JONL5 should contain reaction times > 3 seconds it should contain 1 2
Output(6,1,"L1 "
Output(6,5,⌊JONL1 // JONL1 should contain values where there are errors.
Pause

Here is the little program that relates JONL4 and JONL5. The values in JONL5 were 1 2 2 1 2 1 2. Notice that the first two numbers are the same then two reverse repeats.

For(J,1,dim(⌊JONL4
If 3<⌊JONL4(J
J→⌊JONL5(1+dim(⌊JONL5
End

J→⌊JONL1(1+dim(⌊JONL1 // this the error handler when the child inputs an incorrect answer. It contained 2 3 4 Since J can only have 1 3 5
Something is not working correctly here either.

Please help me. I feel we are very close but I have no idea what can be done.

thanks in advance
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 

Advertisement