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 Timer | |
def initialize | |
@seconds = 0 | |
end | |
def seconds= (seconds) | |
@seconds = seconds | |
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
class Dictionary | |
def initialize | |
@dictionary = {} | |
end | |
def entries | |
@dictionary | |
end | |
def add (entry) |
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 RPNCalculator | |
attr_accessor :calculator | |
def initialize | |
@calculator = [] | |
end | |
def push (number) | |
@calculator << number | |
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
class Array | |
def sum | |
answer = 0 | |
self.each do |number| | |
answer = answer + number | |
end | |
answer | |
end | |
def square |
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
require "csv" | |
require "sunlight" | |
class EventManager | |
INVALD_ZIPCODE = '00000' | |
INVALID_PHONENUMBER = '0000000000' | |
Sunlight::Base.api_key = "e179a6973728c4dd3fb1204283aaccb5" | |
def initialize (filename) | |
puts "EventManager initialized." |
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
## General Comments | |
## You guys didn't comment enough early on in the day, I felt kind of lost on some methods. | |
## Later on you guys turned on beast mode though, nice commenting. | |
## | |
## | |
##Below I took out pieces of code on which I commented on, instead of uploading all files | |
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
## | |
## I stringed together all the parts of code I commented on. | |
## In general, space your code more! | |
def my_sort | |
self.size.times do |variable| | |
self.each_with_index do |element, index| | |
unless self[index+1].nil? | |
result = yield(element, self[index+1]) # adding a default i.e. proc.nil? {|x,y| x<=>y} instead of yield would make it more sort-like | |
if result==1 || result == true # I don't understand. Isn't everything other than nil true? Therefore result == 1 adds nothing. |
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
## | |
## | |
## | |
# Inside the Hangman class : | |
# move the attr_accessors to the beginning of the method | |
# also, why have attr_accessors when you introduce each of the instance variables with def initialize? | |
attr_accessor :secret_word, :dictionary_words, :player_string, :word_size_floor, :word_size_ceiling, |
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 Word | |
# this could be changed to attr_reader since you only use it to read the value | |
attr_accessor :word, :parent_word_obj | |
def initialize(word, parent_word_obj) | |
@word = word | |
@parent_word_obj = parent_word_obj | |
end | |
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
class Game | |
require 'colorize' | |
require 'json' | |
require 'yaml' | |
def initialize | |
@placed_mines = 0 | |
@correct_flags = 0 | |
@flags = 0 |