# beehive simulation

• 12-01-2009, 11:20 PM
BlueF4re
beehive simulation
Hey java maties

(srry if my english is bad, but it's not my motherlanguage)

I need a program that simulates the life in a beehive. I have a few problems with it:

The user can give in a certain amount of queens, worker bees and drones (and this results in a certain amount of bees).
A worker bee can have a certain amount of soft nectar (2 food units) or unsoft nectar (1 food unit) (the user gives the amounts...)
The beehive is just a matrix, length and width also given by the user. We may use a class named ActionChooser. 1 method in that class is called:
public int chooseAction(boolean[] barray). '

Barray' is an array with a length of 16 (actions) which can be resolved (true) of not resolved (false). The method chooseAction gives, as a result, the number of an action (and -1 if no action can be resolved).
Actions 4,5,6,7,8 and 9 are always false (don't bother).

action 0: a bee of the total amount of bees goes northward. In this program a bee doesn't die or can leave the beehive (= the matrix). So, there are a few conditions (f.e. a bee is on the northern side of teh matrix, the bee cannot go northward AND if in the section above the bee, the max. amount of bees(given by the user) has reached, the bee cannot go northward either)

action 1: go westward (same conditions)
action 2: southward (idem)
action 3: eastward (idem)

action 10: when 1 bee (of the total number of bees) is in the underrightcorner, that bee disappears. However a queen cannot disappear AND a worker bee that still has an amount of food units cannot disappear as well...
action 11: a worker bee can drop 1 food unit (soft or unsoft nectar, doesn't mather which of the 2). However, if the max. amount of food units in that section has reached (again given by the user), the action cannot be resolved...

Don't bother the other actions...
• 12-02-2009, 12:04 AM
Fubarable
Quote:

Originally Posted by BlueF4re
Hey java maties
(srry if my english is bad, but it's not my motherlanguage)

Quote:

I need a program that simulates the life in a beehive.
And we wish you great success with this.

Quote:

I have a few problems with it:
The user can give in a certain amount of queens, worker bees and drones (and this results in a certain amount of bees). ...
So here you list the assignment but don't mention any of your specific problems. Of course we can't help you until you do this. Otherwise to just dump the assignment here without further comment is what is known as a "homework dump" and is looked down upon. I look forward to more info from you and perhaps a post of the code that you've done so far, and what is not working right.

Much luck and welcome to the forum!
• 12-02-2009, 09:31 AM
BlueF4re
Well

I actually don't know how to let a random bee move. The conditions are no problem. I thought of using 'setters' and putting the drones, queens and worker bees in an array, bu that's it.

You' ve got the beehive[i][j] and if want to let a random bee go northward, you have to 'set' that bee in the section beehive[i][j+1]. But you can't just say "bee[k] = beehive[i][j+1]" That is impossible. So I need avice about how to use the number of bees, queens, drones etc. and which method I need for getting a bee in a different section (1 is enough; if I see the method I will understand how to let a bee go eastward, westward etc...)