This file contains hidden or 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
def model_exists?(model_name) | |
begin | |
potential_model = model_name.constantize | |
rescue NameError | |
return false | |
end | |
ActiveRecord::Base.send(:subclasses).include?(potential_model) | |
end |
This file contains hidden or 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
# Should the contestant switch to the other door? | |
@switch = true | |
@wins = 0; @losses = 0 | |
100000.times do | |
# Hide the car | |
car_behind = rand(3) | |
# Contestant picks a door | |
contestant_pick = rand(3) |
NewerOlder