Jump to content



Photo
- - - - -

ClassPad Programming


  • Please log in to reply
10 replies to this topic

#1 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 24 September 2003 - 02:59 PM

This topic is for disscusing classpad programming, it will be to help out new classpad users (which is just about everyone at the moment) and it will provide a place for programmers to discus new techniqes they have discovered.

I'll start off by talking about all the uses I have found for the # operator.

description: # is used to take the contents of a string and treat it as a variable.

Example:
"pict1"=>var
StoPict #var

could be written
StoPict pict1

and have the same effect.

this allows us to dynamically creat variables, weather from user input or something generated in the code.

Uses:

1) one of the simplest and most practical uses is for storing pictures, as in caspaints layers, you can the user enter a name for their pict then store that picture with the name they entered. this is true af just about any kind of storage.

2) super lists: I havent done this one yet, but it will work. say you want to use a matrix to store strings, but matrixes can only hold numbers... well, if not for the # operator you'd be screwed, but say you used this:

{"row1","row2","row3","row3","row4","row5"}=>Mat
for 1=>t to 5
Mat[t]=>tmp
{"","","","",""}=>#tmp
Next


Now do you know what you've got? you have a list inside each cell of another list, a matrix! Here is a function you can use to store values to it:


Name:StoMat, Parameters: name,x,y,var
local name,x,y,var,tmpmat,rowname,tmprow
lbl StoMat
#name=>tmpmat
tmpmat[y]=>rowname
#rowname=>tmprow
var=>tmprow[x]
tmprow=>#rowname
Return

cool eh? you can use a similar function to recall values:

Name:RclMat, Parameters: name,x,y,var
local name,x,y,var,tmpmat,rowname,tmprow
lbl StoMat
#name=>tmpmat
tmpmat[y]=>rowname
#rowname=>tmprow
tmprow[x]=>#var
Return

this stores the returned value into the variable in var, so you can specify where you want it.

3) 3 dimentional matrixes: using the list in a list technique you can also create 3 dimentional matrixes, you just make the contents of the "row" cells also lists.

4) Object oriented programming: I cant think of a way to properly explain this, basically it uses the # to create new variables, these variables could be used as a "class", heres a small example:
say you generated this list with your code:


{Name,Lvl,X,Y}=>#Class //Class is currently "Player"

you could change the value of Class and generate a new "Player" type list, with its own values, and as long as you kept track of them in a list or something you could have as many as you want :)

see what I mean?

I'm sure theres more I havent thought of yet, but when I do I'll post about it B)

#2 Lovecasio

Lovecasio

    Casio Freak

  • Members
  • PipPipPipPip
  • 242 posts
  • Location:Hochiminh city Vietnam
  • Interests:Organic chemistry.<br />Pharmacy

  • Calculators:
    fx 570 MS, Casio AFX 2.0+, ClassPad 300

Posted 27 September 2003 - 09:40 AM

It is great, now I can know more about #.
CrimsonCasio, could you please tell me how to use Switch...Case command
Oh, did you see that the classpad take long time to draw function
y=log(a,x); y=sqrt(x)... , the function that have domain? Should it be told to Saltire :unsure:

#3 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 29 September 2003 - 06:36 PM

The switch statement is good for menus, here is the sentax:
Switch var
Case # //means if var=# then execute folowing code
...code...
Break //if you leave out the break it will execute the next Case regardles of what the # is
Case #
...Code...
Break
Default //occures if none of the above cases are true, or if the case above is executed and does not contain a break
...code...
SwitchEnd

note that all the case statements are optional and so is the default statement, you can also have as many cases as you want. the #'s must be numbers, not equations or anything esle.

as for the other question, I dont really understand, thought I will tell brian what you said.

#4 Lovecasio

Lovecasio

    Casio Freak

  • Members
  • PipPipPipPip
  • 242 posts
  • Location:Hochiminh city Vietnam
  • Interests:Organic chemistry.<br />Pharmacy

  • Calculators:
    fx 570 MS, Casio AFX 2.0+, ClassPad 300

Posted 30 September 2003 - 01:39 AM

Thankyou very much. Now I can make a menu withough using If..Then command. Before, I try to use Switch...Case command, but I did not input Break, so it went in the wrong way ( not as I expected).
The other question I ask you is why the Classpad take more time to draw function y=log(a,x), y=sqrt(x)... and it requires more time to make Table (in graph mode). There are also some command that Classpad take more time to perform than the AFX 2.0+.
Thanks again.

#5 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 30 September 2003 - 01:55 AM

I'm not sure, I'll ask arround, mabey SoftCalc knows.

#6 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 16 October 2003 - 05:31 PM

about slow things on the classpad:

brian is making a list of all the things which take to long on the classpad so if you have any examples please post them.

one thing I found is the matrix system, when creating a 25x25 matrix with [[0,0,0,0,0...][...]...]=>mat the classpad takes about 30 seconds, which is fine. but try to access a cell in the matrix, I timed it at 3 minutes before giving up! all I was doing was mat[22,6]=>A ! on my CFX it was instant!!!!! whats up with that! :angry:

#7 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 16 October 2003 - 09:21 PM

is it possible to speed up the
{54,56498,49,65,89,156,489,...}->... (store speed : it takes a lot of time especially when there are list commands like that over XX KBytes...)

when there are numeric values AND strings in the same list, the access time is too long.

#8 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 16 October 2003 - 09:27 PM

you may be correct, I havent done a speed test on that... :(

#9 BiTwhise

BiTwhise

    Casio Overgod

  • [Legends]
  • PipPipPipPipPipPipPip
  • 627 posts
  • Gender:Male
  • Location:Guildford, Surry, UK
  • Interests:Programming, games, consoles, martial arts

  • Calculators:
    FX9700WE, CFX9970G, AFX2.0, Classpad 300

Posted 17 October 2003 - 01:03 PM

the classpad uses some sort of linked list for storing list vars, hence the great versatility of the lists, but it really kills your performance.
it would be nice to have some sort of fastlist type (a list in which each element is of static size, and of the same type.. )
anyways, that's not likely to happen :(

#10 Lovecasio

Lovecasio

    Casio Freak

  • Members
  • PipPipPipPip
  • 242 posts
  • Location:Hochiminh city Vietnam
  • Interests:Organic chemistry.<br />Pharmacy

  • Calculators:
    fx 570 MS, Casio AFX 2.0+, ClassPad 300

Posted 18 October 2003 - 11:08 AM

CrimsonCasio, what happened with your site? I have tried alot, but I cannot access any thing on it.
By the way, could you please tell me how to contact Saltire?
Thanks. :greengrin:

#11 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 18 October 2003 - 02:10 PM

my web sit is currently down and being moved, I'll let you know when it is up and running again.as for contacting Saltire I think its better if you tell me what you want to ask, then I can include it with my dayly coorespondence, after all we dont want to spam them ;) . if you feel that you need to talk directly to brian then i will ask him if its ok, but otherwise I think this way is best.

On the other hand, he reads these post and may send you a response to any questions you ask here :)


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users