Git Product home page Git Product logo

odin-project-basic-ruby-projects's Introduction

Basic Ruby Projects from The Odin Project

Table of Contents

Caeser Cipher

Information

The caeser cipher is long used cipher in cryptography, traced by to Julius Caeser and his personal correspondance (hence the name). According to Wikipedia:

In cryptography, a Caesar cipher, also known as Caesar’s cipher, the shift cipher, Caesar’s code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on.

In this project, the caeser cipher is implemented using Ruby. This project is part of The Odin Project's Ruby Programming curriculum. The project information can be found here. The expected output for this project should be:

> caeser_cipher("What a string!", 5)
=> "Bmfy f xywnsl!"

Project Status

At this time, the project is finished.

Instructions

To use this program, Ruby will need to be installed. This program is build on Ruby v2.6.5p114. To check your current version:

ruby -v

If you have a compatible version, this program can be run using this command in the directory the file is saved:

ruby caeser-cipher.rb

This program does have user input capabilities, however they have not been completely tested.

Sub Strings

Information

This function takes a word/phrase and a dictionary of words (as an array) as inputs to the functions. The function then returns a hash with each word found from the dictionary found in the word/phrase and the number of occurences. This project is implemented using Ruby as part of The Odin Project's Ruby Programming curriculum. The project information can be found here. The expected output for this project should be:

> dictionary = ["below","down","go","going","horn","how","howdy","it","i","low","own","part","partner","sit"]

> substrings("below", dictionary)
=> {"below"=>1, "low"=>1}

> substrings("Howdy partner, sit down! How's it going?", dictionary)
=> {"how"=>2, "howdy"=>1, "part"=>1, "partner"=>1, "it"=>2, "i"=>3, "sit"=>1, "down"=>1, "own"=>1, "go"=>1, "going"=>1}

Project Status

At this time, the project is finished.

Instructions

To use this program, Ruby will need to be installed. This program is build on Ruby v2.6.5p114. To check your current version:

ruby -v

If you have a compatible version, this program can be run using this command in the directory the file is saved:

ruby sub-string.rb

Stock Picker

Information

This program takes an array of stock prices and tells the user what the best day to buy and sell the said stock is. These two days are returned, as well as the profit margin for these days. This project is implemented using Ruby as part of The Odin Project's Ruby Programming curriculum. The project information can be found here. The expected output for this project should be:

> stock_picker([17,3,6,9,15,8,6,1,10])
=> [1,4]
=> "Profit: 12"

Project Status

At this time, the project is finished.

Instructions

To use this program, Ruby will need to be installed. This program is build on Ruby v2.6.5p114. To check your current version:

ruby -v

If you have a compatible version, this program can be run using this command in the directory the file is saved:

ruby sub-string.rb

Bubble Sort

Information

This program takes an array and then returns the array sorted. This program is implemented using a bubble sort. In a bubble sort, each element is compared to the one next to it and they are swapped if the one on the left is larger than the one on the right. This continues until the array is eventually sorted. This project is implemented using Ruby as part of The Odin Project's Ruby Programming curriculum. The project information can be found here. The expected output for this project should be:

> bubble_sort([4,3,78,2,0,2])
=> [0, 2, 2, 3, 4, 78]

Project Status

At this time, the project is finished.

Instructions

To use this program, Ruby will need to be installed. This program is build on Ruby v2.6.5p114. To check your current version:

ruby -v

If you have a compatible version, this program can be run using this command in the directory the file is saved:

ruby bubble-sort.rb

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.