05. november 2002 - 11:59
#9
hmm, jeg skal lige bruge et råd igen...
Her er en del af min kode:
static int*** newBlock(int r){
switch(r){
case 0:{
int*** temp = new int*[4][4]
{ { {1,1,0,0},{1,1,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} } };
return &temp;
det virker ikke, hvad skal jeg gøre
06. november 2002 - 09:21
#12
Hmm, det ser ikke just kønt ud, hvad med noget lign.:
class Blocks
{
public:
const static int nSquareRotations[4][4][4];
const static int nRectangleRotations[4][4][4];
// Osv...
};
const int Blocks::nSquareRotations[4][4][4] =
{
{ {1,1,0,0},{1,1,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
};
const int Blocks::nRectangleRotations[4][4][4] =
{
{ {1,1,0,0},{1,1,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
, { {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0} }
};
int*** Func(int r)
{
switch(r)
{
case 0:
return (int***)Blocks::nSquareRotations;
case 1:
return (int***)Blocks::nRectangleRotations;
default:
return 0;
}
}