GithubHelp home page GithubHelp logo

happy-birthday-seth's Introduction

Happy birthday, Seth!!!

Task: Solve the following Caesar cipher challenge to get to your birthday surprise.

Your birthday surprise is at: "Hgx Angwkxw Hkvatkw Khtw, Vhgvhkwx Ahmxe & Lahiibgz Ftee, #sxkhmph-yhkmrmakxx". Pass all the tests to find out where that is!

Instructions

  1. Clone this repository
  2. Install dependencies: npm install
  3. Run mocha test.js --watch (to terminate the tests, hit Ctrl C)
  4. To activate the next test, change xit(...) to it(...) in test.js (x is mocha's way of skipping tests')
  5. Implement your solution in solution.js
  6. When all tests have passed, run node solution.js "Hgx Angwkxw Hkvatkw Khtw, Vhgvhkwx Ahmxe & Lahiibgz Ftee, #sxkhmph-yhkmrmakxx"
  7. Get to your birthday surprise!

What is a Caesar cipher?

Given 2 arguments (string and shiftAmount), encrypt(string, shiftAmount) will convert a given string into a Caesar cipher by shifting each letter in the string "up" by the amount as indicated by shiftAmount.

Similarly, decrypt(string, shiftAmount) will decrypt a caesar cipher into a string by shifting each letter in the encrypted string "down" by the amount indicated by shiftAmount

Both encrypt(string, shiftAmount) and decrypt(string, shiftAmount) applies only to upper-case and lower-case alphabets (i.e. it does not shift non-alphabetical characters such as -, _, #, <space>, !!, etc). The second argument to the decrypt(string, shiftAmount) and encrypt(string, shiftAmount) (i.e. shiftAmount) will be a positive number greater than 0.

Examples:

  • encrypt('abc', 1) would move each letter "up" by 1 charCode and return bcd.
  • encrypt('abc', 2) would move each letter "up" by 2 charCodes and return cde.
  • decrypt('cde', 2) would move each letter "down" by 2 charCodes and return abc.
  • encrypt("it's my birthday", 1) would move each letter up by 1 charCode and return ju't nz cjsuiebz
  • decrypt("ju't nz cjsuiebz", 1) would return it's my birthday

Hint:

happy-birthday-seth's People

Contributors

davidtan-tw avatar

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.