Computer Science Canada Arrays |
Author: | TokenHerbz [ Sun Sep 04, 2005 8:48 pm ] | ||
Post subject: | Arrays | ||
im trying to make something where if one ball gets to the other side of the map, then another one is made... There a probelem GROWING my array... heres the code so far...
I dont know how do modify the spots of the array, moving stuff, etc.. I keep geting errors, Help me please Thanks |
Author: | [Gandalf] [ Sun Sep 04, 2005 10:40 pm ] |
Post subject: | |
Try learning Flexible Arrays. They allow you to modify the dimensions of your array. |
Author: | Delos [ Mon Sep 05, 2005 10:59 am ] |
Post subject: | |
Additionally, this tut on Records will help you to expedite your code. |
Author: | MysticVegeta [ Tue Sep 06, 2005 1:31 pm ] |
Post subject: | |
[Gandalf] wrote: Try learning Flexible Arrays. They allow you to modify the dimensions of your array.
modify the number of elements of the array. |
Author: | Delos [ Tue Sep 06, 2005 9:23 pm ] |
Post subject: | |
MysticVegeta wrote: [Gandalf] wrote: Try learning Flexible Arrays. They allow you to modify the dimensions of your array.
modify the number of elements of the array. I think Gandalf's also correct on this one. Using 'new' you can alter the dimensions of arrays. Sure when you get up to 2-dim+ arrays, you get screwed up a little in that the 2nd dim cannot be different for each level of the first... I'm not sure I see your argument, unless you specifically mean you cannot change the lower and upper bounds of the array. In that case...bah, technicallity! |
Author: | Flikerator [ Fri Sep 09, 2005 10:40 am ] |
Post subject: | |
I thought you could only change the elements in an array; var numbers : flexible array 1 .. 50 of int or is that what you meant? Because I dont remember anything about adding a second dimension; var D1 : array 1 .. 5 of int var D2 : array 1 .. 5, 1 .. 3 of int |
Author: | Delos [ Fri Sep 09, 2005 9:01 pm ] |
Post subject: | |
Ah, that 'dimension'. My use of the word here was synonymous to the usage of 'elements' also used. Confusion gone. |
Author: | [Gandalf] [ Sat Sep 10, 2005 9:32 am ] |
Post subject: | |
Exactly why I stayed out of this conversation - it's all technicality. He wanted to "grow" his array, flexible arrays do that for you, problem solved. |
Author: | Mr. T [ Sun Sep 25, 2005 5:00 pm ] | ||
Post subject: | Alex's Opinion | ||
For ball on ball collision, you're gonna need work with the radii of the balls.
If the distance between the centre's of two balls is less than the sum of their radii, a collision occurs. (courtesy of Cervantes) |
Author: | codemage [ Mon Sep 26, 2005 11:39 am ] |
Post subject: | |
Look up flexible arrays, as said. In Turing, you can change the size of the array as you go. |