The 2nd Monitor

General discussion about codereview.stackexchange.com - Welcom...
Apr 26, 2014 20:59
I am soooooo noob at this
Apr 26, 2014 20:59
hmm thanks for the help guys
Apr 26, 2014 20:55
so i have to keep track of both x an dy?
Apr 26, 2014 20:55
awesome
Apr 26, 2014 20:53
lol
2
Apr 26, 2014 20:53
it says Access violation writing location 0x00430045.
Apr 26, 2014 20:53
nvm
Apr 26, 2014 20:52
that is making it work
Apr 26, 2014 20:52
Block **zeroblocks = new Block*[16];
Apr 26, 2014 20:52
oh wait
Apr 26, 2014 20:50
for 1 D
Apr 26, 2014 20:49
it's 16 max
Apr 26, 2014 20:49
I know the size
Apr 26, 2014 20:49
oh ok
Apr 26, 2014 20:48
x and y
Apr 26, 2014 20:48
i mean indices
Apr 26, 2014 20:48
I don't know what to do anymore.. now what I have to do is randomize the address of the block[x][y]
Apr 26, 2014 20:47
i know this is so sad
Apr 26, 2014 20:45
It's saying that A value of Block* can't be assigned to Block**
Apr 26, 2014 20:44
zeroblocks[16] = blocks[x][y];
Apr 26, 2014 20:44
Block **zeroblocks[16];
Apr 26, 2014 20:44
here is what I am thinking
Apr 26, 2014 20:44
anyway,
Apr 26, 2014 20:44
it's due in 2 days...
Apr 26, 2014 20:43
so here is what I am thinking
Apr 26, 2014 20:43
T.T
Apr 26, 2014 20:43
^I do, but I can't use them and it's too late
Apr 26, 2014 20:41
^kind of. But I want to store the memory address of those blocks with 0 score in a 1d array. So then, I can easily change the scores of those zero scored blocks to a random score.
Apr 26, 2014 20:39
and I decided to use 2 D coz it would make my procedure a lot easiers
Apr 26, 2014 20:39
well, I was using 1D array of poiters
Apr 26, 2014 20:37
No, this is my final project
Apr 26, 2014 20:36
and setting a value to the block that has zero as score
Apr 26, 2014 20:36
i am passing that blocks to the addOneRandom(Block ***blocks)
Apr 26, 2014 20:35
Block ***blocks;
blocks = new Block** [MAX_BLOCKS];

//Create the rows and draw the pieces
for (int i = 0; i < MAX_BLOCKS; ++i)
{
blocks[i] = new Block*[MAX_BLOCKS]; //Create the rows

for (int x = 0; x<MAX_BLOCKS; ++x)
{
blocks[i][x] = new Block(); //Create the cols
blocks[i][x]->setSize(WIDTH / 8);
blocks[i][x]->setRandom();
blocks[i][x]->setXY(BLOCK_WIDTH + x*(BLOCK_WIDTH * 2), BLOCK_WIDTH + i*(BLOCK_WIDTH * 2));
}
}
Apr 26, 2014 20:35
I don't want to restart everything
Apr 26, 2014 20:35
I am at halfway though
Apr 26, 2014 20:35
i know i am a freshman at college and I don't even know what I am doing anymore
Apr 26, 2014 20:34
Oh yea
Apr 26, 2014 20:33
anyway, the debugger says that Unable to Access memory. something must be wrong
Apr 26, 2014 20:32
it's supposed to be zeroblocks[index]
Apr 26, 2014 20:32
void addOneRandom(Block ***block)
{
Block *zeroblocks[16];
int count = 0;

for (int i = 0; i < MAX_BLOCKS; ++i)
{
for (int x = 0; x<MAX_BLOCKS; ++x)
{
if (block[i][x]->getScore() == 0)
{
zeroblocks[i] = block[i][x];
count++;
}
}
}
int index = randomBetween(0, count);
zeroblocks[0]->setRandom();
}
Apr 26, 2014 20:32
oh sure
Apr 26, 2014 20:31
C++
Apr 26, 2014 20:31
an di don't know how to
Apr 26, 2014 20:31
and i am assigning the memory address to a variable
Apr 26, 2014 20:30
ok so i have 2D arrays of pointers
Apr 26, 2014 20:28
They are killing me atm
Apr 26, 2014 20:28
can anyone help me with pointers?
Apr 26, 2014 20:28
hey dere
 
Apr 26, 2014 20:27
Hello