Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

No results Options v Part 2: Assignment Robot (max 25 points ) Learning Objectives: Practice the use of repetition statements (loops) Solve problems by combining

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
No results Options v Part 2: Assignment Robot (max 25 points ) Learning Objectives: Practice the use of repetition statements (loops) Solve problems by combining various Java concepts we have studied so far Build algorithms that are general and efficient Description: On this assignment, you need to program a robot that has been dropped into a grid of square rooms. Each the North wall is Neon, the East wall is Eggplant, the South wall is Sandy, and the West wall is Walnut. Walls between rooms have doors in them, but walls on the edge do not. All of the doors are closed initially.Description: The robot knows how to do the following 1. Check N (or Check E. or S, or W) to see if there is a door on that wall of its current room: 2. Go N (or E or 5 or W) to move one room over, 3. Do basic math and remember numbers 4. Say something (a pop-up window with the specified text shows up) if you ask the robot to Go through a wall that does not have a door it isn't smart enough to knowit can't so i will walk into the wall and damage itself No results Options v Description: On this assignment, you need to program a robot that has been dropped into a grid of square rooms. Each wall of each room has been painted a different color: the North wall is Neon, the East wall is Eggplant, the South wall is Sandy, and the West wall is Walnut. Walls between rooms have doors in them, but walls on the edge do not. All of the doors are closed initially.Description: The robot knows how to do the following: 1. Check N (or Check E, or S, or WI to see if there is a door on that wall of its current room; 2. Go N (or E or S or W) to move one room over: 3. Do basic math and remember numbers. 4. "Say' something (a pop-up window with the specified text shows up) if you ask the robot to Go through a wall that does not have a door, it isn't smart enough to know it can't so it will walk into the wall and damage itself The Robot needs to complete three challenges as described below. At the end of each challenge, the robot is asked to say something. This creates a pop-up window and the program to pause until the message is closed. causes Getting Started Download the zip file: Assignment Robotzio Unzip it. Copy the unzipped folder in your 1400 Assignment folder and use it as a starter project for this assignment. The tolder includes 3 files: Robot,java. DoorRoom.java, and RobotApp java challenges will be implemented as a method in class RobotApp. The files Robot and DoorRoom should not be modified To help you get started an additional demo method is included. it shows you how the robot can be controlled. The demo method should be removed before turning in your assignment code NO results | Options v Getting Started: Download the zip file: Assignment Robot.zip Unzip it. Copy the unzipped folder in your 1400 Assignment folder and use it as a starter project for t assignment. The folder includes 3 files: Robot.java, DoorRoom.java, and RobotApp.java. Each of the three challenges will be implemented as a method in class RobotApp. The files Robot and DoorRoom should not be modified To help you get started an additional demo method is included. It shows you how the robot can be controlled. The demo method should be removed before turning in your assignment code. Use best practices like proper indentation, descriptive names, following Java naming conventions, avoidi code duplication, etc. (max 5 points) Challenge 1: (max 7 points ) Suppose the robot is dropped into a square grid of rooms and starts in the north-east corner of the grid. Come up with an algorithm that the robot can use to figure out how many rooms are in the grid. . An algorithm is a deterministic set of steps that do not require any outside information. Remember. your robot doesn't know how many squares there are in advance: if you refer to the size of . the grid in your instructions to the robot, it won't work Once you have a plan, use it to implement the method challenge1 in RobotApp Make sure it works for difterent size grids. (2 out of 7 points ) If you change the size of the grid to 1 or 10 the robot should still return the correct number of rooms Minimize the number of moves. ( 1 out of 7 points) n a 3-by-3 grid, about a 4-by-4? Ann by-n? how many times wili the robot have to move through a door to run your algorithm? How want to sove on robot fuel. Try to make an algorithm that minimizes the moves it takes for No results Options v One more thing to do: (1 out of 7 points) Once you have an algorithm you think is general (works for all size squares) and efficient (uses few moves). consider through how many doors the robot has to enter in order to figure out the total number of rooms. It should be an expression based on n - e.g.for an n-by-n grid the robot moves through 2n+5 doors or something like that. In the end, the robot should 'say' the number of rooms and the expression describing the number of moves. The number of rooms is dynamically calculated with the help of the robot. The expression is something you figured out and part of the hard-coded text. Use the following format: (numberOfRooms) rooms lexpression] moves Eg: 3 rooms 2n+5 moves Notice neither 3 nor 2n+5 are the right onswer but just an example of the expected format Challenge 2: (max 7 points ) This time the robot is dropped into a rectangular (not necessarily squarel grid of rooms Again, the robot starts in the north-east corner of the grid and again the robot is tasked to figure out the total number of rooms. Solve the analogous challenges described above but this time for a rectangular grid This time implement the method challenge2 in RobotApp. Make sure it works for different grid sizes. f2 out of 7 points) Minimize the number of moves to save robot fuel: (I out of 7 points ) Expression based on width(w) and height(h: (1 out of 7 points ) Come up with an expression that describes the number of moves needed for a w by-h grid. in the end, the robot should say' the number of rooms and the expression based on w and h No resultsOptions v Challenge 3: (max 7 points) In this third challenge, the robot is dropped into a square grid of rooms. However, this time the robot starts in any arbitrary room in the grid. Solve the analogous challenges described above by implementing the method challenge3 in RobotApp. Make sure the robot returned the correct number of rooms regardless of the grid size. (2 out of 7 points) Minimize the number of moves to save robot fuel: (1 out of 7 points) Expression based on width(w) and height(h): (1 out of 7 points) Come up with an expression that describes the number of moves needed for an n-by-n grid. Since this will probably depend on the starting location of the robot, assume the robot starts in the worst possible room (the room that requires the robot to open the most doors) In the end, the robot should 'say the number of rooms and the expression based on n Challenge 4:( max 7 points) in this third challenge, the robot is dropped into a rectangular (not necessarily square) grid of rooms However, this time the robot starts in any arbitrary room in the grid. Solve the analogous challenges described above by implementing the method challenge4 in RobotApp Make sure the robot returned the correct number of r ooms regardless of the grid size. (2 out of 7 points) inimize the number ot moves to save robot fuel: (1 out of 7 points) Expression based on width w) and height(h): (1 out of 7 points Come up with an expression that describes the number of moves needed for a w-by-h grid Since this will probably depend on the starting lpcation of the robot assume the r possible room (the room that requires the robot to open the most doors) In the end, the robot robot starts in the worst the number of rooms and the expression based on w and h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions