# Making a method to move blocks in a grid

Show 40 post(s) from this thread on one page
Page 3 of 3 First 123
• May 21st, 2012, 08:22 PM
Norm
Re: Making a method to move blocks in a grid
That is wrong. What are those single letter variables?
• May 21st, 2012, 08:29 PM
geforce
Re: Making a method to move blocks in a grid
Quote:

Originally Posted by geforce
for every row equal to 0 to BLOCKROWS
for every column equal to 0 to NBLOCKS
create x and y to compute location
create colour
create row
create column
perform i * j
add (i * j) to list
return the list

Do you mean the variables in i and j?

if so i is the row and j is the column ohhh, so

create row
create column
• May 21st, 2012, 08:32 PM
Norm
Re: Making a method to move blocks in a grid
create x and get y to compute location ????

create i
create j
perform i * j
add (i * j) to list

None of the above makes any sense to me. If i and j are the loop variables, what does "create" mean?
• May 21st, 2012, 08:35 PM
geforce
Re: Making a method to move blocks in a grid
for every row equal to 0 to BLOCKROWS
for every column equal to 0 to NBLOCKS
create x
create y
create colour
perform row * ROWSEPARATION + ROWZERO
perform column * BLOCKWIDTH
return list
• May 21st, 2012, 08:39 PM
Norm
Re: Making a method to move blocks in a grid
Quote:

create x
You would compute the value of x outside the inner loop because it would apply to all the shapes being created in the inner loop.

Quote:

perform row * ROWSEPARATION + ROWZERO
perform column * BLOCKWIDTH
These make no sense to me. Can you explain what each of them means?
• May 21st, 2012, 08:42 PM
geforce
Re: Making a method to move blocks in a grid
Is Y also computed outside the loop?

It says that:
The i'th row of blocks has its upper edge aligned with i (row) * ROWSEPARATION +ROWZERO.

The j'th column of blocks has its left edge aligned with j (column) * BLOCKWIDTH

since the column depends on the row , row + column would be the answer
• May 21st, 2012, 08:47 PM
Norm
Re: Making a method to move blocks in a grid
Quote:

Is Y also computed outside the loop?
How can it? It is where the shapes go on the current row.

Look at the drawing you made of the grid you are building. See how the values of the locations where each shape goes relates to the row and column and how the values of the uppercase constant variables determine where the next shape goes.
• May 21st, 2012, 08:53 PM
geforce
Re: Making a method to move blocks in a grid
When row is at 0 the row goes to 50
When column is at 0 the column goes to 0

When row is at 1 the row goes to 100
When the column is at 1 the column goes to 50

The row is always ahead of the column by 50 atleast so no errors would occur
• May 21st, 2012, 09:00 PM
Norm
Re: Making a method to move blocks in a grid
None of those last two posts makes any sense to me.

That's it for tonight. Back tomorrow.
• May 21st, 2012, 09:01 PM
geforce
Re: Making a method to move blocks in a grid
sigh... -.-
• May 22nd, 2012, 07:00 AM
Norm
Re: Making a method to move blocks in a grid
Any luck on getting a design for your project?
Show 40 post(s) from this thread on one page
Page 3 of 3 First 123