Flik is a smart digital ant. Write a python progrem that helps Flik to move in 4 directions: East, West, North, and South (Scc figure 1), just like we did with the Turtle, but be careful, you are not going to usc graphics windows, and you are not going to usc any of the methods in the Turtle module for that matter, All the West X-axis 0,0) East outputs should be printed on the IPython Console panc. 2. Ant position: The current position of the bug is represented in a two-dimensional planc as a pair of coordinates (x, y) in the Cartesian coordinate system shown in figure 1. South Figure 1: Coordinates system 3. Tasks: The bug can perform the following tasks: Move cast (i.e. to the right) byn steps. It requires updating the current position of the bug to the new position n steps to the right. Move west (i.c. to the left) by n steps. It requires updating the current position of the bug to the new position n steps to the left. Move north (i.e. upward) by n steps. It requires updating the current position of the bug to the new position n steps upward. Move south (i.c. downward) by n steps. It requires updating the current position of the bug to the new position n steps downward. Calculate the Euclidian distance from the current position of the bug to its initial position. The Euclidian distance d between two points PI= (xl, yl) and P2 = (x2, y2) is: d = (x1- x2)2 + (yl-y2)2 4. Program Your program should perform the following tasks: Read from a file called bugMoves.txt the initial position (x, y) of Flik Then read line by line the remaining contents of the file and update the current position of Flik accordingly, in order to build the path that Flick has followed from the start. Each subsequent line in the file represents a movement to be performed by the bug, See figure 2 (a). The movement of the bug is specified by the pair: [in meter]. For instance: north 5 means move north Once the reading is completed, the program displays the following: See Figure 2(b) 5 meters. The initial position of the ant Flik, The path Flik has followed ie the sequence of the successive bug's positions from its initial position to its final position, Flik's final position, and
Flik is a smart digital ant. Write a python progrem that helps Flik to move in 4 directions: East, West, North, and South (Scc figure 1), just like we did with the Turtle, but be careful, you are not going to usc graphics windows, and you are not going to usc any of the methods in the Turtle module for that matter, All the West X-axis 0,0) East outputs should be printed on the IPython Console panc. 2. Ant position: The current position of the bug is represented in a two-dimensional planc as a pair of coordinates (x, y) in the Cartesian coordinate system shown in figure 1. South Figure 1: Coordinates system 3. Tasks: The bug can perform the following tasks: Move cast (i.e. to the right) byn steps. It requires updating the current position of the bug to the new position n steps to the right. Move west (i.c. to the left) by n steps. It requires updating the current position of the bug to the new position n steps to the left. Move north (i.e. upward) by n steps. It requires updating the current position of the bug to the new position n steps upward. Move south (i.c. downward) by n steps. It requires updating the current position of the bug to the new position n steps downward. Calculate the Euclidian distance from the current position of the bug to its initial position. The Euclidian distance d between two points PI= (xl, yl) and P2 = (x2, y2) is: d = (x1- x2)2 + (yl-y2)2 4. Program Your program should perform the following tasks: Read from a file called bugMoves.txt the initial position (x, y) of Flik Then read line by line the remaining contents of the file and update the current position of Flik accordingly, in order to build the path that Flick has followed from the start. Each subsequent line in the file represents a movement to be performed by the bug, See figure 2 (a). The movement of the bug is specified by the pair: [in meter]. For instance: north 5 means move north Once the reading is completed, the program displays the following: See Figure 2(b) 5 meters. The initial position of the ant Flik, The path Flik has followed ie the sequence of the successive bug's positions from its initial position to its final position, Flik's final position, and
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...
Related questions
Question
Use Python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY