You are in an uncharted territory deep in the Amazon jungle. There is a buried treasure in the vicinity. You know its location, but the terrain is dangerous. You see three terrain types: FLAT(J. WATER(-), and HILL() You need to map out the region to find the safest route to the treasure. Your map is a two-dimensional grid, with columns)X) and rows(Y). The top-left corner of the map is XY 8,0. Columns increase to the right: rows increase down. The sample map below shows youle) at coordinate and the treasure($) at coordinate 4,4 Your goal is to complete the real map, display it, and calculate the risk factor of the terrain between you and the treasure. Your terrain expertise reveals the following information: • The elevation of the entire area is 2a • You are at coordinate 2,0- • The treasure is at coordinate ,20 Calculate the topographic index for each coordinate on the map. For any other coordinate on the map, the topographic index is calculated as follows. Start at your location and work left to-right, then top-to-bottom. Here is the calculation (apply the first opplicable rule only): 1. The topographic index at your location is . 2. The topographic index at the treasure location is a. 3. If the coordinate is a. the topographic index is its 3 coordinate times 157 4. If the 3 coordinate is e, the topographic index is its coordinate times as271 5. For all other coordinates, the topographic index is the result of multiplying the erosion levels of the regions at 1,Y and x,Y-1 • For any coordinate on the map, the erosion level is the result of adding its topographic index and the elevation, then performing modulo 203s3. • The terrain type of a coordinate is calculated as follows: • If erosion level modulo a is e, the terrain type is FLAT. • If erosion level modulo 3 is 1, the terrain type is WATER. • If erosion level modulo a is 2, the terrain type is HILL • The overall risk factor between you and the treasure is calculated as follows: • FLAT regions have a risk factor of a. WATER regions have a risk factor of 1. HILL regions have a risk factor of 2. • The overall risk factor is the sum of the risk factors of the regions between you and the treasure. That is, it is the sum of the risk factors of the regions that have coordinates in the range . and coordinates in the range e..2. • For example, the overall risk factor of the sample map above is 3. Create the treasure map • Save the program to a file named 5.ja. • Randomly generate the characters. Remember, there is only one "e" (you) and only one "S" (treasure). Leave the "e" at position 0. 0. • Output the map to the console, using the characters and colors in the sample above • Display FLAT() regions with a Bright vellon foreground color. • Display WATERI-) regions with a Bright Eyan foreground color. • Display HILL(") regions with a shite foreground color. • Display you(@) with a black foreground color andahite background color. • Display the treasure(s) with a black foreground color and Bright vellow background color. Output the overall risk factor of the area to the console. • Submit 5.js to Canvas.

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
100%

need help with node.js

You are in an uncharted territory deep in the Amazon jungle. There is a buried treasure in the vicinity. You know its
location, but the terrain is dangerous. You see three terrain types: FLAT(). WATER(-), and HILL(^). You need to map out
the region to find the safest route to the treasure. Your map is a two-dimensional grid, with columns(X) and rows(Y). The
top-left corner of the map is X.Y 8,0. Columns increase to the right; rows increase down. The sample map below shows
you(@) at coordinate ,0 and the treasure($) at coordinate 4,4:
Your goal is to complete the real map, display it, and calculate the risk factor of the terrain between you and the
treasure. Your terrain expertise reveals the following information:
• The elevation of the entire area is 248
• You are at coordinate e,e).
• The treasure is at coordinate se,20.
• Calculate the topographic index for each coordinate on the map. For any other coordinate on the map, the
topographic index is calculated as follows. Start at your location and work left-to-right, then top-to-bottom. Here is
the calculation (apply the first applicable rule only):
1. The topographic index at your location is 0.
2. The topographic index at the treasure location is a.
3. If the y coordinate is e, the topographic index is its X coordinate times 15s87
4. If the coordinate is a. the topographic index is its (Y coordinate times 48271).
5. For all other coordinates, the topographic index is the result of multiplying the erosion levels of the regions at (x
1,Y and (x, Y-1.
• For any coordinate on the map, the erosion level is the result of adding its topographic index and the elevation, then
performing modulo 28183
• The terrain type of a coordinate is calculated as follows:
• If erosion level modulo a is a, the terrain type is FLAT.
• If erosion level modulo 3 is 1, the terrain type is WATER.
• If erosion level modulo 3 is 2, the terrain type is HILL.
• The overall risk factor between you and the treasure is calculated as follows:
• FLAT regions have a risk factor of e. WATER regions have a risk factor of 1. HILL regions have a risk factor of 2.
• The overall risk factor is the sum of the risk factors of the regions between you and the treasure. That is, it is the
sum of the risk factors of the regions that have (x coordinates in the range (0..se and Y coordinates in the
range e..20).
• For example, the overall risk factor of the samp
map above is 2)
Create the treasure map
• Save the program to a file named (s.js.
• Randomly generate the characters. Remember, there is only one "@" (you) and only one "$" (treasure). Leave the
"@" at position 0, 0.
• Output the map to the console, using the characters and colors in the sample above:
• Display FLAT(.) regions with a Bright vellon foreground color.
• Display WATER(--) regions with a Bright Cyan foreground color.
• Display HILL(^) regions with a white foreground color.
• Display you(e with a black foreground color and white background color.
• Display the treasure($) with a black foreground color and Bright Yellow background color.
• Output the overall risk factor of the area to the console.
• Submit 5.js to Canvas.
Transcribed Image Text:You are in an uncharted territory deep in the Amazon jungle. There is a buried treasure in the vicinity. You know its location, but the terrain is dangerous. You see three terrain types: FLAT(). WATER(-), and HILL(^). You need to map out the region to find the safest route to the treasure. Your map is a two-dimensional grid, with columns(X) and rows(Y). The top-left corner of the map is X.Y 8,0. Columns increase to the right; rows increase down. The sample map below shows you(@) at coordinate ,0 and the treasure($) at coordinate 4,4: Your goal is to complete the real map, display it, and calculate the risk factor of the terrain between you and the treasure. Your terrain expertise reveals the following information: • The elevation of the entire area is 248 • You are at coordinate e,e). • The treasure is at coordinate se,20. • Calculate the topographic index for each coordinate on the map. For any other coordinate on the map, the topographic index is calculated as follows. Start at your location and work left-to-right, then top-to-bottom. Here is the calculation (apply the first applicable rule only): 1. The topographic index at your location is 0. 2. The topographic index at the treasure location is a. 3. If the y coordinate is e, the topographic index is its X coordinate times 15s87 4. If the coordinate is a. the topographic index is its (Y coordinate times 48271). 5. For all other coordinates, the topographic index is the result of multiplying the erosion levels of the regions at (x 1,Y and (x, Y-1. • For any coordinate on the map, the erosion level is the result of adding its topographic index and the elevation, then performing modulo 28183 • The terrain type of a coordinate is calculated as follows: • If erosion level modulo a is a, the terrain type is FLAT. • If erosion level modulo 3 is 1, the terrain type is WATER. • If erosion level modulo 3 is 2, the terrain type is HILL. • The overall risk factor between you and the treasure is calculated as follows: • FLAT regions have a risk factor of e. WATER regions have a risk factor of 1. HILL regions have a risk factor of 2. • The overall risk factor is the sum of the risk factors of the regions between you and the treasure. That is, it is the sum of the risk factors of the regions that have (x coordinates in the range (0..se and Y coordinates in the range e..20). • For example, the overall risk factor of the samp map above is 2) Create the treasure map • Save the program to a file named (s.js. • Randomly generate the characters. Remember, there is only one "@" (you) and only one "$" (treasure). Leave the "@" at position 0, 0. • Output the map to the console, using the characters and colors in the sample above: • Display FLAT(.) regions with a Bright vellon foreground color. • Display WATER(--) regions with a Bright Cyan foreground color. • Display HILL(^) regions with a white foreground color. • Display you(e with a black foreground color and white background color. • Display the treasure($) with a black foreground color and Bright Yellow background color. • Output the overall risk factor of the area to the console. • Submit 5.js to Canvas.
Expert Solution
Step 1

Node.js

Node.js is a worker side stage based on Google Chrome's JavaScript Engine (V8 Engine). Node.js was created by Ryan Dahl in 2009 and its most recent variant is v0.10.36. The meaning of Node.js as provided by its official documentation is as per the following − 

Node.js is a stage based on Chrome's JavaScript runtime for effectively fabricating quick and versatile organization applications. Node.js utilizes a function driven, non-obstructing I/O model that makes it lightweight and effective, ideal for information concentrated continuous applications that stumble into dispersed gadgets. 

Node.js is an open source, cross-stage runtime climate for creating worker side and systems administration applications. Node.js applications are written in JavaScript, and can be run inside the Node.js runtime on OS X, Microsoft Windows, and Linux. 

Node.js likewise gives a rich library of different JavaScript modules which streamlines the improvement of web applications utilizing Node.js generally.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Network Protocols
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
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