This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screen cast 18, 19 and 20 | |
# So I combined all these, I hope that is ok!! | |
=begin | |
Create a class called Person. | |
Add methods to it that let you change the person’s age, occupation, and mood. | |
Then add methods named age, occupation, and mood which give return values of the age, occupation, and mood respectively. | |
Then add a method that nicely displays a summary of the person’s info, including the age, occupation, and mood. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screen cast 17 | |
class Calculator | |
include Math | |
def add(num1, num2) | |
num1 + num2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screen cast 16 | |
# so I guess I @cheated!! | |
class Car | |
def new_car | |
@mercedes = [] | |
end | |
def engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def musical_instruments | |
instrument = Drums.new | |
puts "I own a #{instrument.size} #{instrument.set_name} set of drums" | |
end | |
def own_a_dog | |
milo = Dog.new | |
"My dogs name is #{milo.name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screen cast 13 | |
state_capitals = { "Colorado" => "Denver", | |
"Kentucky" => "Frankfort", | |
"Illinois" => "Springfield", | |
"Minnesota" => "Saint Paul", | |
"Mississippi" => "Jackson" } | |
puts "I can tell you the capital of any of these states:" | |
state_capitals.each { |key, _| puts key } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screen cast 11 | |
puts "Please enter 5 words, any words" | |
words = [] | |
number = 0 | |
5.times do | |
puts "Enter word number #{number += 1}" | |
words << gets.chomp | |
end | |
words.each_with_index do |word, index| | |
puts index.even? ? word.upcase : word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screencast #10 | |
# puts "Please enter a word, any word" | |
# word = gets.chomp | |
# word = word.split("") | |
# puts word.shuffle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
# => Create a program that asks a user to enter four random words, one at a time. Then, | |
# => the computer will ask the user to choose a number between 1 and 4. | |
# => The computer will then display the word corresponding to the correct number. | |
For example, if the user typed in the words ghost, umbrella, candy, and pepperoni in that order, if the user then chooses the number 2, the computer displays the second word, which in this example is umbrella. | |
=end | |
#screencast 9 | |
# puts "Please enter 4 random words, any words" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the basic game. I feel as if this is a total hack job at the moment. BUT it all works | |
# I will spend free time to refactor and make it better piece of code for sure. | |
# for this to run there are two other files that are needed these can be found on my git hub. | |
# https://github.com/troyleach/Connect-Four | |
require_relative 'player' | |
@board = Array.new(6, Array.new(7, "-")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# => Ask the user a total of three ruby questions. | |
# => the user will have 3 try's at the question before it moves onto the next question, OR the short game ends. | |
# => might have gone a little over board with this... oops | |
class Questions |