rainDelay9 / weary-array-traveler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

weary-array-traveler

This is a python CLI solver for the weary array traveler problem

Installation (UNIX)

  1. Clone the directory:
git clone https://github.com/rainDelay9/weary-array-traveler.git
  1. cd into the project directory and execute:
pip install -e .
  1. run help:
weary --help

Output should look like this:

Usage: weary [OPTIONS]

  This script checks whether there's a path from start to finish in a weary
  array traveler problem. Currently acceptes csv, tsv and json file formats.

Options:
  -t, --type [CSV|TSV|JSON]  input format  [required]
  -f, --file TEXT            input file (takes precedence over input string)
  -a, --arr TEXT             input string
  --help                     Show this message and exit.

Execution examples

These are some execution examples. For stress testing (arrays with ~8000 elements) see examples/superlong_true.csv and examples/superlong_false.csv.

> weary --type csv --file examples/true.csv
Input:  [4, 4, 1, 1, 2, 2, 1000, 1]
Result:  Path exists!
> weary -t json -f examples/false.json
Input:  [4, 2, 1, 3, 2, 2, 1000, 1]
Result:  Path does not exist!
> weary -t csv --arr "4, 2, 1, 3, 2, 2, 1000, 1"
Input:  [4, 2, 1, 3, 2, 2, 1000, 1]
Result:  Path does not exist!

About


Languages

Language:Python 100.0%