BBC BASIC for Windows
« Exercise program.. Try it out »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:42pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Exercise program.. Try it out  (Read 576 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Exercise program.. Try it out
« Thread started on: Dec 18th, 2016, 11:01pm »

I think I got all the bugs out of this exercise program. Some procedures and functions are included , as they are part of the tools I use for other projects.

If you have any ideas or if you spot a bug.. please let me know.

I made this because I feel it will help me make goals for exercise and it shows my progress.. So you can watch TV, while you exercise..

https://1drv.ms/u/s!AmYwmTjbmULXk0Ba7p28Wy6B-oa9

As for the additional code... You can ignore it, as the exercise program is the feature.. The rest is just extras that I didn't remove..

The exercise program uses some of the features of the library bellow it.


« Last Edit: Dec 20th, 2016, 01:58am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #1 on: Dec 19th, 2016, 8:19pm »

Quote:
I think I got all the bugs out of this program.

A claim that is very bold. We obviously have different definition of what is a bug and what is a feature!

The Cross reference Utility does not even complete but craps out on line 716. (Actual line as shown in the IDE not a line number or anything like that).

Then any program that has a note of warning like
Quote:
...or your program will freeze and it wont be nice.

does not agree with my definition of bug free. You obviously know it has problems.

Finally, this 'library' that you keep on including isn't a library in the BB4W sense and could never be since it does not conform to the rules for BB4W libraries. As the program is presented there are 10 in line PROC's and FN's that are never called.

I know that you like reinventing the wheel but in this instance you have reinvented a kitchen timer! and used much more code than needed for that simple a function. I just can't see where you are going with this.

Could we induce you to put REM's in the code so we could get a clue as to what you think is going on and what your intentions are?

You may be aware that the speech function is called for either 16 bit or 32 bit Windows. I am not sure if anyone here still uses versions of Windows prior to Windows 2000 so you could probably drop the 16 bit support. (That is the second API which you will find hard even to find documentation on nowadays.)

Is this too direct an answer?

User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Exercise program.. Try it out
« Reply #2 on: Dec 20th, 2016, 12:59am »

The question is... does the program perform on your computer? My computer is windows 10 based and it works fine.

As for the comment that things can go wrong, it isn't about the program, but rather if a person were to try to manipulate the existing program to their needs and didn't follow the layout for "say message :" and "print message :"

If a person were to type:
PROCgr("say hello ") and they didn't end it with : then the voice program would keep looking for more words and overload memory.

Same with print ... it will just endlessly look for more information in the string.

As for the unused code, its just there, as part of the existing library. I could have deleted the functions and procedures that weren't needed and just posted the needed code here. But that would be unnecessary, since it is just a demo.. I don't plan to make it into a commercial product.

As for the cross refrence.. There is so much content in this code, that it will take a long time for me to sort everything out so its perfect. For what I normally present, it works. I tried to put everything within arms length.. Perhaps its inappropriate..

Some code is old and is the same as it was when I started on this forum.

The program was made to help me make goals for exercise.
It has a voice that talks to me and tells me of my progress. It works for me.

And that really is all that matters at this point, as I am uncertain as to the endgame to the project.

I wanted to work as many abilities into this program as I could, so it was an effective tool for me.
« Last Edit: Dec 20th, 2016, 01:12am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #3 on: Dec 20th, 2016, 01:55am »

Quote:
The question is... does the program perform on your computer?
Yes, I use Windows 10 as well. It worked and if that was the only requirement you achieved your aim.
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: Exercise program.. Try it out
« Reply #4 on: Dec 20th, 2016, 02:04am »

Quote:
if that was the only requirement you achieved your aim.


Yes.. the exercise program was the tool I wanted to share. I hope you like it..

User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #5 on: Dec 20th, 2016, 03:36am »

Quote:
I hope you like it..
Not really, I much prefer modern interfaces.

Now about that ":", if you changed the code to this:
Code:
        IF word$="print" THEN
          REPEAT
            wd$= FNword(cmd$)
            build$+=" "+wd$
          UNTIL wd$=""
          PROCpr(lx%,ly%,build$,"15")
        ENDIF
        IF word$="say" THEN
          REPEAT
            wd$= FNword(cmd$)
            build$+=" "+wd$
          UNTIL wd$=""
          PROCspeak(build$,Pitch%,Speed%,Voice$)
        ENDIF
 


then the ":" nor the space is needed and so it won't crash. (And the code is simpler as well.)
Richard's FNword works right up to the end of the string and the final word will be "" if it runs out of characters.

And if you put zero in for the minutes in your program it keeps counting up. Is that a bug?

User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Exercise program.. Try it out
« Reply #6 on: Dec 20th, 2016, 03:53am »

Thanks for that.

Here is the changes I made..
I still need the : because I may want to add more commands after a statement, but if the sentence ends at " then it will work also.

And if you type "0" in the text area, it will just keep waiting for a number. (and it must be larger than the value of 0)

It works well for me..

Code:
        IF word$="print" THEN
          REPEAT
            wd$= FNword(cmd$)
            IF wd$<>":" THEN build$+=" "+wd$
          UNTIL wd$="" OR wd$=":"
          PROCpr(lx%,ly%,build$,"15")
        ENDIF
        IF word$="say" THEN
          REPEAT
            wd$= FNword(cmd$)
            IF wd$<>":" THEN build$+=" "+wd$
          UNTIL wd$="" OR wd$=":"
          PROCspeak(build$,Pitch%,Speed%,Voice$)
        ENDIF
 

« Last Edit: Dec 20th, 2016, 04:52am by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #7 on: Dec 20th, 2016, 05:26am »

Quote:
I still need the : because I may want to add more commands after a statement,


I considered that option but you were not doing that in this program. But if you needed a terminator would it not make more sense to just use a period at the end of the word like normal language rather than a separate 'keyword' word. Just like that last sentence and this one.

Then the terminating condition would be something like:
UNTIL wd$="" OR RIGHT$(wd$)="."

That depends on how FNword works and I don't have the code in front of me.
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Exercise program.. Try it out
« Reply #8 on: Dec 20th, 2016, 12:24pm »

>That depends on how FNword works and I don't have the code in front of me.
Actually, Richard offered it to me as an alternative interpreter tool to my tool..
My tool works similar to Richards, but his is for LBB and is for interpreting a language.

The reason why I don't add extra commands, is to not confuse people, but on my "RETROLIB 3" post, it does use : to separate the commands from the print statements.

And I could use my tool, but Richards was a nice offering that I couldn't pass up.

Also, as the PROCgr command is much like an interpreter, it would be only fitting to use : since it is common in this type of interpretation.

Here is my tool:

Code:
      g$="happy halloween my fellow programmers  "
      REPEAT
        h$=FNnxtwrd(g$)
        IF h$<>"" THEN PRINT h$
      UNTIL h$=""
      END
      DEFFNnxtwrd(c$)
      PRIVATE cnt%
      LOCAL ret$
      cnt%=cnt%+1
      WHILE MID$(c$,cnt%,1)<>" "
        ret$=ret$+MID$(c$,cnt%,1)
        cnt%=cnt%+1
      ENDWHILE
      IF ret$="" THEN cnt%=0
      =ret$
 
User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #9 on: Dec 20th, 2016, 12:57pm »

It still seems to me that the forcing of the space before the ":" is an unnecessary restriction that could be eliminated.

As I said I would have used a period as a terminator and also allowed a question mark as an alternative. That way you could correctly terminate a question in print and get the inflection that the voice synthesizer gives to questions. Then by using the code
Code:
UNTIL wd$="" OR INSTR(":.?",RIGHT$(wd$))>0   
 

you could terminate with a colon, period or question mark with or without a space. Thus giving all the options. It just makes the 'interpreter' easier to use.
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: Exercise program.. Try it out
« Reply #10 on: Dec 20th, 2016, 2:11pm »

Thanks for that.
I will make those changes later on tonight (in about 10 hours).
« Last Edit: Dec 20th, 2016, 2:11pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
xx Re: Exercise program.. Try it out
« Reply #11 on: Dec 20th, 2016, 6:29pm »

I have just noticed that "?" is not in the alphabet list in FNword.
Also Alphabet$ does not need to be retained and so can be LOCAL not PRIVATE.
To be in line with code conventions the local variables are lower case.

Code:
      DEF FNword(RETURN a$) :REM Returns remainder of string having stripped off the first word. 
      LOCAL space$, alphabet$
      alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"+"0123456789:,./?"
      space$ = FNtoken(a$, " ") :REM Removes leading word terminators (spaces) if any.
      = FNtoken(a$, alphabet$) 

      DEF FNtoken(RETURN a$, list$)
      LOCAL t$
      WHILE INSTR(list$, LEFT$(a$,1))
        t$ += LEFT$(a$,1) :REM If character is in acceptance list add it to the word.
        a$ = MID$(a$,2)   :REM remove character from remainder string. 
      ENDWHILE
      = t$
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls