Well I picked up scar again after a bit of other work in c. I decided to tackel bejeweled and have come quite far.
One hindrance is that I am completely unaware for how to pass an array to a function. Let me give you an example.
This is where I declare my arrays. I need to throw those around different places in my program. I also would like to have functions that don't have to be hard-coded for a particular array. Something like...Code:var PixelArray : array[1..8] of array[1..8] of Rectangle; // Coords of gems GemArray : array[1..8] of array[1..8] of Integer; //Colors of Gems Patterns : array[1..3] of array [1..3] of array[1..24] of Integer; //Stores 24 3x3 Patterns RedMask : array[1..8] of array[1..8] of Integer; //Red Mask of Board
Unfortunately, this does not work or so it seems. After searching like mad about pascal arrays on google and in here, I found that arrays passed to functions cannot be static. So I tried..Code:Procedure PrintGemArray(a: array[1..8] of array[1..8] of Integer); var i : Integer; begin for i := 1 to 8 do writeln(inttostr(a[i][1]) + ' ' + inttostr(a[i][2]) + ' ' + inttostr(a[i][3]) + ' ' + inttostr(a[i][4]) + ' ' + inttostr(a[i][5]) + ' ' + inttostr(a[i][6]) + ' ' + inttostr(a[i][7]) + ' ' + inttostr(a[i][8])); end;
Code:RedMask : array of array of Integer; //Red Mask of BoardThis at least gets me into the function, but I get a out of range error on the writeln() part. I'm assuming I have to somehow set the length without making it static, so that it can still be passed to the function?Code:Procedure PrintGemArray(a: array of array of Integer); var i : Integer; begin for i := 1 to 8 do writeln(inttostr(a[i][1]) + ' ' + inttostr(a[i][2]) + ' ' + inttostr(a[i][3]) + ' ' + inttostr(a[i][4]) + ' ' + inttostr(a[i][5]) + ' ' + inttostr(a[i][6]) + ' ' + inttostr(a[i][7]) + ' ' + inttostr(a[i][8])); end;
Any help or pointers would be appreciated. It's very frustrating not being able to move my data around.
Thanks!
Ransom



Reply With Quote







