Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chasmani/RubyBuildingBlocks

Some simple exercises completed in Ruby
https://github.com/chasmani/RubyBuildingBlocks

Last synced: about 2 months ago
JSON representation

Some simple exercises completed in Ruby

Awesome Lists containing this project

README

        

# RubyBuildingBlocks
Some simple exercises completed in Ruby

**my_enumerable**
Recreated some of the functionality of the Enumberable module in my own version.

**caesar_cipher**
Moves letters in a string up or down the alphabet.

**stock_picker**
Determines most profitable buy/sell option for a given stock where the price each day is given as an array of numbers.

**substrings**
Counts the instances of strings in a dictionary that occur in a given string. Returns the result in a hash of strings => occurences.

**bubble_sort**
Sorts an array using a simple bubble sort - comparing elements to their neighbours on the right and switching if <=> evaluates to greater than zero.

**bubble_sort_by**
Sorts an array using a bubble sort based on a condition passed in a block. If the block condition evaluates to greater than 1, the elements are switched.

**string_shuffle**
Takes a string and returns that string with the characters shuffled.

**fibonacci**
Prints a fibonacci sequence to a given length. Run through ruby interpreter in console.

**prime_factors**
Prints the prime factors of any given integer. Run through ruby interpreter in console.

**happy_numbers**
Prints the first 8 Happy Numbers, as defined on wikipedia here. Run through ruby interpreter in console.

**cost_of_tiles**
Asks the user for the height and width of a floor and the cost per unit square of tiles, then returns the total cost of tiling that floor. Run through ruby interpreter in console.

**dungeon_crawler**
A basic text based dungeon crawler adventure game. To play open the file with a ruby interpreter in the terminal. Eg $ruby dungeon_crawler.rb. Nowhere near complete, no error handling yet and not very fun because there are only 3 rooms.

**TicTacToe**
Play Tic Tac Toe on the command line with 2 players. To run simply open the file from the command line with a rubby interpreter. Eg $ruby TicTacToe.rb.