Cadence1 is an archaeologist who is currently well-known for exploring the deepest crypts and tombs of lost rulers while making striking discoveries that have been known to make a big impact to mankind’s history. However, during her latest expedition, she came upon the tomb of a Necromaster and her exploration has caused the aforementioned Necromaster to summon clones of the undead to prevent her from escaping! For your reference, observe the images below to indicate who Cadence is and the Clone respectively. Thanks to Cadence’s rather sharp memory, she was able to outrun the majority of the clones, but she finds out that the only thing separating her and freedom is a single clone. The aforementioned clone is rather unique as it seems to mimic Cadence’s movement and behaviour except that it goes the opposite direction of where she walks.  To illustrate this happening, observe the following figures showing what happens when Cadence moves right or up respectively.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Cadence1 is an archaeologist who is currently well-known for exploring the deepest crypts and tombs of lost rulers while making striking discoveries that have been known to make a big impact to mankind’s history. However, during her latest expedition, she came upon the tomb of a Necromaster and her exploration has caused the aforementioned Necromaster to summon clones of the undead to prevent her from escaping!

For your reference, observe the images below to indicate who Cadence is and the Clone respectively.

Thanks to Cadence’s rather sharp memory, she was able to outrun the majority of the clones, but she finds out that the only thing separating her and freedom is a single clone. The aforementioned clone is rather unique as it seems to mimic Cadence’s movement and behaviour except that it goes the opposite direction of where she walks. 

To illustrate this happening, observe the following figures showing what happens when Cadence moves right or up respectively.

When Cadence moves right, the Clone moves left.
When Cadence moves up, the Clone moves down.
4
From the two images alone, you can therefore infer that if Cadence moves left, the clone will move
right and if Cadence moves down, the Clone will move up.
To further give you a visual idea of the environment, you may picture the labyrinth Cadence is
stranded in as a 2D Cartesian plane.
The labyrinth is a 2D Cartesian plane. Assume that coordinates are in (x,y) format and the x and y
values can go beyond 6 or less than -6 respectively.
65 -3
6
31
4
Clone
(-5,-4)
-1
21
31
4
+5+
4
-6-5-4-3-2
12
Given the scenario, let us assume that Cadence's original location is at (1,2) while the Clone's
location is at (-5,-4).
6
5
-2
-31
4
+5
-6-
Cadence
(1,2)
45
Transcribed Image Text:When Cadence moves right, the Clone moves left. When Cadence moves up, the Clone moves down. 4 From the two images alone, you can therefore infer that if Cadence moves left, the clone will move right and if Cadence moves down, the Clone will move up. To further give you a visual idea of the environment, you may picture the labyrinth Cadence is stranded in as a 2D Cartesian plane. The labyrinth is a 2D Cartesian plane. Assume that coordinates are in (x,y) format and the x and y values can go beyond 6 or less than -6 respectively. 65 -3 6 31 4 Clone (-5,-4) -1 21 31 4 +5+ 4 -6-5-4-3-2 12 Given the scenario, let us assume that Cadence's original location is at (1,2) while the Clone's location is at (-5,-4). 6 5 -2 -31 4 +5 -6- Cadence (1,2) 45
If Cadence moves down twice, that will place her at (1,0) respectively. Her moving down will result in
the Clone moving up twice, placing it at (-5,-2). Cadence decides to move right 4 times, placing her at
(5,0), which will result in the Clone moving left 4 times, and placing it at (-9,2). Cadence decides to
move one more time upwards to place her at (5,1). Since Cadence moved up, the Clone will then
move down which makes its final position at (-9,-3).
Objective:
You are to write a program that will first ask for the location of Cadence and the clone respectively.
Afterwards, you are going to ask for a series of integers that correspond to Cadence's corresponding
movement. Assume that the character inputs are limited to the following: 1, 2, 3, 4, each of which
indicates a step of Cadence's movements, and a 0 which indicates the end of the program.
To clarify the following values represent a particular movement for Cadence:
1 refers to Cadence moving up
2 refers to Cadence moving down
3 refers to Cadence moving left
4 refers to Cadence moving right
The program should terminate when the user enters a 0 as an input. Afterwards, indicate the final
positions of Cadence and the Clone respectively. Add an additional remark indicating that Cadence is
safe IF Cadence and the Clone do not end up in the same quadrant. If they end up in the same
quadrant, indicate that Cadence is in danger.
Assumptions:
All inputs are valid and are integers (No need for error checking). Also, the test cases will
ensure that neither Cadence nor the Clone will end up in the X-Axis or the Y-Axis. It is
guaranteed that they will end up in either of the 4 quadrants in the cartesian plane.
Refer to the sample run(s) as a reference: (Values written in Blue indicate they are user inputs)
Sample Run 2
Enter Cadence's coordinates (x,y): 1 2
Enter clone's coordinates (x,y): 52
Sample Run 1
Enter Cadence's coordinates (x,y): 1 2
Enter clone's coordinates (x,y): -5 -4
2
Cadence's location: (5,1)
clone's location: (-9,-3)
Cadence is safe!
Cadence's location: (2,3)
clone's location: (4,1)
SAME QUADRANTS! Cadence is in danger!
¹Cadence and the provided images obtained from Crypt of the NecroDancer.
Copyright by Brace Yourself Games 2013-2021
Transcribed Image Text:If Cadence moves down twice, that will place her at (1,0) respectively. Her moving down will result in the Clone moving up twice, placing it at (-5,-2). Cadence decides to move right 4 times, placing her at (5,0), which will result in the Clone moving left 4 times, and placing it at (-9,2). Cadence decides to move one more time upwards to place her at (5,1). Since Cadence moved up, the Clone will then move down which makes its final position at (-9,-3). Objective: You are to write a program that will first ask for the location of Cadence and the clone respectively. Afterwards, you are going to ask for a series of integers that correspond to Cadence's corresponding movement. Assume that the character inputs are limited to the following: 1, 2, 3, 4, each of which indicates a step of Cadence's movements, and a 0 which indicates the end of the program. To clarify the following values represent a particular movement for Cadence: 1 refers to Cadence moving up 2 refers to Cadence moving down 3 refers to Cadence moving left 4 refers to Cadence moving right The program should terminate when the user enters a 0 as an input. Afterwards, indicate the final positions of Cadence and the Clone respectively. Add an additional remark indicating that Cadence is safe IF Cadence and the Clone do not end up in the same quadrant. If they end up in the same quadrant, indicate that Cadence is in danger. Assumptions: All inputs are valid and are integers (No need for error checking). Also, the test cases will ensure that neither Cadence nor the Clone will end up in the X-Axis or the Y-Axis. It is guaranteed that they will end up in either of the 4 quadrants in the cartesian plane. Refer to the sample run(s) as a reference: (Values written in Blue indicate they are user inputs) Sample Run 2 Enter Cadence's coordinates (x,y): 1 2 Enter clone's coordinates (x,y): 52 Sample Run 1 Enter Cadence's coordinates (x,y): 1 2 Enter clone's coordinates (x,y): -5 -4 2 Cadence's location: (5,1) clone's location: (-9,-3) Cadence is safe! Cadence's location: (2,3) clone's location: (4,1) SAME QUADRANTS! Cadence is in danger! ¹Cadence and the provided images obtained from Crypt of the NecroDancer. Copyright by Brace Yourself Games 2013-2021
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Probability Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education