gggmork
If you can make any sense of this post, congratulations

Posts: 2415
Registered: 06-07 |
I "solved" it, but its ugly, copy-pasted hard to reuse code/ not a function. The places where I wrote "//first rotation... //second rotation... etc" seem like a place where similar code should be wrapped into a function. But I guess you can't because arrays suck in functions.
code:
#include "zcommon.acs"
int lights[8] = {96,112,128,144,160,176,192,208};
int f1[15][15] = {
{6,5,4,3,2,1,0,0,0,1,2,3,4,5,6},
{7,6,5,4,3,2,1,0,1,2,3,4,5,6,7},
{7,7,6,5,4,3,2,1,2,3,4,5,6,7,7},
{7,7,7,6,5,4,3,2,3,4,5,6,7,7,7},
{7,7,7,7,6,5,4,3,4,5,6,7,7,7,7},
{7,7,7,7,7,6,5,4,5,6,7,7,7,7,7},
{7,7,7,7,7,7,6,5,6,7,7,7,7,7,7},
{7,7,7,7,7,7,7,6,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}};
int f2[15][15] = {
{0,0,1,2,3,4,5,6,7,7,7,7,7,7,7},
{0,0,1,2,3,4,5,6,7,7,7,7,7,7,7},
{1,1,1,2,3,4,5,6,7,7,7,7,7,7,7},
{2,2,2,2,3,4,5,6,7,7,7,7,7,7,7},
{3,3,3,3,3,4,5,6,7,7,7,7,7,7,7},
{4,4,4,4,4,4,5,6,7,7,7,7,7,7,7},
{5,5,5,5,5,5,5,6,7,7,7,7,7,7,7},
{6,6,6,6,6,6,6,6,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7},
{7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}};
int f3[15][15];
int f4[15][15];
int f5[15][15];
int f6[15][15];
int f7[15][15];
int f8[15][15];
script 1 open
{
//first rotation into f3
int bx = 0;
int by = 0;
int tx = 0;
int ty = 14;
for(by=0;by<15;by+=1)
{
ty=14;
for(bx=0;bx<15;bx+=1)
{
f3[ty][tx] = f2[by][bx];
ty-=1;
}
tx+=1;
}
//second rotation into f4
tx=0;
for(by=0;by<15;by+=1)
{
ty=14;
for(bx=0;bx<15;bx+=1)
{
f4[ty][tx] = f3[by][bx];
ty-=1;
}
tx+=1;
}
//third rotation into f5
tx=0;
for(by=0;by<15;by+=1)
{
ty=14;
for(bx=0;bx<15;bx+=1)
{
f5[ty][tx] = f4[by][bx];
ty-=1;
}
tx+=1;
}
delay(100);
int y=0;
for(y=0;y<15;y+=1)
{
print(d:f5[y][0],d:f5[y][1],d:f5[y][2],d:f5[y][3],d:f5[y][4],d:f5[y][5],d:f
5[y][6],d:f5[y][7],d:f5[y][8],d:f5[y][9],d:f5[y][10],d:f5[y][11],d:f5[y][12
],d:f5[y][13],d:f5[y][14],s:" ",d:y);
delay(35);
}
}
|