ASSIGNMENT 2 Toy car

Original price was: \$35.00.Current price is: \$30.00.

Category:
Rate this product

BBM103: Introduction to Programming Laboratory I
PROGRAMMING ASSIGNMENT 2
1 Introduction
Imagine a toy car with a brush in front of it circulating in a room. The car is controlled by
python application using control flows, loops and functions. Brush in the car can be in two
different positions: above or below. When the brush is down, it paints the places where the
vehicle goes and does nothing when the brush is up. It is expected you to implement this
program in python.
2 Assignment
You will use an array to start with a user-specified N * N size. You will keep a record of
where the vehicle is located, whether the brush is below or above, and the direction of the
vehicle. If the vehicle is out of size, it will complete the command by entering from the other
side. In other words, if you exit from the right of the matrix, it will continue by entering on
the left and continue from above if you exit from below.
Assume that the vehicle is initially in position (0,0), the brush is up and the vehicle is facing
to the right. The vehicle will be managed by the following command.
1 Brush down
2 Brush up
3 Turn right
4 Turn left
5 x
Move up to x
(except the square where it is located.)
6
Jump (Jump as 3 square except the square where it is located.
After jumping, the brush comes up)
7 Reverse direction ( rotates 180 degrees)
8 View the matris
0 End program (if it sees 0, it will ignore subsequent commands.)
If the brush is down while the vehicle is passing from one square to another, a value of 1
will be assigned to the corresponding element in the array. Places with a value of 1 will be
displayed as ” * ”.
Programming Assignment 2 1
BBM103: Introduction to Programming Laboratory I (Fall 2021)
Commands will be separated with each other by ” + ”. An exemplary command is as
follows.
Commands: N (board size) +5 5+3+5 1+3+1+5 4+4+5 7+4+5 4+4+5 3+4+5 2+7+6+8+0
SAMPLE 1 for testing:
A sample image when you run your program with python3 assignment2.py command line:
As you see, after run your program, it prints the menu of the rules, and asks user for entering
commands. After entering specified commands, for example, 20+5 5+3+5 1+3+1+5 4+4+5 7+4+5 4+4+5 the output of the program is shown below.
If a number between 0-8 is not entered in the commands, it will give an error message, then
Programming Assignment 2 2
BBM103: Introduction to Programming Laboratory I (Fall 2021)
clear the console and asks user to enter a new command for output.
SAMPLE 2 for testing:
Commands: 9+3+1+5 3+4+5 4+4+5 3+7+6+3+5 2+4+1+5 3+2+5 2+1+3+5 9+8+0
3 Execution and Test
Assume that the commands will be taken from console, so to execute your code on dev, firstly
use following command line in your terminal:
python3 assignment2.py
After executing this command line (python3 assignment2.py) in your terminal, the program
will ask user to enter the commands that includes rules such as 12+5 3+1+4 etc. After
entering commands, you will print the output.
Programming Assignment 2 3
BBM103: Introduction to Programming Laboratory I (Fall 2021)
Submitted 1
Compiled 10
Output 79
Error Handling 10
Total 100
5 Important Notes
• Do not miss the submission deadline! Use the Github platform for submission. Submissions as e-mail attachments will not be accepted.
• Your assignment must be original and you must do it with your own individual work.
Duplicate or very similar assignments are both going to be considered as cheating. You
can ask your questions via Piazza and you are supposed to be aware of everything discussed on Piazza. At Piazza, you cannot share your source code completely or partially.
Assignments will be checked for similarity, and there will be serious consequences if
plagiarism is detected.
• You have 3 days extensions for this assignment. Please do not click and accept all the
links below. Just click one of the related link if you use any extension. If you don’t use
will be degraded over 80 points)
will be degraded over 70 points)
• Your programs will be executed in DEV machine, please make it work on dev before
submitting.