Go of Honeycomb
() Method
We give flower
Class writes
Go
() Method,
Bee
Class also writes
Go
() Method (although some code should be added ). Below is
Hive
Class
Go
() Method:
Unfortunately, this is not realistic. Most of the time, there is no time for young bees to grow. We don't have a queenbee
Class, but let's assume that when honey is enough, there will be a chance to create a young bee. We can write it down as follows:
Q: How many young bees can be created in a beehive?
A: It's okay now --
Of course, this is not realistic. Later we will come back and add constraints to allow a certain number of bees to exist in the beehive at the same time.
Q: We cannot change random.
Is the instance assigned to a class attribute? Instead of passing it as a parameter
Addbee
() Method?
A: Yes. In this way, addbee
You can use the attribute value instead of the parameter. There is no definite answer to this question. As you like.
Q: I still don't know these go
() How to call the method.
A: It doesn't matter. We are about to explain this. However, first we need a class -- World
It manages everything in the beehive, as well as bees and even flowers.