• Post Reply Bookmark Topic Watch Topic
  • New Topic

Create grid with starting value in center  RSS feed

 
M Bryan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12443
42
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!