Simulations with 2D arrays


New biological triggering device are being tested by government organization. The genuine cost has crossed over. To make the cost lower, you are recruited to check the new style trigger using simulation. The question is how do trigger operate?

The device has grid of 20 by 20 where every square works as a sensor. With one flea every square start working. All fleas come on neighboring square at same time. In this situation some square may have one flea, some have more than one flea and may be some are founded blank. The fleas start moving and jumping, at one time the trigger fired when 73% square we found blank. The flee is wiped out when it starts jumping at 20 x 20 grid.

During testing usage and stopping actual fleas has become big cost for government. Using electronic fleas than actual fleas is cheaper.

For processing we want to know how the given flea will start jumping. It will use only neighboring square not more squares for jumping. Now the direction is decided for flea to where it will jump. Now it will use nine squares or places where it can land, it will jump 5% of time in one of the square corner, every corner will be 5%. It will jump 15% of time bottom, top ,left the current square and 20% to the right. The flea is at center square and directions that the it will jump are here below:

5 15 5
15 15 20
5 15 5

A simulation is based on one flea on every square, after that letting them to jump, after this jump check out whether 73% square are blank and simulation ends. For completing following task one simulation will not be ok. I t needs to run simulation 2500 times and after that calculate following values:

Input: nothing

Output: What is total time of jumping before the trigger fire?

Is it jumps every 6 seconds 4times, before trigger fire determine the maximum time that one need to clear the place?

What will be shortest and longest time, given to run all simulations?

Before trigger fire what will be the counter of fleas in average that are lost?

Restrictions: 2-d arrays(2) , for result making operate simulation 2500 times.

From grid 1 to grid 2 fleas will jump, with all 1's grid 1 should be adjusted and with 0's firs grid 2 should be. For a function jump use numbers randomly, jump(a, b) after that one array zero out , jump(b, a) and 2500 times repeat this.

Done with jumping function, my problem is that once you got your random numbers then examine if statements, grid1 to grid 2you move and sum. I tried but it’s not successful, someone has already done this with 1 2d array, so I tried to apply this, but I can't find out what should I to do?

1. Show what code you have tried.
2. Find a better translator.

But I guess it comes along every two or three years, anyway :
Last edited on
Topic archived. No new replies allowed.