Weekly Qbasic and Qb64 Lesson Topics
April 19, 2024, 06:33:04 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

What I have so Far,Learning program

Pages: 1 [2]
  Print  
Author Topic: What I have so Far,Learning program  (Read 1659 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #15 on: June 12, 2011, 02:34:00 am »

No no offense taken, and I appreciate the efforts  to explain, I though you knew, my math level is of about the 4th grade level, I did read in one tutorial, it said one needs, at least trigonometry, to get any where with programming code. After all said and done, I agree, my best route would be to not only study the tutorials more, but look for some tutorials on symbols and math, Although I am sure most of what you are saying could be understood by someone with algerbra, and a college level of schooling,..for me it is pretty much just numbers and symbols,I don't think I will ever grasp enough of this, for it to be worth yours or anyone elses, time and trouble, to try to explain,...
Code:
         CLS


DO
    WIDTH 40
    PRINT "Press the LETTER please"
    z = INT(RND * 26) + 66
    PRINT CHR$(z)
    '-------------------------------------------
    WHILE Letter$ <> CHR$(z)
        INPUT "Letter: ", Letter$ '//// somewhere in here, I want it to print "sorry, that is not the correct letter, try again " if the letter is not correct

        Letter$ = UCASE$(Letter$)

        IF UCASE$(Letter$) <> CHR$(z) THEN
            PRINT "Wrong ,you wrote "; Letter$; " Please Try again "; CHR$(z)
        END IF
    WEND

    WHILE Letter$ <> CHR$(z)
        INPUT "Letter: ", Letter$
        Letter$ = UCASE$(Letter$)
    WEND
    PRINT " Good You wrote "; Letter$
    _DELAY 1
    CLS
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM
I was trying to say I did understand that <> is significant to not equal too,...
The rest I don't, all it gave me was a bunch of letters and numbers,...With the above,  that is all I needed,... and thanks,..but anyway, I have given up on tyng to understand all of this,...it is never going to make any sense to, me perhaps, as suggested, studying the tutorials, and maybe some math,..one day,..But until I learn enough, to understand, the answers to my questions, then I best not ask, and if I understand that much, I probably won't need to ask. I don't even know enough to ask a question,...sensibly.
 But thank you very much for all the time, and trouble trying to teach me,...I do appreciate that, even though it was a hopeless task.
from Garry
Report Spam   Logged

guest
Guest
« Reply #16 on: June 12, 2011, 03:12:33 am »


     
Quote
I did read in one tutorial, it said one needs, at least trigonometry, to get any where with programming code.
That may ot neccesarily be true, but the math is helpful.
    I rewrote your code to this
Code:
SCREEN 12

WIDTH 40
CLS

DO
  PRINT "Press the LETTER please"
  z = INT(RND * 26) + 66
  PRINT CHR$(z)
  '-------------------------------------------
  WHILE Letter$ <> CHR$(z)
    INPUT "Letter: ", Letter$ 'somewhere in here, I want it to print message if the letter is not correct
    Letter$ = UCASE$(Letter$)

    IF Letter$ = CHR$(z) THEN
      PRINT " Good You wrote "; Letter$
    ELSE
      PRINT "Wrong ,you wrote "; Letter$; " Please Try again "; CHR$(z)
    END IF
  WEND

  _DELAY 1
  CLS
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM

   
« Last Edit: September 11, 2011, 07:02:13 pm by GarrisonRicketson » Report Spam   Logged
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #17 on: June 15, 2011, 12:46:14 am »

Code:
SCREEN 12

WIDTH 40
CLS
COLOR 15: LOCATE 10, 12: PRINT SPACE$(20)
COLOR 14: LOCATE 10, 12: INPUT "Enter your Name: ", name$
IF UCASE$(name$) = UCASE$(name$) THEN PRINT "Hello "; name$; " Hope you enjoy this little program "


DO

    COLOR 14, 2
    PLAY "2a4g8e12g4a4a"
    PRINT "Press the LETTER please"
    az = INT(RND * 26) + 65
    PRINT CHR$(az)
    '-------------------------------------------
    WHILE Letter$ <> CHR$(az)
        INPUT "Letter: ", Letter$ 'somewhere in here, I want it to print message if the letter is not correct
        Letter$ = UCASE$(Letter$)

        IF Letter$ = CHR$(az) THEN
            PRINT " Good "; name$; " You wrote "; Letter$
        ELSE
            PRINT "Wrong ,you wrote "; Letter$; " Please Try again "; CHR$(az)
        END IF
    WEND

    _DELAY 1
    CLS
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM   
From Garry
« Last Edit: June 15, 2011, 12:48:33 am by GarrisonRicketson » Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #18 on: September 11, 2011, 07:08:14 pm »

Actually this never made much sense to me,..but it might to some one else.

 
Quote
           LETTER DROP
   So now that we have the skeleton of code that holds our data (A-Z) we now come to the choice of methods we
1] display them
2] monitor any keyboard entry
3] results at program end.

1]   If we use SCREEN 12 then we know that we have 30 rows. So if we create a variable that holds the row we increment it upward until its equal to 30 and at that point we end this particular letters journey. Next we select the next letter in our array and reset our variable that holds the row back to 1. The process repeats. While this is happening we need to decide how much time our letter is displayed before it drops down a line. Probably best is a time that starts slow and speeds up. We probably want between 5 to 10 seconds of total falling.

2]   When we monitor the keyboard we have several options. Input , Inkey or _keydown.
   a] Input - program execution stalls and waits for a keypress and enter.
   b] Inkey allows execution to continues but we have to remove keys from the buffer
   c] _Keydown allows execution to continue and doesnt care about the buffer being full or empty

3]   We need to connect right and wrong attempts to the existing 26 items of data. Idealy we could use another 2 arrays (parallel) to our Alphabet array to record both correct and incorrect attempts. At program end we could display back the wrong or right or both letters and their totals. This also allows us to "track" the users efforts and later to recommend them what are their faults. And obviously these would allow us to monitor the programs execution.

   So clearly here there are 3 things that need to be done simultaneously. And all of this needs to repeat. This needs to repeat until the user exhausts all of the correct options or gets bored and wants to exit. So lets write some psuedo code to describe this.

Do
  Locate and Print selected Letter
  Monitor keyboard
  If keyboard data compare it to existing game data
  If key data right or wrong record it
  Increment Row , Timer period , wrong attempts
  If a letter sequence has been completed reset for next letter
Loop until Correct = All OR _keydown = ESCAPE   
 
Report Spam   Logged


Pages: 1 [2]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy