Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there! Please give me the full hand written answer of this question and also attach picture of the code from your Laptop please. DO

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Hi there! Please give me the full hand written answer of this question and also attach picture of the code from your Laptop please. DO NOT FORGET TO CHECK " WHAT TO HAND IN" IN THE PAGE BEFORE THE LAST ONE. And make sure to answer ALL of its parts. IN THE END, please give the very short question related to this above question in a couple of line about your program(in the last page)

Please Solve it only if you're sure that your answer is 100% correct otherwise let any other person to solve it.

I need the Correct answet (will get a thumbs up) please otherwise I'll give dislike and report it to the Chegg authorities. Sorry for these words but I'm tired of getting lots of wrong answers lately.

Please answer it as soon as possible with clear hand writting and thank you so much for your time and effort

Duestion 3 ( 15 points): Purpose: To build a program and test it, without starting with a design document. To get warmed up with Python, in case you are using it for the first time Degree of Difficulty: Moderate Don't leave this to the last minute. This task involves an unfamiliar prob lem, but the program itself is not more difficull than anything you ve done in CMPT 141 References: You may wish to review the following chapters - File I/O Review. CMPT 141 Readings Chapter 12 The Torus Square The following description considers the manipulation of a 33 array of integers, which can be considered a kind of simple game. The description will start by describing the rules of the game, and then you'll be told what your task will be. It is highly unlikely that you will discover anything sensible on the internet about this game. It was invented by one of your instructors. Consider an 33 array of integers {0,,8} such as: This is a kind of a puzzle, where we allow rows to be shifted left or right. and columns to be shifted up or down. We will call these actions unit rotations, for reasons that will be clarified immediately. A unit rotation is simply a shift of all the elements of a row (or column) by one position. For example, we can rotate the top row of the previous example one position to the right to get the following: Notice that the integer 2 that was on the end of the row moved to the front after the rotation to the right. Because the number 2 moved to the front of the row, we call it a rotation. Similarly, we can rotate the bottom row one position to the left to get the following: Notice that the integer 6 that was on the front of the row moved to the end after the rotation to the left. Rotations of a row can be one position right, or one position left. Rotations of a column can be one position up, or one position down. When a column is rotated up, the value on the top of the column is moved to the bottom of the column: all other elements are moved one place upwards. Because we only consider one position left, right, up, or down, we call it a unit rotation. When a row (or column) is rotated, only that row (or column) is rotated; all other rows (or columns) remain unchanged. These unit rotations can be performed in sequences, one after another. which result in the numbers moving around the puzzle array. We will represent each possible rotation with a code, which we will motivate by example, and then define carefully after the example. A unit rotation of the first row to the right will be represented by the string 'R 0 '. The first letter ' R ' indicates that a row is rotated to the right. The digit ' 0 ' indicates that the first row is rotated. In general, a rotation will consist of a single letter followed by a single digit. - ' R i' means rotate row i to the right one position. - 'L i' means rotate row i to the left one position. - 'U i' means rotate column up one position. - 'D i' means rotate column i down one position. Here, i has to be a valid row or column index that is: 0,1,2. Now that we have a code for the rotations, we can write sequences of rotations with this code. Suppose you are given an array AT and and a sequence of unit rotations, for example 0362EUU147022258 The first three lines telfus the starting position. The number 2 tells us that there are two rotations to perform on the starting position. There are two rotations given (row O to the right, followed by column 2 up), which are the rotations used in the preceding description. If we perform the given unit rotations, the resulting position would be the following: You'll be given several data files consisting of one example per file. Each file will describe an initial configuration of the puzzle, and then a sequence of unit rotations. In general, an example file will look like this What to Hand In - Your implementation of the program: a1q3. py. - If you wrote a test script, hand that in too, calling it a1q3_testing.py Be sure to include your name, NSID, student number, course number and laboratory section at the top of all documents. Evaluation - 10 marks: Your program works. - 5 marks: Your program is well-documented. The first three lines are the starting position of the puzzle array. Assume these will be numbers, in the range 0-8. The 4 th line tells you the number of rotations to perform, and the remaining N lines describe each rotation (using the code above). Your job is to read the file, perform the rotations, and display the array showing the effect of all the rotations done in the sequence given. For example, if the input file contains the following example: your program should read the file, perform the rotations, and finally display the result: Data files On Canvas you will find 2 ZIP files for your use in this question: - a1q3Examples. zip Contains 15 example files, with rotation sequences of different lengths. The filenames are torus_N_i.txt, where N tells you how long the rotation sequence is, and i is an index. There are 3 examples for each N. - a1q3Solutions.zip Contains 10 files that show the solutions for most of the examples. The solution file torus_N_i_solution.txt matches the example file torus_N_i.txt. We're not giving you solution files for all the examples, so that you have to be more thoughtful about assessing your work. You should be able to open ZIP files using software on any lab computer. and on your personal computer as well. If not, the ZIP format is standard, and File Compression utilities are easily downloaded from your favourite app store. Answer the following questions about your experience implementing the program in Question 3. You may use point form, and informal language. Just comment on your perceptions. Be brief. These are not deep questions; a couple of sentences or so ought to do it. 1. (2 marks) Comment on your program's correctness (see Chapter 3 of the textbook for the definition). How confident are you that your program (or the functions that you completed) is correct? What new information (in addition to your current level of testing) would raise your confidence? How likely is it that your program might be incorrect in a way you do not currently recognize? 2. (2 marks) Comment on your program's efficiency (see Chapter 3 of the textbook for the definition). How confident are you that your program is reasonably efficient? What facts or concepts did you use to estimate or quantify your program's efficiency? 3. (2 marks) Comment on your program's adaptability (see Chapter 3 of the textbook for the definition). For example, what if Assignment 2 asked you to write a program to work with a Torus rectangle of 57) ? How hard would it be to take your work in A1Q3, and revise it to handle arrays of any size? 4. (2 marks) Comment on your program's robustness (see Chapter 3 of the textbook for the definition). Can you identify places where your program might behave badly, even though you've done your best to make it correct? You do not have to fix anything you mention here: it's just good to be aware. 5. (2 marks) How much time did you spend writing your program? Did it take longer or shorter than you expected? If anything surprised you about this task, explain why it surprised you. 6. (2 marks) Did you create a design document, along the lines of the one provided for A1Q1? If so, how long did that take? If you did, do you think the time you spent resulted in a shorter total time for this question? If you did not create a design document, do you think I could have helped you? 7. (2 marks) Consider how often you were interrupted, distracted, delayed during your work for Question 3. Do you think these factors affected substantially increased the time you needed? If so, what kinds of steps can you take to prevent these factors

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

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

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Summarise the scope of HRM and the key HRM functions

Answered: 1 week ago