GithubHelp home page GithubHelp logo

lostinspace's Introduction

Lost in Space: Code Your Way Back Home


Introduction:

Welcome to an exciting 2-hour lab experience! You are a crew member aboard the spaceship "CodeRunner," which is lost in a galaxy far, far away due to a navigation system failure. To get back to Earth, you'll need to solve a series of coding challenges using JavaScript. Are you ready to embark on this adventurous journey? Let's start!


Section 1: Power Up The Spacecraft

Time: 30 Minutes

Storyline:

The "CodeRunner" spaceship is out of power! The first task in getting yourself back home is to restart the ship's power generator. The generator is coded to restart when a specific sequence of codes is executed. You'll need to find that sequence and initiate the power-up sequence.

Objectives:

  1. Initialize the spaceship's systems.
  2. Generate the secret sequence code required for starting the power generator.
  3. Validate the generated sequence and restart the power generator.

Challenge 1: Initialize the Spaceship Systems

You need to define a JavaScript object to simulate the spaceship's systems.

const spaceship = {
  powerGenerator: false,
  navigationSystem: false,
  communicationSystem: false
};

Challenge 2: Generate Secret Sequence

Write a function that returns a random sequence of numbers between 1 and 10. This sequence will be the "key" to restarting the power generator.

function generateSequence() {
  // Your code here
}

Challenge 3: Validate Sequence and Restart Generator

Write another function that takes a sequence as an argument. If the sequence matches the secret sequence, set powerGenerator to true.

function validateSequence(sequence) {
  // Your code here
}

Challenge 4: Test Your Code

Now, generate a secret sequence and use your validate function to restart the power generator.

const secretSequence = generateSequence();
console.log("Secret Sequence Generated: ", secretSequence);

validateSequence(secretSequence);
console.log("Current Spaceship Status: ", spaceship);

Bonus:

  1. Add more complexity to the secret sequence generator.
  2. Add a countdown timer that simulates the urgency of restarting the generator.

Once you successfully complete Section 1, your spaceship's power generator will restart, enabling you to proceed to Section 2, where you'll work on the navigation system.

Remember, time is of the essence, and you have to get back home!


Next Level

lostinspace's People

Contributors

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