Skip to content

Commit

Permalink
Merge pull request #46 from Ondkloss/master
Browse files Browse the repository at this point in the history
Documentation improvements
  • Loading branch information
pyymenta authored Oct 5, 2020
2 parents 54a5d8e + f96a828 commit aaecec0
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
# Spacecraft

![image](https://travis-ci.org/pyymenta/spacecraft-cli.svg?branch=master)
![GitHub](https://img.shields.io/github/license/pyymenta/spacecraft-cli)
![GitHub contributors](https://img.shields.io/github/contributors/pyymenta/spacecraft-cli)
[![Build status](https://travis-ci.org/pyymenta/spacecraft-cli.svg?branch=master)](https://travis-ci.org/github/pyymenta/spacecraft-cli)
[![License](https://img.shields.io/github/license/pyymenta/spacecraft-cli)](https://github.com/pyymenta/spacecraft-cli/blob/master/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/pyymenta/spacecraft-cli)](https://github.com/pyymenta/spacecraft-cli/graphs/contributors)

A simple CLI to solve the Spacecraft Problem, made with [TypeScript](https://www.typescriptlang.org/)

Let's build a rocket together!

![image](./rocket.jpg)
![Image of a rocket](./rocket.jpg)

## The Problem
Say, the Canadian Space Agency is building an unmanned spacecraft that’ll go to the moon.

![to the moon](https://i.imgur.com/15vvnfN.png)
Say, the Canadian Space Agency is building an unmanned spacecraft that’ll go to the moon.

![To the moon](https://i.imgur.com/15vvnfN.png)

Here’s some more info about the project.

* The ship’s starting coordinates are `(0, 0)`, which is on Earth.
* The ship’s final destination is `(0, 250)`, which is on the moon.
* The ship will be controlled over a CLI using a standard keyboard as follows:

* The ship starts at `(0, 0)` at 0 speed, i.e. at complete rest.
The ship only moves when a valid key is pressed.
* Pressing `W` increases the ship’s speed and then moves it forward by speed units.
* The ship’s maximum speed is 5.
* The ship’s maximum speed is 5.
* Pressing `S` decreases the ship’s speed and then moves it forward by speed units.
* The ship’s minimum speed is 0.
* After launch, the ship cannot go below speed 1, i.e. it always moves forward until it reaches the moon.
* The ship’s minimum speed is 0.
* After launch, the ship cannot go below speed 1, i.e. it always moves forward until it reaches the moon.

* Pressing `A` and `D` move the ship left and right by one unit respectively.
* The ship also moves forward by speed units.

## Problem

Write a CLI program in your preferred language to simulate the above spacecraft. Display output as follows:

* Begin with `(0, 0) ready for launch`.
Expand All @@ -47,7 +50,8 @@ Write a CLI program in your preferred language to simulate the above spacecraft.


## Sample output
```

```none
(0, 0) # Begin with original position.
(0, 1) # W increases the speed to 1 and moves forward.
(0, 3) # W increases the speed to 2 and moves forward.
Expand All @@ -64,10 +68,10 @@ Write a CLI program in your preferred language to simulate the above spacecraft.

To get started locally, follow these instructions:

1. Clone to your local computer using `git`.
2. Make sure you have Node installed; see instructions [here](https://nodejs.org/en/download/).
3. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
4. Run `yarn install` to install dependencies.
1. Clone to your local computer using `git`.
2. Make sure you have Node installed; see instructions [here](https://nodejs.org/en/download/).
3. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
4. Run `yarn install` to install dependencies.

## Usage

Expand Down

0 comments on commit aaecec0

Please sign in to comment.