前天用OOP方式写的一个小程序

--------------------------------------------------------------------------------------------------------------------------------

Problem Description:

MARS ROVERS

Squads of robotic rovers are to be landed by NASA on a plateau on Mars. This plateau, which is curiously rectangular, must be navigated by the rovers so that their on-board cameras can get a complete view of the surrounding terrain to send back to Earth.

A rover's position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An example position might be 0, 0, N, which means the rover is in the bottom left corner and facing North.

In order to control a rover, NASA sends a simple string of letters. The possible letters are 'L', 'R' and 'M'. 'L' and 'R' makes the rover spin 90 degrees left or right respectively, without moving from its current spot. 'M' means move forward one grid point, and maintains the same heading. Assume that the square directly North from (x, y) is (x, y+1).

INPUT:

The first line of input is the upper-right coordinates of the plateau, the lower-left coordinates are assumed to be 0, 0. The rest of the input is information pertaining to the rovers that have been deployed. Each rover has two lines of input. The first line gives the rover's position, and the second line is a series of instructions telling the rover how to explore the plateau. The position is made up of two integers and a letter separated by spaces, corresponding to the x and y co-ordinates and the rover's orientation. Each rover will be finished sequentially, which means that the second rover won't start to move until the first one has finished moving.

OUTPUT

The output for each rover should be its final co-ordinates and heading.

INPUT AND OUTPUT

Test Input:

5 5

1 2 N

LMLMLMLMM

3 3 E

MMRMMRMRRM

Expected Output:

1 3 N

5 1 E

--------------------------------------------------------------------------------------------------------------------------------

http://files.cnblogs.com/slime/MarsRover.zip

This project is to solve the Mars Rovers Problem. I separate this project to two parts by using Object-Oriented programming, project MarsRover is server side, and testMarsRover is client side. In my design, client side only need header files and the lib file of MarsRover.

interface/iaction.h

interface/iheading.h

interface/inavigator.h

interface/iplateau.h

interface/irover.h

factory/headingfactory.h

factory/navigatorfactory.h

factory/plateaufactory.h

factory/roverfactory.h

--------------------------------------------------------------------------------------------------------------------------------

Build Information:

Visual Studio 2008, Warning Level 4

转载于:https://www.cnblogs.com/slime/archive/2010/08/03/1790902.html

Mars Rover相关推荐

  1. Katas编写的Java教程:Mars Rover

    编程kata是一种练习,可以帮助程序员通过练习和重复练习来磨练自己的技能. 本文是" 通过Katas进行Java教程 "系列的一部分. 本文假定读者已经具有Java的经验,熟悉单元 ...

  2. Codeforces Round #499 (Div. 2): F. Mars rover(DFS)

    题意:给你一个门电路(包含XOR.OR.AND.NOT.IN五种),这个门电路构成了一棵树,其中1号是输出端(根),所有的叶子都是输入端,给出每个节点(门)的功能以及输入端的输入(是0还是1),求出在 ...

  3. The Innovation | Volume 2 Issue3 正式出版

    Volume 2 Issue 3 2021年08月28日 The Innovation 第二卷第三期正式出版 On the Cover About 100,000 years ago, Diverse ...

  4. 18个有趣的API供你的前端开发测试之用

    [提示]本文来自medium.com,访问下面提供的开放API的话,有很多你需要借助×××才可进行,但不管怎么说, Chuck Norris Facts A fan of Chuck Norris? ...

  5. 机器人学习--Hans Moravec在斯坦福博士论文1980年-Obstacle Avoidance and Navigation in the Real World by a Seeing Ro

    Hans Moravec,占用栅格地图的发明人. Obstacle Avoidance and Navigation in the Real World by a Seeing Robot Rover ...

  6. python 新闻摘要_每日新闻摘要:Microsoft内部禁止应用程序,这样就可以了

    python 新闻摘要 Recently, a list of apps that Microsoft prohibits for internal employee use leaked, incl ...

  7. eclipse鼠标变十了_Eclipse在过去十年中的主要成就

    eclipse鼠标变十了 正如我所写的那样 ,Eclipse在11月庆祝了10年来的开源和社区. Eclipse社区已经形成了许多里程碑 ,但是主要成就是什么? Eclipse为实际改变软件行业做了什 ...

  8. Eclipse在过去十年中的主要成就

    正如我所写的那样 ,Eclipse在11月庆祝了10年来的开源和社区. Eclipse社区已经形成了许多里程碑 ,但是主要成就是什么? Eclipse为实际改变软件行业做了什么? 这是Eclipse的 ...

  9. Codeforces Round #499 (Div. 1) Solution

    Codeforces Round #499 (Div. 1) Solution https://codeforces.com/contest/1010 为啥我\(\rm Div.1\)能\(A4\)题 ...

  10. Python 可以满足你任何 API 使用需求

    摘要:在本教程中学到的概念和技术将允许您使用自己喜欢的任何 API 进行练习,并使用 Python 来满足您可能拥有的任何 API 使用需求. 本文分享自华为云社区<Python 和 API:读 ...

最新文章

  1. C语言笔试题--从CSDN转发
  2. 跳槽时,这些Java面试题99%会被问到
  3. php uncaught thrown,PHP异常详解
  4. 关于c语言字符串函数和一些内存函数的的简介
  5. java面试题34下面关于程序编译说法正确的是()
  6. 15个著名的设计心理学原理以及在设计中的应用
  7. myPassword
  8. 如何处理不能复现的bug?软件测试工程师避坑指南
  9. 问题八:C++中this是干嘛用的
  10. 计算机信息的应用安全中心在哪,腾讯游戏安全中心
  11. 按键精灵q语言连接mysql_【按键精灵8】Q语言介绍
  12. EditPlus配置Java运行环境
  13. Python 实现字节转换函数
  14. (亲测可用)Redis远程连接频繁掉线应对策略 -- 还能让你不知不自觉中在笑声中掌握Redis命令
  15. Windows主机和Linux主机之间连接网线共享网络上网设置
  16. 2WD远程控制小车——云端设计
  17. 豆瓣8.6分的《长安十二时辰》,为什么有人却并不喜欢?
  18. 台达变频器vfb—d参数表_台达DPS
  19. 判断三条边是否构成三角形
  20. 2023团队程序设计天梯赛选拔赛

热门文章

  1. IE 打开速度慢的解决方法
  2. codecademy python study
  3. [日推荐]『Brick4积木』乐高迷不可错过的小工具
  4. 波士顿大学 计算机专业,波士顿大学计算机科学专业波士顿大学计算机科学专业.pdf...
  5. 脚手架开发(1)-准备阶段
  6. ps cs6安装教程
  7. 用友U8供应链期初数据录入案例教程2
  8. Poi和easyExcel
  9. mysql如何上传音频文件_关于音频文件的上传
  10. WP Engine开发人员工具的好处