M
MagnusTT
Guest
Hi!
I'm pretty new to the program, and I've been stuck for a few days trying to get this simulation to work. Here is what I'm trying to do:
It's a simulation of birch trees, pine trees, and grass. There is a 4 x 4 grid (16 boxes). The top 4 boxes contain birch tree objects, the bottom 4 boxes contain pine tree objects, and the middle 8 boxes contain grass objects. Here are the rules of the simulation:
Since there are no actual collisions happening between the tree and grass objects, I'm struggling with how to have my 16 different objects change states by identifying what is next to them and then running the 40%/60% random chance to see if it converts the object next to it. I also don't want all the calculations to happen instantly, I'd like there to be a delay of say... 10 seconds before each object looks around to do calculations.
Any advice from more experienced programmers on how they would tackle this?
Thanks!
I'm pretty new to the program, and I've been stuck for a few days trying to get this simulation to work. Here is what I'm trying to do:
It's a simulation of birch trees, pine trees, and grass. There is a 4 x 4 grid (16 boxes). The top 4 boxes contain birch tree objects, the bottom 4 boxes contain pine tree objects, and the middle 8 boxes contain grass objects. Here are the rules of the simulation:
- If a pine tree is next to grass, there is a 60% chance that it will convert the grass to a pine tree.
- If a birch tree is next to grass, there is a 40% chance that it will convert the grass to birch.
- If a birch tree is next to a pine tree, there is a 60% chance that it will destroy the pine and replace it with a birch
- If a pine is next to a birch, there is a 40% chance that it will destroy it and replace it with a pine.
- Pine next to pine doesn't need to calculate, and birch next to birch doesn't need to either.
- Eventually the board will be entirely full of either Pine trees or Birch trees.
Since there are no actual collisions happening between the tree and grass objects, I'm struggling with how to have my 16 different objects change states by identifying what is next to them and then running the 40%/60% random chance to see if it converts the object next to it. I also don't want all the calculations to happen instantly, I'd like there to be a delay of say... 10 seconds before each object looks around to do calculations.
Any advice from more experienced programmers on how they would tackle this?
Thanks!
Attachments
-
167.6 KB Views: 11