Any luck on getting a design for your project?
Type: Posts; User: Norm
Any luck on getting a design for your project?
None of those last two posts makes any sense to me.
That's it for tonight. Back tomorrow.
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...
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.
These make no sense to me. Can you explain what each of them...
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...
That is wrong. What are those single letter variables?
Why are you writing code before finishing the design?
You'll need the x & y for addbrick()
What are the last two steps for?
where do you compute the x and y values for the locations of the shapes?
Where is the color created?
What are the last two steps for?
I'm asking for the steps in English (pseudo code) that the program needs to do for step#4.
Can you now put together the detailed simple steps for step#4?
Again you are mixing the row and column values with the x and y locations for the shapes.
Finish the steps in the design first before working on the code.
Take a piece of paper and draw the shapes on it as they are supposed to go in the grid.
Label the locations of each shape using the...
What is the purpose of that code?
You're mixing two things together. One variable needs to keep track of the row (or column) and the other needs to be used to locate the shape's x (and y) location...
Can you say in words what the code you posted is supposed to do?
Sometimes there is nothing to be done. The comment: "do things for this ..." was just a reminder and a place holder in case there...
That would be how you would use the loops (see post#26). Outer loop for rows, inner loop for columns.
Do they keep track of the row and column?
Again it looks like you are trying to write code. Where are the steps for #4?
I'd expect something like this:
begin loop to work on a row
do things needed for this row
begin loop to work on...
Do you have the steps the program needs to do now? You keep posting lines of code.
What is the logic for placing the shapes for #4?
Does the GRect constructor take the size? That would be for #3. ...
Ok, I think I get it. The method is supposed to layout shapes on a visual grid. Most of the needed logic is for step #4. Work on the rows one by one using step #6 to get the rows position. On each...
#4 what is a block? what is a grid? At what locations in the grid do the blocks go?
#5 implies the grid is a 2D array. Is that right?
I have no idea what #6 & #7 mean
#8 What is the List...
I have not seen the List of steps the code has to do to solve the problem. Post that and we'll work on the code for each step one by one.
Perhaps the steps you are thinking of are at a too high a...
Writing code before you have a design for what the code is supposed to do usually is a bad idea.
Get the design, then write the code.
The idea of using well named variables is so when you (or anyone) reads the code they can understand what it does. When the coding is finished and is being tossed in the bin who cares what the names...
Often you can code from the list of simple steps.
If you have a list of steps and are having a problem coding any of them, list the step you are having problems with.
With a return statement:...