Code Monkey home page Code Monkey logo

relief-map's Introduction

Relief Map

The relief map is a map indicating hills and valleys by the use of different colors. The colors are indicated as follows:

  • Color.LIGHT_GRAY if the elevation is less than -10 feet
  • Color.GRAY if the elevation is greater than or equal to -10 and less than or equal to 1000
  • Color.GREEN if the elevation is greater than 1000 feet

Examples:

int[][] mapData =  new int[15][15];
Random gen = new Random(1234567);

for (int row = 0; row < 15; row++)
{
    for (int column = 0; column < 15; column++)
    {
        // get elevations between -100 and 2000 ft
        int elevation = gen.nextInt(210) * 10  - 100;
        mapData[row][column] = elevation;
    }
}

ReliefMap map = new ReliefMap(mapData);

int diff = map.maxDifference();
Text message = new Text(0, 180, "Difference: " + diff);
message.draw();

for (int row = 0; row < map.length; row++)
{
    for (int column = 0; column < map[0].length; column++)
    {

        System.out.print(map[row][column] + " " );
    }
    System.out.println();
}

Output:

relief-map's People

Contributors

ellelustrious avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.