Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Okay, so below is the prompt, we are supposed to make the bots move and scan as efficiently as possible. I need help getting these

Okay, so below is the prompt, we are supposed to make the bots move and scan as efficiently as possible. I need help getting these robots to move efficiently and efficiently fix the robots when they malfunction.

image text in transcribedimage text in transcribedimage text in transcribed

#include

#include

#include "bot.h"

using namespace std;

const int MAX_ROBOT_NUM = 50;

int NUM; // to remember number or robots

int ROWS, COLS; // map dimensions

/* Initialization procedure, called when the game starts: */

void onStart(int num, int rows, int cols, double mpr,

Area &area, ostream &log)

{

NUM = num; // save the number of robots and the map dimensions

ROWS = rows;

COLS = cols;

log

}

/* Deciding robot's next move */

Action onRobotAction(int id, Loc loc, Area &area, ostream &log) {

int row = loc.r; // current row and column

int col = loc.c;

if (area.inspect(row, col) == DEBRIS)

return COLLECT;

else {

// if not at a debris field, move randomly:

switch(rand() % 4) {

case 0:

return LEFT;

case 1:

return RIGHT;

case 2:

return UP;

default:

return DOWN;

}

}

}

void onRobotMalfunction(int id, Loc loc, Area &area, ostream &log) {

log

}

void onClockTick(int time, ostream &log) {

if (time % 100 == 0) log

}

image text in transcribedimage text in transcribed

Day 1 Robot hardware 15 28 25 38 10 Time: 17 Qit Pl a] [5tep Fast-forward] Here's a picture from the Mission Control Center. Robots are shown as green labels 1, 2 , and the debris fields are blue squares. Each robot is equipped to perform the following actions: enum Action COLLECT UP, DOWN, LEFT, RIGHT, collect debris move in four directions REPAIR UP, REPAIR_DOWIN, I/ repair neighboring robots REPAIR_LEFT, REPAIR_RIGHT 5 1; Furthermore, each robot is identified by its id The system is also tracking the location of every robot, which has two coordinates: row loc.r and column loc.c The maximum number of robots that can be programmed from the control center is 50, and their numbers are always in the range from 0 to 49. id When operating in empty space with no debris, all robot operations take 8 units of time to complete. While, according to the safety standards, when working at a debris site, the same operations are carried with higher accuracy and take 80 units of time, which is 10x of the normal operation time. Day 1 Robot hardware 15 28 25 38 10 Time: 17 Qit Pl a] [5tep Fast-forward] Here's a picture from the Mission Control Center. Robots are shown as green labels 1, 2 , and the debris fields are blue squares. Each robot is equipped to perform the following actions: enum Action COLLECT UP, DOWN, LEFT, RIGHT, collect debris move in four directions REPAIR UP, REPAIR_DOWIN, I/ repair neighboring robots REPAIR_LEFT, REPAIR_RIGHT 5 1; Furthermore, each robot is identified by its id The system is also tracking the location of every robot, which has two coordinates: row loc.r and column loc.c The maximum number of robots that can be programmed from the control center is 50, and their numbers are always in the range from 0 to 49. id When operating in empty space with no debris, all robot operations take 8 units of time to complete. While, according to the safety standards, when working at a debris site, the same operations are carried with higher accuracy and take 80 units of time, which is 10x of the normal operation time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions