Giter Club home page Giter Club logo

toy-robot-sim's Introduction

Toy Robot Simulator (Node.js + TypeScript)

CLI app written in Node.js + TypeScript, bootstrapped with the oclif framework.

How to run the project

This app is tested against Node 12, 14 and 16 โ€” please ensure that you have one of these versions installed and active when running it. nvm is recommended as an option for managing multiple Node versions in your dev environment.

This app is currently only tested on macOS and Linux, but should work on Windows (although the example usages that use stdin will probably need tweaking).

# Clone the git repo
$ git clone https://github.com/Oneiriac/toy-robot-sim.git
$ cd toy-robot-sim

# Install dependencies
$ yarn

# Install to get robotsim on your PATH
$ npm install -g .
# Read from file
$ robotsim run test/inputs/example-A.txt
0,1,NORTH
# Or read from stdin
$ cat test/inputs/example-A.txt | robotsim run --stdin

# Alternatively, run robotsim using bin/dev in the repo
$ bin/dev run test/inputs/example-B.txt
0,0,WEST

# Run the Mocha tests in the test folder
$ yarn test
...

# Run ESLint
$ yarn lint
...

Usage (auto-generated by oclif)

$ npm install -g toy-robot-sim
$ robotsim COMMAND
running command...
$ robotsim (--version)
toy-robot-sim/0.1.1 darwin-x64 node-v12.22.1
$ robotsim --help [COMMAND]
USAGE
  $ robotsim COMMAND
...

Commands (auto-generated by oclif)

robotsim help [COMMAND]

Display help for robotsim.

USAGE
  $ robotsim help [COMMAND] [-n]

ARGUMENTS
  COMMAND  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for robotsim.

See code: @oclif/plugin-help

robotsim run [FILEPATH]

Run robot simulator with input from either stdin or a text file

USAGE
  $ robotsim run [FILEPATH] [-s]

ARGUMENTS
  FILEPATH  input file to parse (if --stdin / -s is not provided)

FLAGS
  -s, --stdin  read stdin

DESCRIPTION
  Run robot simulator with input from either stdin or a text file

EXAMPLES
  $ echo "PLACE 0,1,NORTH\nREPORT" | robotsim run -s
  0,1,NORTH
  # input.txt contents
  # PLACE 0,0,NORTH
  # MOVE
  # REPORT
  $ robotsim run input.txt
  0,1,NORTH

See code: dist/commands/run.ts

toy-robot-sim's People

Contributors

oneiriac 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.