@john
I'm typing everything in manually; I wrote the code on a calc, not a computer. Also, the comments aren't meant to be written into the code...
Smile It is really AMAZING to me that you did it all on the calculator! I do not want you to think that I was being critical of your work. I just wanted to report to you how I had modified your code and where I got stuck in the process. Given that you did it on the calculator, can you think of any other syntax you just typed rather than getting it from the keyboard or the catalog, so I can modify my code?

Well, can you tell me what is wrong with the line of code where I am having a problem. Or can you edit my code somehow? Or how shall we proceed? Very Happy

THANKS IN ADVANCE

John
thanks!

well what I'm considering is simply uploading the original code to cemetech (or somewhere else) for you to download. That way you'll get a working version, without the hassle of finding the problem. Only thing is that it'll be a few days, as I'm in the midst of college visits (in California, woot), and won't have access to a computer from which I can upload the program from my calc.

I think I know what the problem is... no quotation mark in front of the seq(1+inString line... my mistake =D
Very Happy When someone is doing me a favor, as you are, while not a particularly patient person , I have over the years, learned that displaying patience is a good thing. I am a few years past college. I will be 79 on saturday! Laughing

THANKS IN ADVANCE

john
well happy birthday in advance =D

so did my suggestion work? removing the quotation mark and commented lines entirely?
Hi D,

Removing the " mark at the beginning of that line sends us to the next line that starts with "sum". Cursor sits on the space at that line of code with an "error:undefined" message.

THANKS FOR ALL YOUR HELP Laughing

john
remove the spaces. you dont need them.
Hi D,

I have taken the liberty to send you the code as I have modified it. I do not however see any inappropriate spaces in the line of code in question.

DelVar Str1
" "→Str1:DelVar L₁:DelVar L₂:DelVar L₃:DelVar L₄:DelVar L₅:DelVar L₆:DelVar N
":Message One:Message Two:Example Text:More Example Text:Even More Text:You Get The Idea:"→Str1:While 0:Following chunk finds all ":" in STRING 1, cell offset by 1. Follow above string syntax:End
{1}→L₁
1:While Ans
Ans→L₁(dim(L₁)+1
inString(Str1,":",Ans+1
End
While 0:Finds "centered" x-coordinate for each substring:End
{3,2,1,5,2,2,5,4,0}→L₆
For(N,1,dim(L₁)-2
sub(Str1,L₁(N+1)+1,L₁(N+2)-L₁(N+1)-1
seq(1+inString("fimstwz",sub(Ans,X,1)),X,1,length(Ans→L₂
sum(seq(1+L₆(L₃(X)),X,1,dim(L₃
iPart((94-Ans)/2)→L₂(N
End
While 0:Generates psuedorandom list of non-repeating integers. Fastest algorithm I could think of. Once you've set your String1, you can run this program up to this point, delete the preceding code, and replace it by re-storing recalled values of L1, L2, and obviously Str1. Theres no point calculating these values every time. I'm sure others can help you with this.
seq(X,X,1,dim(L1)-2→L3
For(N,1, dim(L3
randInt(1, dim(L3→M
L3(N→A
L3(M→L3(N
A→L3(M
Whatever code you want. I'm putting everything within a "While 1: Display Text: Pause: End" loop for now:End
While 1
ClrDraw
While 0:Following chunk is what you need to display the text the "7" can be replaced with whatever y-coordinate you want.:End
L3(L₁(1
Text(7,L₂(Ans), sub(Str1, L₁(Ans+1)+1, L₁(Ans+2)-L₁(Ans+1)-1
L₁(1) +1
Ans - dim(L₃)(Ans>dim(L₃))→L₁(1
Pause
End
at what line do you get an error? anyways, I'm flying home today so I might be able to just email you the original in a few days...


Code:
DelVar Str1
" "→Str1:DelVar L₁:DelVar L₂:DelVar L₃:DelVar L₄:DelVar L₅:DelVar L₆:DelVar N
":Message One:Message Two:Example Text:More Example Text:Even More Text:You Get The Idea:"→Str1
{1}→L₁
1:While Ans
Ans→L₁(dim(L₁)+1
inString(Str1,":",Ans+1
End
{3,2,1,5,2,2,5,4,0}→L₆
For(N,1,dim(L₁)-2
sub(Str1,L₁(N+1)+1,L₁(N+2)-L₁(N+1)-1
seq(1+inString("fimstwz",sub(Ans,X,1)),X,1,length(Ans→L₂
sum(seq(1+L₆(L₃(X)),X,1,dim(L₃
iPart((94-Ans)/2)→L₂(N
End
seq(X,X,1,dim(L1)-2→L3
For(N,1, dim(L3
randInt(1,dim(L3→M
L3(N→A
L3(M→L3(N
A→L3(M
While 1
ClrDraw
L3(L₁(1
Text(7,L₂(Ans),sub(Str1,L₁(Ans+1)+1,L₁(Ans+2)-L₁(Ans+1)-1
L₁(1) +1
Ans-dim(L₃)(Ans>dim(L₃))→L₁(1
Pause
End


btw, I would recommend that you simply enter such code manually into your calc; much less hassle Very Happy
The code that it hang up on is:

sum(seq(1+L₆(L₃(X)),X,1,dim(L₃

THANKS IN ADVANCE

john
could I get your email address, so that I can send you the file? either post it here or say hi to me [url]rthprog@gmail.com[/url]
Why not,

1johnmassey@gmail.com.

THANKS IN ADVANCE

john
and sent. tell me if it works/fails
Hi there,

How was California? First time there?

Well it works just fine!!!!!!! You are really cooking now!!!!

Some nits remain. On the home screen there are an "R" & a "C' on the left edge. What is that? The display of text repeats itself for ever. There needs to be a way to recover the string length for a particular string. May I suggest a user defined list called "SL001" for string length.

THANKS IN ADVANCE

john

Code:
:String "ID" number
:L₁(Ans+2)-L₁(Ans+1)-1


The current code generates the equivalent of "SL001" each time (some minor calculation is necessary), but I would highly suggest that once your messages are in place, you delete that section of the code, replacing it with just the list and string values.

Hmm, I'm not getting the "R" and "C" that you're talking about. could you post a screenshot (picture) of it?

And the text is meant to repeat itself forever. Whatever code contained by "While 1: code : end" is the code you need to display the text, and have the text automatically cycle through the messages pseudorandomly.

california was fun; stanford has a beautiful campus, and we have many family friends close to silicon valley, so I got a chance to talk to many people in computer science/electrical engineering, which I'm considering as a major.
Hi D,

If you look at your code I think you will see two disp statements to account for the R & C characters.

I do not understand this

:String "ID" number
:L₁(Ans+2)-L₁(Ans+1)-1

The current code generates the equivalent of "SL001" each time (some minor calculation is necessary), but I would highly suggest that once your messages are in place, you delete that section of the code, replacing it with just the list and string values.

Can we store the string values in our "SL001" inside the current program?

I want to be able to store the string start and length values in two lists. Once your program gives me the length values I can make another list like"SV001" by starting out with 1 for the first value. Once we have this working we can talk about randomizing the code. If so I will need two list. One list will contain Congressional messages and one to display messages when kids make a mistake like "Oh My dude It should be (correct answer) not (wrong answer)"

I was concerned about knowing when to stop the infinite loop but I figured out I just make the last statement "END". Sorry to be so slow!

If I have missed a curve somewhere along the way, please advise i.e. if we can simply randomize now then let's do it. I expected to have this program outside of my large program and then include the string and list values to print messages. The reason being that I will have large number of programs using this functionality and am concerned about running out of memory. Is there a way to randomize the list with an external program and make it a subroutine?

In my opinion Computer Science is the way to go. Just go to a job site and look at all computer science people who are in demand, then there are one hell of a lot of people out of work! Any person that understands programming as well as you, should be able to do well in this field.

THANKS IN ADVANCE

John

john
Surprised Hi D,

I realized today that you randomized the present code. Sorry to be slow again! but the program is GREAT!! I noticed that you put a ClrDraw statement in the beginning of the last section of code. If we have that in the program it will clear everything else that is going on, on the Graph screen! Their are two solutions to this issue that I know of. 1) In the original code that started with this issue was to calculate what the code author called "pad". It was the number of spaces that the code added on each side of the "message" to fill all of the 94 or 95 pixels on a single line so that the next "message" erases the present "message". 2) put a Text message at the beginning of every pass of of the big loop which is all spaces so that it erase the previous message. I like the first method if it is easy just because it is neat. But it is your call.

I just want just one message with each pass of the big program with it's "for next" loop. How do we modify the code to do this?

THANKS FOR ALL OF YOUR HELP

john
I didn't look too closely at the code, but if you're centering it anyway, you know the width of the text and that the screen is 96 pixels wide. Subtract the text width from 96, divide by 2, round up to the nearest integer, and put that number of spaces and the beginning and that same number at the end of the string. No?
KermMartian wrote:
I didn't look too closely at the code, but if you're centering it anyway, you know the width of the text and that the screen is 96 pixels wide. Subtract the text width from 96, divide by 2, round up to the nearest integer, and put that number of spaces and the beginning and that same number at the end of the string. No?



yeah, only two minor issues I ought to address for john
a.) after the text command, I have 2 lines of code that cycles through the messages. Thus, the clearing-routine would have to be written before that (durr)
b.) Rather than doing


Code:
:"
:For(N,1,Width
:Ans + "
:End


its far faster to do

Code:
:"
:While length(Ans)<Width :Ans + Ans
:sub(Ans,1, Width


to generate a long list of spaces. (btw, replace "Width" with any variable)

btw john, I'll post up some code to help you with that. again, sorry for taking so long, gah
Oh, nice optimization there! I don't know if I would have thought of that.
  
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
Page 3 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement