1001 Freelance Projects
Latest Projects from Freelance Marketplaces
Today is: 27-Apr-2024 08:34 GMT
View Project
View this project in detail (Note: you will be redirected to external marketplace)
Project title: C++ Coding task
Posted by: External project from PeoplePerHour
Started: 18-Dec-2020 03:25 GMT
Description: I need a programmer who is good with C++. I have a task which involves programming and sending me the solutions. Here is the case study below:

Your task is to implement a robot war, in which a large number of robots, grouped into several teams, move around in 2-dimensional space. Your program will read as input two files, start.txt and commands.txt, and produce output on the standard output. The format of these files is described below, but you should create your own for testing purposes. Your submissions will be run against several different input combinations.

The initial state of the system is described by a file start.txt, each line of which will contain four numbers identifying a robot, its team, and its initial position, e.g.

1673 2 53 -89
This says that robot 1673 belongs to team 2 and starts with x-coordinate 53 and y-coordinate -89. Robots and teams are indentified by positive whole numbers; coordinates are also whole numbers, but may be negative. You may assume that each robot is specified only once, and that each robot starts out in a different position.

At any time, each robot will be facing north, east, south or west. All robots start off facing north. We assume a conventional 2-dimensional space, so one step north from (53, -89) is (53, -88), while one step east would be (54, -89).

The program should then read commands.txt, acting on each line as it is read. The lines have the following forms and meanings, where r stands for a robot number. If the named robot does not exist, the command should be silently ignored.

show

The program should print to the standard output the current positions of all the robots still in the system, in the same format as start.txt above, but in ascending order of robot number.

travelled

List all the robots in the system, each with the total distance it has travelled. For example, if a robot has moved north 3 steps, east 1 step, and then south 2 steps, it has moved a total of 6 steps, even though it is only 2 positions from where it started.

Each line of the output should consist of two numbers, the robot number and the distance travelled, and they should be in increasing order of distance travelled. If two robots have travelled the same distance, order them by robot number.

within n

Print out the number of robots within n steps of the origin. (That is, the distance is n or less.) You should print the number on a line by itself, with no extra text. Distance here is the sum of the absolute values of the x- and y-coordinates (the Manhattan metric), so the distance to (2, -5) is 7.

turnleft r

Make robot r turn to the left, e.g. if it is facing north, turn it to face west.

turnright r

Make robot r turn to the right, e.g. if it is facing north, turn it to face east.

move r

Attempt to move robot r one step in the direction it is facing. If the target location is already occupied by a robot on the same team, no move is possible, and the robot stays where it was. If the target location is occupied by a robot of another team, that robot should be removed from the system, after which our robot moves.

You may assume that both files are correctly formatted: there is no need for your program to check for incorrect input.

Your program should not produce any other output than the above. If you add extra output statements during testing, be sure to remove them before submission. If you have added a pause before the program exits, please remove that too. (A better approach would be to configure your IDE to automatically pause so you don't need it in your program.)
Project ID: 3121396
Project category:
Project budget:
View this project in detail (Note: you will be redirected to external marketplace)
Last Projects / Browse Projects
  Project Started
Busco programador de plugins minecraft java
Category: Java, JavaScript, MySQL, PHP, Software Architecture
Budget: $30 - $250 USD
27-Apr-2024
04:04 GMT
Sci-Fi/Horror Short Story with Futuristic Tech
Category: Article Writing, Content Writing, Ghostwriting
Budget: $250 - $750 USD
27-Apr-2024
04:03 GMT
Paris-Based Shein Clothing Forwarding Service
Category: Freelance, Freelancer API
Budget: $750 - $1500 USD
27-Apr-2024
04:03 GMT
Wikipedia Page Creation for Company
Category: Article Writing, Editing, Ghostwriting, Research, Wikipedia
Budget: $250 - $750 USD
27-Apr-2024
04:01 GMT
Urgent BGMI Unban Hack for iOS and Android
Category: Android, IPad, IPhone, Mobile App Development, Objective C
Budget: $10 - $30 USD
27-Apr-2024
03:58 GMT
CFast Audio Player Prototype Development
Category: Digital Electronics, Electrical Engineering, Electronics, PCB Layout, Rapid Prototyping
Budget: $250 - $750 USD
27-Apr-2024
03:56 GMT
Commercial Waste Pipe Network Design
Category: AutoCAD, Building Architecture, CAD / CAM, Civil Engineering, Mechanical Engineering
Budget: $10 - $30 USD
27-Apr-2024
03:54 GMT
Wordpress Membership Form Plugin -- 2
Category: CSS, HTML, PHP, WordPress, WordPress Plugin
Budget: $30 - $250 USD
27-Apr-2024
03:54 GMT
Wordpress Membership Form Plugin
Category: CSS, HTML, PHP, WordPress, WordPress Plugin
Budget: $30 - $250 USD
27-Apr-2024
03:53 GMT
Lead Generation Landing Page Design
Category: Graphic Design, Web Design, WordPress
Budget: $30 - $250 USD
27-Apr-2024
03:52 GMT
Classic & Elegant Wine List Design
Category: Brochure Design, Graphic Design, Logo Design, Photoshop
Budget: ₹12500 - ₹37500 INR
27-Apr-2024
03:52 GMT
Nessus Advanced Windows Support
Category: Computer Security, Internet Security, Network Administration, Technical Writing, Web Security
Budget: $10 - $30 AUD
27-Apr-2024
03:51 GMT
Guionista con experiencia en viajes para YouTube
Category: Copywriting, Creative Writing, Screenwriting
Budget: $10 - $30 USD
27-Apr-2024
03:51 GMT
Google Doc to Editable Word Conversion
Category: Editing, English (US) Translator, English Spelling, Proofreading, Word
Budget: ₹750 - ₹1250 INR
27-Apr-2024
03:49 GMT
Contemporary Interior Design Rendering
Category: 3D Modelling, 3D Rendering, Building Architecture, Home Design, Interior Design
Budget: $30 - $250 USD
27-Apr-2024
03:47 GMT
Browse All Projects
Projects by Skills ...
Projects for 'android'
Projects for 'ajax'
Projects for 'asp'
Projects for 'aspnet'
Projects for 'cms'
Projects for 'cpp'
Projects for 'csharp'
Projects for 'css'
Projects for 'delphi'
Projects for 'design'
Projects for 'drupal'
Projects for 'excel'
Projects for 'facebook'
Projects for 'flash'
Projects for 'html'
Projects for 'java'
Projects for 'javascript'
Projects for 'joomla'
Projects for 'iphone'
Projects for 'mysql'
Projects for 'photoshop'
Projects for 'php'
Projects for 'python'
Projects for 'ruby'
Projects for 'seo'
Projects for 'sql'
Projects for 'sysadm'
Projects for 'translate'
Projects for 'typing'
Projects for 'twitter'
Projects for 'vbnet'
Projects for 'xml'
Projects for 'wordpress'
Projects for 'writing'
Read RSS feeds ... New!
RSS feed for 'android'
RSS feed for 'ajax'
RSS feed for 'asp'
RSS feed for 'aspnet'
RSS feed for 'cms'
RSS feed for 'cpp'
RSS feed for 'csharp'
RSS feed for 'css'
RSS feed for 'delphi'
RSS feed for 'design'
RSS feed for 'drupal'
RSS feed for 'excel'
RSS feed for 'facebook'
RSS feed for 'flash'
RSS feed for 'html'
RSS feed for 'java'
RSS feed for 'javascript'
RSS feed for 'joomla'
RSS feed for 'iphone'
RSS feed for 'mysql'
RSS feed for 'photoshop'
RSS feed for 'php'
RSS feed for 'python'
RSS feed for 'ruby'
RSS feed for 'seo'
RSS feed for 'sql'
RSS feed for 'sysadm'
RSS feed for 'translate'
RSS feed for 'typing'
RSS feed for 'twitter'
RSS feed for 'vbnet'
RSS feed for 'xml'
RSS feed for 'wordpress'
RSS feed for 'writing'
New!
Проекты на русском
(Projects in Russian)

Short URL:
1001fp.com
Mobile version:
m.1001freelanceprojects.com
Copyright © 2005-2022 1001 Freelance Projects