View SQLite work
sqlite3 classroom.sqlite3 | |
CREATE TABLE students (id INTEGER, first_name TEXT, last_name TEXT) | |
INSERT INTO students (id, first_name, last_name) VALUES (1,"Ben","Doane"),(2,"Ben","Barnett"),(3,"Matt","Fair"),(4,"Angie","Martaus"),(5,"Lauren","Imhoff"),(6,"Shirley","Grigsby"),(7,"Anna","Lioubimova"),(8,"Michelle","Caudle"); | |
sqlite> SELECT * FROM students; | |
1|Ben||Doane | |
2|Ben||Barnett | |
3|Matt||Fair |
View blackjack.rb
require_relative "blackjack_cards" | |
require_relative "blackjack_deck" | |
class Blackjack | |
attr_accessor :player_hand, :computer_hand, :p_score, :c_score, :bjdeck, :shoe | |
def initialize | |
puts "Welcome to Blackjack, sir. Please press [Enter] to deal." | |
STDIN.gets |
View cards.rb
class Cards | |
attr_accessor :suit, :face, :value | |
def initialize(face, suit) | |
self.face = face | |
self.suit = suit | |
if face == "Ace" | |
self.value = 14 | |
elsif face == "King" |
View dice. rb
class Dice | |
attr_accessor :sides | |
def initialize | |
self.sides = (1..6).to_a | |
end | |
def roll | |
sides.sample |
View Rochambeau
class Game | |
attr_accessor :player_one_choice, :computer, :computer2, | |
def initialize | |
puts "Let's play Rock, Paper, Scissors!" | |
end | |
def reset(computer_wins=0,user_wins=0) | |
vs_user(computer_wins,user_wins) |
View Homework_day4.rb
#Homework - Day 4 | |
#NORMAL MODE | |
#Good news Rubyists! | |
#We have a week of records tracking what we shipped at Planet Express. | |
#I need you to answer a few questions for Hermes. | |
#How much money did we make this week? | |
require 'csv' | |
week_total = [] |
View homework_day3.rb
# Homework - Day 3 | |
# NORMAL MODE----------------------------------------------- | |
# Define a robot class. A robot should have a name | |
class Robot | |
attr_accessor :name | |
attr_accessor :height | |
#creat a robot instance method for saying "hi" | |
def say_hi | |
puts "Greetings" |
View homework_day2
[1] pry(main)> our_class=["Ben","Anna","Shirley","Lauren","Ben","Michelle","Angie","Matt"] | |
=> ["Ben", "Anna", "Shirley", "Lauren", "Ben", "Michelle", "Angie", "Matt"] | |
[6] pry(main)> our_class.each do |name| | |
[6] pry(main)* if name.length<5 | |
[6] pry(main)* less_than5 << name | |
[6] pry(main)* end | |
[6] pry(main)* end | |
=> ["Ben", "Anna", "Shirley", "Lauren", "Ben", "Michelle", "Angie", "Matt"] | |
[7] pry(main)> less_than5 |
View lipsum_generator.rb
lipsum_wanted = ARGV[0].dup if ARGV[0] | |
paragraphs_wanted = ARGV[1].dup if ARGV[1] | |
if lipsum_wanted | |
lipsum_wanted.downcase! | |
end | |
paragraphs_wanted= paragraphs_wanted.to_i | |
if paragraphs_wanted<1 |