There is a matrix Q of dimension NxN, which describes the characteristics of a certain area: in each location (x,y) of the matrix Q stores the proportion of square surface in the coordinate (x,y) of the area. The mouse starts from an initial position (x0,y0), and the program should print out the coordinates of all the squares the mouse will pass threuch when it moves following the rules as follows: The mouse moves to one of the 8 surrounding squares at each step The mouse chooses the square with the largest proportion of square surface among the 8 ones to move to • The mouse stops if all the 8 surrounding squares have lower or equal proportion of square surface with respect to the square it is currently on Example: Assuming we have the following Q matrix of size 10*10, and the mouse starts at the location (3,7). Then the mouse will move following: (3,7) (4,8) (5,8) (6,8) (7,9). And it will stop at location (7,9). 1 | 4 5 6 7 8 9 2 0.1 0.1 3 10 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.3 0.3 0.5 0.5 0.3 0.3 0.1 3 0.1 0.1 0.2 0.2 0.3 0.3 0.3 0.3 0.5 0.5 0.5 0.5 0.7 0.1 0.1 0.4 0.7 0.8 0.7 0.9 0.8 4 0.5 0.1 0.2 0.4 0.5 0.5 0.7 0.7 0.7 0.8 0.1 0.1 0.4 0.2 0.2 0.4 0.2 0.1 0.4 0.4 0.1 0.1 0.4 0.5 0.5 0.7 0.7 0.8 0.8 0.9 14 0.9 0.1 0.1 0.4 0.4 1.2 0.1 0.1 0.2 0.1 1.1 0.1 0.4 0.5 0.1 0.7 0.1 0.9 0.1 0.4 0.8 0.1 10 0.1 0.1 0.1 0.1 When testing the program at first, you can initialize the matrix and start point statically in your code. And afterwards, change the program to load the matrix from file and read the start point location from keyboard.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

can you solve this example in c programming language?

There is a matrix Q of dimension NxN, which describes the characteristies
of a certain area: in each location (x,y) of the matrix Q stores the
proportion of square surface in the coordinate (x,y) of the area. The mouse
starts from an initial position (x0,y0), and the program should print out the
coordinates of all the squares the mouse will pass throuch when it moves
following the rules as follows:
The mouse moves to one of the 8 surrounding squares at each step
The mouse chooses the square with the largest proportion of square
surface among the 8 ones to move to
The mouse stops if all the 8 surrounding squares have lower or
equal proportion of square surface with respect to the square it is
currently on
Example: Assuming we have the following Q matrix of size 10*10, and
the mouse starts at the location (3,7). Then the mouse will move
following: (3,7) (4,8) (5,8) (6,8) (7,9). And it will stop at location (7,9).
3
8 9
4
0.1
0.1
7
0.1
1
10
0.1
0.1
0.2
1
0.1
0.1
0.1
0.1
0.1
0.1
0.2
0.2
0.2
0.3
0.3
0.3
0.3
0.1
3
4
0.1
0.1
0.2
0.2
0.3
0.3
0.3
0.3
0.4
0.4
0.5
0.5
0.5
0.5
0.5
0.5
0.7
0.5
0.7
0.1
0.1
0.8 0.7
0.9 0.8
5
0.1
0.2
0.2
0.4
0.4
0.5
0.5
0.7
0.7
0.7
0.8
0.1
6.
0.1
0.4
0.1
0.1
0.1
0.2
0.2
0.4
0.4
0.4
0.4
1.4
0.9
0.5
0.7
0.7
0.8
0.9
0.1
0.1
0.5
0.5
0.1
0.8
0.8
1.2
1.1
0.1
0.2
0.4
0.4
0.7
0.1
0.9
0.1
0.1
10
0.1
0.1
0.1
0.1
0.1
0.1
0.1
When testing the program at first, you can initialize the matrix and start
point statically in your code. And afterwards, change the program to load
the matrix from file and read the start point location from keyboard.
0000
135 76
1355
000 00
124 SSS
123
122 222
Transcribed Image Text:There is a matrix Q of dimension NxN, which describes the characteristies of a certain area: in each location (x,y) of the matrix Q stores the proportion of square surface in the coordinate (x,y) of the area. The mouse starts from an initial position (x0,y0), and the program should print out the coordinates of all the squares the mouse will pass throuch when it moves following the rules as follows: The mouse moves to one of the 8 surrounding squares at each step The mouse chooses the square with the largest proportion of square surface among the 8 ones to move to The mouse stops if all the 8 surrounding squares have lower or equal proportion of square surface with respect to the square it is currently on Example: Assuming we have the following Q matrix of size 10*10, and the mouse starts at the location (3,7). Then the mouse will move following: (3,7) (4,8) (5,8) (6,8) (7,9). And it will stop at location (7,9). 3 8 9 4 0.1 0.1 7 0.1 1 10 0.1 0.1 0.2 1 0.1 0.1 0.1 0.1 0.1 0.1 0.2 0.2 0.2 0.3 0.3 0.3 0.3 0.1 3 4 0.1 0.1 0.2 0.2 0.3 0.3 0.3 0.3 0.4 0.4 0.5 0.5 0.5 0.5 0.5 0.5 0.7 0.5 0.7 0.1 0.1 0.8 0.7 0.9 0.8 5 0.1 0.2 0.2 0.4 0.4 0.5 0.5 0.7 0.7 0.7 0.8 0.1 6. 0.1 0.4 0.1 0.1 0.1 0.2 0.2 0.4 0.4 0.4 0.4 1.4 0.9 0.5 0.7 0.7 0.8 0.9 0.1 0.1 0.5 0.5 0.1 0.8 0.8 1.2 1.1 0.1 0.2 0.4 0.4 0.7 0.1 0.9 0.1 0.1 10 0.1 0.1 0.1 0.1 0.1 0.1 0.1 When testing the program at first, you can initialize the matrix and start point statically in your code. And afterwards, change the program to load the matrix from file and read the start point location from keyboard. 0000 135 76 1355 000 00 124 SSS 123 122 222
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY