
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
spacecraft-app-cli
Advanced tools
A simple CLI Project to solve the Spacecraft problem with typescript
A simple CLI to solve the Spacecraft Problem, made with TypeScript
Let's build a rocket together!
Say, the Canadian Space Agency is building an unmanned spacecraft that’ll go to the moon.
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.
Pressing S
decreases the ship’s speed and then moves it forward by speed units.
Pressing A
and D
move the ship left and right by one unit respectively.
The ship also moves forward by speed units.
Write a CLI program in your preferred language to simulate the above spacecraft. Display output as follows:
(0, 0) ready for launch
.wrong trajectory
.minimum speed
.maximum speed
.(0, 250)
display on the moon
.contact lost
.(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.
(-1, 5) # A moves the ship left and forward.
(0, 7) # D moves the ship right and forward.
(0, 8) # S decreases the speed to 1 and moves forward.
...
(0, 250) on the moon # Ship reaches the moon
npm i -g spacecraft-app-cli
or
You can run directly with npx
npx spacecraft-app-cli
To get started locally, follow these instructions:
git
.yarn
installed; see instructions here.yarn install
to install dependencies.# starts 🚀 on coordinates (0,0) - Earth
yarn start
# Use W, A, S, or D to starting control 🚀 .
yarn build
yarn test
Copyright (c) 2020 pyymenta
Spacecraft is licensed under the MIT license.
FAQs
A simple CLI Project to solve the Spacecraft problem with typescript
The npm package spacecraft-app-cli receives a total of 0 weekly downloads. As such, spacecraft-app-cli popularity was classified as not popular.
We found that spacecraft-app-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.