
There are many cockroaches in a house and they are very annoying. So, the owner of the house decides to create a number of traps in his house to trap a cockroach in when it walks passing by the trap. If a cockroach is trapped, it will die.
Your program will create a grid of 50x50 tiles with the position of all traps is placed randomly around the grid. The number of cockroaches in the house is given by the user, and their positions are randomly placed on the grid, but not on a trap. Each column of the grid will have at least one trap. Each cockroach walks randomly from tile to tile in all 8 directions (unless it is against the wall) throughout the house. The program will stop when all cockroaches have been trapped, and the time to trap all cockroaches will be displayed.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.