Warnigo / spaceship

my first spaceship

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to MY SPACESHIP

Description

You have been recently been hired by SpacePro, a new rocket manufacturer, and have been tasked with designing a simulator for their spaceships. This simulator creates a virtual “space” and keeps track of the basic movements and direction of a given ship. Your job is to keep track of where the ship is and it’s orientation relative to its starting point.

Instructions

Your ship simulator must take in a string of letters that represent a planned flight path for a given rocket ship.

In a ship’s flight path there are only 3 valid options for movement; R for turning right, L for turning left and A for advancing.

If, for example, you receive “RRALAA” as your flight path, you should interpret it as the following: Turn right, turn right, advance, turn left, advance, advance Once given this initial flight path, your program must return the x,y coordinates of a ship’s final destination as well as it’s orientation relative to the starting point.

Orientation is represented as left, right, up or down.

Space is infinite, so the x,y coordinates you return could be placed on a seemingly infinite grid and can be negative or positive values.

So let's say an upward-facing rocket ship leaves its starting point of 0,0 and is given the flight path of “RRALAA”, its final location will be 2,-1 and it will be facing right.

Detail

We are using Computer Graphics Coordinate System (https://fcs-cs.github.io/cs1-2018/modules/01-introduction/computer-coordinates/)

Notes

Thank you for
your attention

this is result image

About

my first spaceship

License:MIT License


Languages

Language:JavaScript 100.0%