Casio Progrmming for Dummies

In this lesson IŽm going to tell you a little about some light game programming in the text window. No Getkey functions will be needed.



Lesson 2

  • The first thing you have to be sure of when you are going to start programming a game, is that you have got a good idea of how the game is going to look like and how it will work. DonŽt begin on a game that you are not capable to make.

  • The game example we are going to toggle here, is a rather fun game and very easy.
    IŽv made this game to my 7700g, but now we are going to make a better vesion for the 9750g, 9850g and 9950g serie.

  • The calculater will randomize two number between 0 and 20, youŽr jobb is to guess if the second slotted number is higher or lower than the first slotted number. We will also do some betting, just so that it will be a little more exiting.

  • Now lets begin...

    Start to make new program and name it HI-LOW.
    A good thing to start with, is to set all letter memories to zero.
    0->A~Z
    Now lets make a introduction.
    Locate 6,2,"HIGH OR LOW"
    Locate 7,4,"LESSON 2"
    Locate 6,4,"BY:MARCUS L"_----------------------------------The _ is the -Disp- (little triangle).
    Now set the value for your starting money as below:
    10->D
    Make a label and name it to 4:
    Lbl 4
    Now we are going to make a calculation of the rounds you play (letter memory F).
    F+1->F
    The two slotted numbers:
    Int 20Ran#->A
    Int 20Ran#->B
    To make it inpossible to make bouth the slotted number the same value, type this in:
    A=B=>B+1->B
    Show the first slotted number:
    "FIRST NUMBER:":A_
    And then your money:
    "MONEY:":D_
    Another label:
    Lbl 5
    Then you have to bet: "BET:"?->E
    Make it imposible to cheat,(bet more money than youŽv got or bet no money at all).
    If E>D Or E=0
    Then "CHEATER"_
    Goto 5
    IfEnd
    Now the options,bet on higher or lower
    Type 1 to bet on higher and 2 to bet on lower:
    "1-HIGHER"
    "2-LOWER"
    ?->C
    And now the heart of this code, if youŽr guess is correct:
    C=1=>B>A=>Goto 0
    C=1=>B< A=>Goto 1
    C=2=>B>A=>Goto 0
    C=2=>B< A=>Goto 1
    If you guessed right youŽd told the calculater to jump to label 0.
    In label 0, your bet will be plussed with your money. And 11 will be plussed to your score.
    If your money is higher or equal to 10000 then go to label 6(the winner label), else jump to label 3:
    Lbl 0
    "CORRECT"_
    D+E->D
    G+11->G
    D>=10000=>Goto 6
    Goto 3
    If you guessed wrong youŽd told the calculater to jump to label 1.
    In label 1, your bet will be minussed with your money.
    If your money is lower or equal to 0 then go to label 7(the game over label), else jump to label 3:
    Lbl 1
    D-E->D
    "WRONG"_
    G<=0=>Goto 7
    Label 3, here the correct number will be shown:
    Lbl 3
    "RIGHT NR:":B_
    Goto 4
    The "game over" label: Lbl 7
    "----GAME OVER---"_
    Show how many rounds youŽd playŽd and your final score:
    Lbl 8
    "ROUNDS:":F_
    "SCORE:":F*G_
    Goto 9
    The "winner" label, you will get some bonus here: Lbl 6
    " "
    " YOU ARE RICH"
    " YOU WIN"_
    G+105->G
    Goto 8
    The ending label, this ends the game:
    Lbl 9
    Now the code should look like this:
    Locate 6,2,"HIGH OR LOW"
    Locate 7,4,"LESSON 2"
    Locate 6,4,"BY:MARCUS L"_
    10->D
    Lbl 4
    F+1->F
    20Ran#->A
    20Ran#->B
    B=A=>B+1->B
    "PICKED NR:":A_
    "MONEY:":D_
    Lbl 5
    "BET"?->E
    If E>D Or E=0
    Then "CHEATER"_
    Goto 5
    IfEnd
    "1-HIGHER"
    "2-LOWER"
    ?->C
    C=1=>B>A=>Goto 0
    C=1=>BGoto 1
    C=2=>B>A=>Goto 0
    C=2=>BGoto 1
    Lbl 0
    "CORRECT"_
    D+E->D
    G+11->G
    D>=10000=>Goto 6
    Goto 3
    Lbl 1
    D-E->D
    "WRONG"_
    G<=0=>Goto 9
    Lbl 3
    "RIGHT NR:":B_
    Goto 4
    Lbl 9
    "----GAME OVER---"_
    Lbl 8
    "ROUNDS:":F_
    "SCORE:":F*G_
    Goto 9
    Lbl 6
    " "
    " YOU ARE RICH"
    " YOU WIN"_
    G+105->G
    Goto 8
    Lbl 9

    END OF LESSON 2

    Lesson 3, advanced game programming.