Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 ( 2 0 points ) : Purpose: To build a program and test it , without starting with a design document. To get

Question 4(20 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. Dont leave this to the last minute. This task involves an unfamiliar prob-
lem, but the program itself is not more difficult than anything youve done in CMPT 141.
References: You may wish to review the following chapters:
Lists: CMPT 145 Readings: Chapter 2.
File I/O Review: CMPT 141 Readings: Chapter 12
Restrictions: This question is homework assigned to students and will be graded. This question shall not
be distributed to any person except by the instructors of CMPT 145. Solutions will be made available
to students registered in CMPT 145 after the due date. There is no educational or pedagogical reason
for tutors or experts outside the CMPT 145 instructional team to provide solutions to this question
to a student registered in the course. Students who solicit such solutions are committing an act of
Academic Misconduct, according to the University of Saskatchewan Policy on Academic Misconduct.
Note: a1q5 asks about your work on a1q4
Keep track of how long you spend working on this question, including time spent reading the ques-
tion, reviewing notes and the course readings, implementing the solution, testing, and preparing to
submit. Also keep track of how many times you experienced unscheduled interruptions, delays, or
distractions during your work; include things like social media, phone calls, texting, but not such
things as breaking for a meal, exercise, commuting to or from the university. In a1q5 you will be
asked to summarize the time you spend working on a1q4, and your answer will be more helpful to
you if you have more precise records. Maybe go and read Q5 before you start Q4?
The Torus Square
The following description considers the manipulation of a 3\times 3 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 youll 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 3\times 3 array of integers {0,,8} such as:
012
345
678
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:
201
345
678
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:
Page 8

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Discuss the history of human resource management (HRM).

Answered: 1 week ago