Jump to content



Photo
- - - - -

Is There A Way To Loop Thru A Matrice Faster Than This?


  • Please log in to reply
2 replies to this topic

#1 Dragoneye_XP

Dragoneye_XP

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    FX-9750G Plus

Posted 14 February 2006 - 01:44 AM

Is there a faster way to loop through a Matrix? I'm trying to make an adventure game, but it takes forever to draw a new map.

ALSO: is there a way to get around Casio BASIC's string problem? Someone said you could encode getKey codes and then store them in a variable (I.E., HELLO would be 6536252554->A) but then how would you decode this with a program (and at at least a near-reasonable speed)?

PGRM .MGEN
---------------------------------------------------
Locate 1,1,"+----[ EXOGA ]----+"
Locate 1,5,"---------------------"
For 2 :arrow: W To 4
Locate 1,W,"!"
Locate 21,W,"!"
Next
Locate 1,6,"GENERATING MAP..."
Locate 1,7,"(0 PERCENT)"
{G,H} :arrow: Dim Mat A
For 1 :arrow: A To G
For 1 :arrow: B To H
Intg (Ran#x2)Mat A[A,B]
Mat A[A,B] :arrow: C
If A>1 And B>1 And A<G And B<H
Then C=0=>Locate B,A," "
C=1=>Locate B,A,"#"
IfEnd
Next
Intg ((Ax100)/G) :arrow: D
Locate 2,7,D
Next
Locate 1,6," "
Locate 1,7," "

#2 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 23 February 2006 - 05:23 PM

I don't get what you want to do with this code ... at least not what you explained above.. do you? Could you tell us a little more?

#3 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 24 February 2006 - 10:02 AM

Looping through a matrix shouldn't be a problem. I've made a program that generates a random matrix and draws the map extremely fast, so just drawing the map should be even faster... If you really want it to be instantaneous, the way I did it in one of my games was to draw the whole map line by line, rather than reading the matrix one cell at a time. Though the map is stored twice, it doesn't take up that much more memory.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users