Skip to content

Instantly share code, notes, and snippets.

@mfdax
mfdax / blackjack.rb
Created May 19, 2015 05:24
Dax - Lab 2
require './deck'
require './card'
class Hand
attr_accessor :cards, :total
def initialize(name)
@name = name
@cards = []
@cards << Deck.deal_cards
@mfdax
mfdax / bob.rb
Created May 19, 2015 02:13
Dax - Day 11
class Bob
def hey(remark)
# Note: I needed help getting the "remark.downcase != remark" solution.
if remark == remark.upcase && remark.downcase != remark
"Whoa, chill out!"
elsif remark.end_with?("?")
"Sure."
elsif remark.to_s.strip.empty?
"Fine. Be that way!"
else
@mfdax
mfdax / matrix.rb
Last active August 29, 2015 14:21
matrix
# MATRIX FORMAT: (PLAYER, COMPUTER)
#
# | PLAYER
# | rock | paper scissors
# ------------------------------------------------------------------------
# | (rock,rock) | (paper,rock) | (scissors,rock) |
# C rock | TIE | PLAYER | COMPUTER |
# O | | WINS | WINS |
# M-----------------------------------------------------------------------
# P | (rock,paper) | (paper,paper) | (scissors,paper) |
@mfdax
mfdax / lab-1.rb
Created May 8, 2015 23:06
Dax Salazar - Week 1 Lab
#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.
#
# 1. How much money did we make this week?
# 2. How much of a bonus did each employee get?
# (bonuses are paid to employees who pilot the Planet Express)
# 3. How many trips did each employee pilot?
@mfdax
mfdax / day-3.rb
Created May 7, 2015 05:04
Dax Salazar - Day-3
#DAY-3 ASSIGNMENT
#
# Robot
# Define a Robot class
# A robot has a name
# A robot should have a method called say_hi and it should return "Hi!"
# A robot should have a method called say_name and it should return "My name is X" where X is the robot's name
#
# BendingUnit
# Define a BendingUnit class
# Assign "Hello World" to a variable message
# Added "puts """ for spacing and organization to assignment answers.
puts""
greeting_1 = "Hello World"
puts greeting_1
# Assign a different string to a different variable
greeting_2 = "Hello Houston"
puts greeting_2
# Assign "Hello World" to a variable message
# Added "puts """ for spacing and organization to assignment answers.
puts""
greeting_1 = "Hello World"
puts greeting_1
# Assign a different string to a different variable
greeting_2 = "Hello Houston"
puts greeting_2