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.
need help with node.js
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.
Step by step
Solved in 2 steps