Question: USE C++ Create a virtual room (10 x 10) and add a virtual robot in a random spot. 40% of the squares in the room

USE C++

Create a virtual room (10 x 10) and add a virtual robot in a random spot. 40% of the squares in the room contain batteries, which provide 5 units of power for your robot. The remaining squares are empty. Moving your robot costs 1 unit of power. Your robot starts with 5 units of power and may hold an unlimited number of charges. The robot is capable of sensing the environment to the North, South, East, West and square it is standing on. It can determine if the space has a wall in it, a battery in it or is empty. Each turn it may either grab a battery (if one is in the square it is occupying) or move 1 space. Moving costs 1 unit of power. Moving into a wall costs 3 power units. Your robot dies if it runs out of power before the simulation is over (arbitrarily set to 25 moves per robot). The key is the robot brain. You will use genetic algorithms to program your robots. Out of a random population, some robots will do better than others. You will keep these robots and breed them so subsequent generations will become smarter and smarter at this task. Each generation will use 200 robots, only the initial generation will have randomly generated brains. Each robot will spend 200 turns in the room. You will compare robot performance on the total number of power units each has collected. Once each generation has been scored, you will select the top 50% robots and breed them. Each child robot will get 50% of its behavior from 1 parent and 50% from the other. The children will replace the bottom 50% of the robot population. The simulation will run again. You will repeat your simulation 1000 times (ie 1000 robot generations). Specication. Record the average power collected for each generation and display at the end of the simulation. You should see an ever improving curve as the GAs get better and better at their task.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!