Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 June, 2013, 13:46:06 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: [Axe] Tableau dynamique -  (Read 1692 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« on: 23 October, 2010, 22:42:34 »
0

(Re) bonjour,
J'ai de nouveau un problème pour mon jeu Mario Sokoban
Je charge mes cartes dans des GBD comme ceci :

1
Data(0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,3,3,1,2,0,1,1,1,1,0,0,2,0,1,0,0,1,1,1,0,0,1,0,0,0,0,1,1,1,1)->GBD1
Étant donné qu'il y a plusieurs cartes, j'ai utilisé des condition, comma ça :

1
2
3
4
5
6
7
If L=1
    Data(...)->GBD1
End
If L=2
    Data(...)->GBD1
End
etc ...
Le problème, c'est que quand je lance la compilation, ça marche pas ...
Je ne peux pas utiliser un GBD par map puisque j'ai plus de 10 maps ...
Dans la version TI-Basic de mon programme, à chaque nouveau niveau, j'allais changer la valeur de la matrice [A].
En Axe, je pensais que c'était pareil ... dommage
Comment faire alors ?

Merci d'avance
Cordialement
Jagang
Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #1 on: 24 October, 2010, 17:06:53 »
0

I don't speak French, but using Google Translate I can tell that you seem to be misunderstanding how "->GDB1" works.
(DJ or another French speaker, please translate my response.)
GDB1 etc. are not dynamic like in BASIC. Instead, when you use "->" with them, the data you store to them is placed in the compiled program. To use it like you would in BASIC, you have to use L1 or another place to store your data. However, this does bring up another problem; you still have to store the original data somewhere. You can use one GDB for each map, and you can add another digit to each. (You can use GDB10, GDB56, and so on, and maybe even another, like GDB623. However, I'm not sure about two extra digits.)
Another solution exists, though. If each set of data is the same size, rather than using GDB01 to access the first, GDB02 for the second, and so on, you can use GDB1 for the first, GDB1+56 for the second, GDB1+112 for the third, and so on, storing them like in the code box below. (assuming each set map is 56 bytes) (If you are using it with L like you were above, you could actually just use L-1*56+GDB1 to access the L'th set of data, indexed from 1.)

1
2
3
4
5
6
7
Data(...)->GDB1
.Data for map 1
Data(...)
.Data for map 2
Data(...)
.Data for map 3
.And so on
Thinking over it, I've realized that, if you're using maps, they are static and their content does not change. This means that you won't have to use L1 for that purpose. Rather, you can have a line like

1
L-1*56+GDB1->M
M now contains the address of the map data, and you can index from there. If, however, you would rather use L1 (perhaps for convenience?) you would have to copy the data to L1 like so: (You can use any free RAM area, not just L1)

1
Copy(L-1*56+GDB1,L1,56
Feel free to ask more if you are still confused; I doubt I've clarified everything.
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #2 on: 25 October, 2010, 11:39:30 »
0

Thank you, but, my maps are dynamics...
So, how load my maps in L1 ?

1
Data(0,2,2,2,3,1,4,1,..)->L1
?
Because, I need the same pointer/variable in the main program (where I test if an action is possible).

Sorry, I don't speak English very well (though I should), but it's always better than Google  Translate (I think ...)
Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #3 on: 25 October, 2010, 15:56:54 »
0

Okay. My suggestion was that, instead of, say, L1+5 you use M+5, where M is the pointer to the map created by the code I gave above.
To load the maps into L1, you can use Copy(. For example, to copy X bytes from GDB1 to L1, you can use Copy(GDB1,L1,X).
A more complete line of code was that which was given above:

1
Copy(L-1*56+GDB1,L1,56
This code assumes you store 56-byte maps in the way I suggested in my previous post.
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #4 on: 25 October, 2010, 16:33:59 »
0

Ok, I understand, thank you.
So, I create a Data like that :

1
Data([map 1],[map 2],[map 3] ...) ->GBD1
And to load one map I use :

1
Copy(L-1*128+GDB1,L1,128)
Where L is the level starting at 1 and 128 is the size of the map.
But my maps have different size.
Can I use an other GDB with the size of each map ?
For example :

1
2
Data([map 1, 56],[map 2, 42] ...)->GDB1
Data(56,42 ...)->GDB2
And to load :

1
2
3
4
5
6
0->A
For(I,0,L)
    A+{I+GDB2}->A
End
Copy(A+GDB1,L1,{L+GDB2})
Does it work ?

How to access at the different case of L1 ?
Like GDB ?

1
2
3
4
If {D+L1}=3
    2->{D+L1}
End

Thank you

Jagang

EDIT: Someone know an Axe editor for PC ? Actualy, I use TI-Graph Link 83+ and it hasn't the instruction of Axe.
Personne ne connaitrais un éditeur pour l'Axe sur ordi ? J'utilise TI-Graph Link 83+ en ce moment, mais il n'a pas les instruction d'Axe et en plus il est francisé (Str1 = Chaîne1 ...)
« Last Edit: 25 October, 2010, 16:47:34 by Jagang » Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #5 on: 25 October, 2010, 16:46:04 »
0

GDB2 wouldn't be the size of each map but rather the sum of the sizes of all the maps before it.
So instead of Data(56,42 ...)->GDB2 you would have Data(0,56,98 ...)->GDB2. 98 is 56+42, of course.
To map L indexed from 1 you would then use

1
Copy(GDB1+{L+GDB2-1},L1,{L+GDB2}-{L+GDB2-1})
Note that you'd have to add to the end of GDB2 an extra entry that is the sum of the sizes of all the maps.
You could use your method too, but L should be L-1 in both places where it appears. It will also be somewhat slower Wink

1
2
3
4
5
0->A
For(I,1,L
  A+{I+GDB2-1}->A
End
Copy(A+GDB1,L1,{L+GDB2-1})
This is the fixed version of yours.

What do you mean by "How to access at the different case of L1. Like GDB?"
Edit: You can use TI-Graph Link, you just need to know to use conj( instead of Copy(, expr( instead of Exch(, and so on.
« Last Edit: 25 October, 2010, 16:47:27 by calcdude84se » Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #6 on: 25 October, 2010, 16:57:44 »
0

I prefer my method because I think to use GDB2 for the real size of the map, the size on X and on Y :

1
Data(7,8 |size of the first map| ...) ->GDB2
So, to load :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.Size of the map in X
    {L+BDG2-1 }->U
    .Size of the map in Y
    {L+BDG2 }->V
   
    0->A
    For(I,1,L
        A+{I+GDB2-1}*{I+GDB2}->A

        .To add 2 on each loop
        I+1->I
    End
   
    Copy(A+GDB1,L1,U*V)
No ? I can use a While loop too.
« Last Edit: 25 October, 2010, 17:06:20 by Jagang » Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #7 on: 25 October, 2010, 17:07:21 »
0

Hm... that code is almost good. I think it would be better to use a While loop, though.
Also, there is no "order of operations" and your data for each map is now two bytes.

1
2
3
4
5
6
7
8
9
10
11
0->A
L*2+(GDB2->I)->E
.E is the end of the size data which we're scanning
Repeat I=E
  {I}*{I-1}+A->A
  .No order of operations, so we have to make the multiplication come first.
  I+2->I
  .Add 2
End
Copy(A+GDB1,L1,{E-1}*{E-2})
.I would work too instead of E
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #8 on: 25 October, 2010, 17:11:38 »
0

I don't understand your code, sorry Sad
Can you explain it please ?
Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #9 on: 25 October, 2010, 17:23:19 »
0


1
2
3
4
[b]Edit:[/b] Annoying code tag bug. Try to ignore x.x
Okay :)
So, one line at a time:
[code]0->A
Initialize A, like we've been doing

1
L*2+(GDB2->I)->E
You can store to variable inside expressions. We need I to point to the beginning of the data containing the size, so it is stored.
Since the size data for each map is 2 bytes, we multiply L by 2, then add it to the beginning of the size data to get the end where we stop.

1
Repeat I=E
Just repeat until we reach the end.

1
 {I}*{I+1}+A->A
I points to the X-size of the current map, and I+1 points to the Y-size of it. (I had had I-1, but I fixed it.)
We multiply these to get the total size of the current map, and add it to A. The multiplication comes first because otherwise it would evaluate as (A+{I})*{I+1} and not A+({I}*{I+1})

1
 I+2->I
Add 2 to move on to the next set of data.

1
2
3
End/code]
Finish our loop
Copy(A+GDB1,L1,{E-1}*{E-2})[/code]
A is the correct offset, so we add it to GDB1 to get to the start of the map data.
Alternatively, we could have done GDB1->A at the beginning and just A on this line instead of A+GDB1.
L1 is the destination.
E is the end of the size data we've scanned. The data for the map you're loading is right before it. So {E-1} is the Y-size and {E-2} is the X-size. We multiply those to get the size of the map which we're copying.
« Last Edit: 25 October, 2010, 17:25:33 by calcdude84se » Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #10 on: 25 October, 2010, 17:37:39 »
0

Ok, thank you.
But I have an other problem, yet ...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
0->A
L*2+(GDB2->I)->E
.E is the end of the size data which we're scanning
Repeat I=E
    {I}*{I-1}+A->A
    .No order of operations, so we have to make the multiplication come first.
    I+2->I
    .Add 2
End
Copy(A+GDB1,L1,{E-1}*{E-2})
.I would work too instead of E

.Size of the map in X
{E-2}->U
.Size of the map in Y
{E-1}->V

Fixe 5

0->O
For(A,0,U*V-1)
    If {A+L1}=3
        O+1->O
    End
    Text(45,40
    Text AåDec,{A+L1}åDec
    DispGraph
    Pause 500
End

All case are 2 !!!


1
2
Data(0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,3,3,1,2,0,1,1,1,1,0,0,2,1,1,0,0,1,1,1,0,0,1,0,0,0,0,1,1,1,1)->GDB1
Data(8,7)->GDB2

Why ?
Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #11 on: 25 October, 2010, 17:43:39 »
0

Is L set to 1?
If so, that should work...
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #12 on: 25 October, 2010, 17:48:00 »
0

I add the total code in attachment.

* AMARIOV2.8XP (1.76 KB - downloaded 85 times.)
Logged
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 03:29:30
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #13 on: 25 October, 2010, 18:31:57 »
0

{I}*{I-1}+A→A
You still have the unfixed code in your file. Could you fix it to {I}*{I+1}+A→A and try again? Smiley
Edit: Just tried it; it still says "2"... I'll keep looking.
Edit 2: There was a problem with my code. L*2+(GDB2→I)→E should be L-1*2+(GDB2→I)→E. Trying that now.
« Last Edit: 25 October, 2010, 18:35:13 by calcdude84se » Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Jagang
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 15 February, 2011, 20:37:12
Date Registered: 23 October, 2010, 19:44:09
Posts: 10

Topic starter
Total Post Ratings: 0

View Profile
« Reply #14 on: 25 October, 2010, 23:22:45 »
0

J'ai remplacé {I}*{I-1}+A->A par {I}*{I+1}+A->A mais ca ne change rien.
Puis j'ai remplacé L*2+(GDB2->I)->E par L-1*2+(GDB2->I)->E mais la ca ne fonctionne plus du tout, il n'y a plus qu'une seule case qui s'affiche...
Merci
Cordialement
Jagang

PS : je suis sur mon téléphone donc je suis obligé d'écrire en français.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.367 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.