| Author |
Create grid with starting value in center
|
M Bryan
Ranch Hand
Joined: Jun 15, 2011
Posts: 57
|
|
Hi,
I want to create a grid with (partially) random values. Lets say the grid looks like this:
The other values should evolve from the values around them, whereas one value is fixed, like this:
The change in value from one field to another should not be bigger than one, but should be randomly. E.g., in the bottom right field there is a 7. The field above has a 6, so it could be 5, 6 or 7. The field to the left has a 7, so the value could be 6, 7 or 8. Since 6 and 7 appear in both list, the value has to be either 6 or 7.
Has anybody a good idea, how i could program this logic?
Thank you!
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10032
|
|
The first steps are always the same.
forget about computers, programming, data structures, etc.
Pretend you have a piece of paper with the above initial grid on it.
How would you tell a child how to do what you want? What steps should they follow?
You LITERALLY need to write this down. Writing it forces you to think through the problem.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
 |
|
|
subject: Create grid with starting value in center
|
|
|