Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

College of Sciences Department of Computer Science 1411319: Programming Languages and Paradigms Program 2 simple program in C++ Department of Computer Science 1411319: Programming Languages

College of Sciences

Department of Computer Science

1411319: Programming Languages and Paradigms

Program 2

simple program in C++

image text in transcribed

Department of Computer Science 1411319: Programming Languages and Paradigms Given: XXX Program 2 Due: XXX This assignment is based on the book "Karel the Robot: A Gentle Introduction to The Art of Programming" by R. E. Patis You are required to write the first phase (stage one) of a project which is a simple program in C++ or Java. It is about a simple robot called Karel that can perform vary basic operations. Karel's world can be represented as a two dimensional arrav Karel is a simple and somewhat a primitive robot. He can move in any of the four directions (east, west, north, and south) and can also drop or pick up beepers that he carries in a bag. However, Karel does have some intelligence since he can recognize t the following situations 1. He can't move if there is an obstacle in the way 2. He can't drop a beeper if the bag is empty 3. He can't move west or south if he is at position1or north or east if he is at 100,100 The project will be implemented in a few stages Stage one: Primitive instructions only Karel moves one block forward. Karel pivots 90 degrees to the left mote 2. turmleft 3. pickbeepr Karel puts a beeper in the beeper's bag 4. putbeeper Karel places a beeper on the corner 5. turnoff Karel turns itself off Therefore, write a program that asks the user the following questions 1. Please select Karol's position: Assuming that the array (Karol's world) is 100 by 100 blocks, anywhere on this array is a valid position. The program should check for invalid input. Generate a number of moves for Karol during this run, say between 50 and 100 use random number generator) Using a random number generator, fill the beeper's bag with beepers (say 10 to 50) Using a random number generator, place a number of obstacles along Karol's path; let us assume that the number of obstacles is between 20 and 40 The program will stop when one of the following conditions happen: 2. 3. 4. 5. a. Karol is to step outside his world b. Karol is required placing a beeper when the bag is empty c. The instruction "turnoff" is executed d. The generated number of moves has reached

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_2

Step: 3

blur-text-image_3

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students explore these related Databases questions