You are using a version without Ads of this website. Please, consider donating:

### programming

Problem Statement
In preparation for an upcoming robotics competition, your company has decided to showcase its new robot. The competition requires the robot to move on a fixed flat (two-dimensional) surface and collect objects randomly placed on the surface. Your robot can only take one step at a time and move in only four directions (north, south, east, west).
Your company has approached you to write a simple C++ program to demonstrate the physical movement of the robot and the collection of objects placed on the flat surface. This flat surface is defined using four vertices (A, B, C and D) with the following coordinate values (in metres):
A = (0,10), B = (10,10), C = (10,0), D = (0,0)
Once the above boundary is defined, the robot can only move within it. The robot can move on the boundary line, but not move out of it!
In order to move, the robot responds to a set of numeric commands that represent movement in the four directions as explained below:
Number
Command
1
Move 1 step north
2
Move 1 step south
3
Move 1 step east
4
Move 1 step west
-1
Stop (end of journey)
Assume each step moved is one metre and the current coordinate position of the robot is updated accordingly on each movement. This process continues until the stop command (-1) is entered. If any of the commands requires the robot to move out of the boundary lines specified earlier, an error message is displayed and the program prompts for another numeric command for the robot.
2 CS102 Project 1, 2012
Furthermore, five identical trophies have been placed as objects at different positions on the flat surface, which the robot is required to collect if it moves to the position occupied by the trophy. For simplicity, these five trophies have been placed on the following fixed coordinate positions:
(3,3), (2,5), (7,1), (4,6), (9,8)
If the robot happens to start on a position occupied by a trophy, the robot also collects this trophy before continuing with the other movements.
Finally, you are required to calculate the total number of steps moved by the robot, the total number of trophies collected and the direct distance between the start and stop positions of the robot upon the completion of all the robot movements.

HOW TO PUT THE TROPHY COORDINATES AS IN THE FORM OF CONSTANTS AN TELL THE ROBOT TO PICK UP THE TROPHIES AT THIS COORDINATES PLIS HELP IM ONLY STUCK ON THIS PART
sorry dude... homework question can't write code for you
i only need the code for the trophies nathing else dude plis im just confused at dat point plis plis do help
I can't advise too much because you haven't provided any code to indicate how you're storing your robot positions or your general grid positions.

The easy answer is to make an array of those points. Then, in each iteration of your program loop, check to see if the robot's current position is equal to any of those values. I'd advise using a function for this.
post ur code and no. i can absolutely not write code for you in terms of homework for you. btw how long have you been programming
finished making it. its not that hard it only took five hours
Topic archived. No new replies allowed.