This program processes the input data to find concentrated areas of water presence. The analysis consists of generating a score for each location on the grid to find and show the t highest rated locations and their respective scores.
Requirements:
- Ruby 2.7
- Bundler 1.17.4 (the old version is due to compatibility issues with padrino)
- padrino 0.14.4 (only for web app usage)
If you do not have ruby installed in your machine you might want to check first the ruby installation instructions (better to use the rbenv option). Once you have ruby installed you can install the rest of requirements with:
$ gem install bundler -v 1.17.3
$ gem install padrino
In order to install the water-detector program you need to run the following command from within the water-detector folder:
$ bundler _1.17.4_ install --path=vendor/bundle
To execute the program from the command line you must run:
$ ruby water_detector.rb [t] [n] [grid]
where:
- t is the number of results requested
- n is the size of the grid
- grid is a space delimited list of numbers that form the grid, starting with row 0
To run as web app you need to have installed padrino (see requirements), a lightweight alternative to Rails.
Once installed, you may start the server from the project folder with:
$ padrino start
The web app will be then accessible at http://localhost:3000
All tests can be executed at once by running from the project folder:
$ rspec