Basic Problems - http://www.theodinproject.com/ruby-programming/building-blocks
A caesar cipher is an elementary encryption technique of shifting each character forward or backword by a particular amount.
- Implement a caesar cipher that takes in a string and the shift factor and then outputs the modified string
- Don't forget to wrap from z to a
- Don't forget to keep the same case
A simple program to identify the best single trading opportunity between a set of daily market prices, and report the correct days for the opportunity to the user.
- Implement a method #stock_picker that takes in an array of stock prices, one for each hypothetical day. It should return a pair of days representing the best day to buy and the best day to sell
Provided a dictionary of words to check for, the task was to search a user's input string for instances of each word in the dictionary and report this data to the user.
- Implement a method #substrings that takes a word as the first argument and then an array of valid substrings (your dictionary) as the second argument. It should return a hash listing each substring (case insensitive) that was found in the original string and how many times it was found
- Make sure your method can handle multiple words
Advanced Problems - http://www.theodinproject.com/ruby-programming/advanced-building-blocks
The classic bubble sort. Iterations through the supplied set of numbers continue, comparing each element to each successive elements, and swapping positions if the first is greater than the second. With each pass, the largest values "bubble" to one side, eventually sorting the entire set.
- Build a method #bubble_sort that takes an array and returns a sorted array. It must use the bubble sort methodology
- Create a similar method called #bubble_sort_by which sorts an array but accepts a block. The block should take two arguments which represent the two elements currently being compared. Expect that the block's return will be similar to the spaceship operator you learned about before -- if the result of the block is negative, the element on the left is "smaller" than the element on the right. 0 means they are equal. A positive result means the left element is greater. Use this to sort your array
A task to build many of the built-in sorting methods by hand, to explore enumerable type functionality.
- Add your new methods onto the existing Enumerable module
- Create #my_each, a method that is identical to #each but (obviously) does not use #each. You'll need to remember the yield statement. Make sure it returns the same thing as #each as well
- Create #my_each_with_index in the same way
- Create #my_select in the same way, though you may use #my_each in your definition
- Create #my_all? #my_any? #my_none? #my_count #my_map #my_inject
- Test your #my_inject by creating a method called #multiply_els which multiplies all the elements of the array together by using #my_inject
- Modify your #my_map method to take a proc instead
- Modify your #my_map method to take either a proc or a block, executing the block only if both are supplied (in which case it would execute both the block AND the proc)
OOP With Ruby - http://www.theodinproject.com/ruby-programming/oop
Build a console version of the classic game tic-tac-toe using Ruby and Class/Object-Oriented design. My solution can be previewed at: http://runnable.com/VMa_BOd2DOlKjbrq/odin-ruby-tictactoe
Implement a console version of the 1970 board game "Mastermind" in using Ruby and OOP. This solution is still a work in progress but can be previewed at: http://runnable.com/VMdPpf-Mig8vm1fi/%5Bwip%5D-the-odin-project-section-3-ruby-programming-mastermind