Git Product home page Git Product logo

martian-robotd's Introduction

The challenge was solved using GOLANG

>Instructions:

It is necessary to have docker installed.

Building image

Before running the program it's necessary to build the image from our Dockerfile

# We need to be in the root directory of the project.

> docker build -t draftea-challenge .

Running container

We can run this program in two ways using docker:

Interactive mode

Writing position and instructions

> docker run -i --rm draftea-challenge

Example

5 3
-- New Robot --
1 1 E

RFRFRFRF
-- output --
 1 1 E 
------------

-- New Robot --
3 2 N

FRRFLLFFRRFLL
-- output --
 3 3 N LOST
------------

-- New Robot --
0 3 W

LLFFFLFLFL
-- output --
 2 3 S 
------------

Passing a file

Passing several operations from file.

> docker run -i --rm draftea-challenge < data.txt

Running with GO

# it's necessary to install GO and dependencies
go mod download 
go run ./cmd/cli/main.go < ./data.txt  

-- New Robot --
1 1 E

RFRFRFRF
-- last position --
    1 1 E 
-------------------

-- New Robot --
3 2 N

FRRFLLFFRRFLL
-- last position --
    3 3 N LOST
-------------------

-- New Robot --
0 3 W

LLFFFLFLFL
-- last position --
    2 3 S 
-------------------

-- Outputs --
    1 1 E 
    3 3 N LOST
    2 3 S

# Or just 
go run ./cmd/cli/main.go

5 3
1 1 E
-- New Robot --
1 1 E

RRFFRRFF
RRFFRRFF
-- last position --
    0 1 W LOST

Running tests

# it's necessary to install GO and dependencies
go mod download 
go test -v ./...

Documentation

** Comments clarify the code and they are added with purpose of making the code easier to understand.

** TODO: Add more unit tests

martian-robotd's People

Watchers

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