jamiecobbett / adventcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TriangleValidator

This project provides a script that counts the number of valid triangles in a file, where

In a valid triangle, the sum of any two sides must be larger than the remaining side. For example, the "triangle" given above is impossible, because 5 + 10 is not larger than 25.

See: http://adventofcode.com/2016/day/3

See data/input.txt for an example of the file format.

Installation

See .ruby-version for the expected Ruby version (2.3.3).

You can install Ruby any way you wish, though rbenv and it's companion ruby-build are an easy way to do it.

Then install bundler:

gem install bundler

Then install the project dependencies:

bundle install

Running the script

./bin/triangle_validator path/to/file.txt

For example:

./bin/triangle_validator data/input.txt

Running tests

bundle exec rspec spec/

About


Languages

Language:Ruby 100.0%