Skip to content

Instantly share code, notes, and snippets.

@Nikitaw99
Last active January 9, 2017 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nikitaw99/562edf5086522e63054b08aeb851c55e to your computer and use it in GitHub Desktop.
Save Nikitaw99/562edf5086522e63054b08aeb851c55e to your computer and use it in GitHub Desktop.
messing around with ruby
require "date"
class DatBoi
attr_accessor :name
attr_accessor :life
attr_accessor :bornIn
attr_accessor :currentDate
attr_accessor :alive
def initialize(name = "Dat Boi", life = 365*4, bornIn = Date.parse("2016-04-03"))
@name = name
@life = life
@bornIn = bornIn
@currentDate = @bornIn
@alive = true
puts "The current date is #{@currentDate}."
end
def come()
if @alive
puts "here come #{@name}!\no shit waddup!"
live()
else
puts "#{@name} is a dead meme."
end
end
def live(days = 1)
if @alive
@life -= days
@currentDate += days
if days == 1
puts "#{@name} lives for 1 day..."
else
puts "#{@name} lives for #{days} days..."
end
if @life > 0
puts "#{@name} is still famous!"
else
@alive = false
puts "#{@name} is a dead meme."
end
puts "The current date is #{@currentDate}."
end
end
end
if __FILE__ == $0
db = DatBoi.new()
db.come()
db.live(20)
db.come()
db.live(40*23)
db.come()
db.live(365*2)
db.come()
end
require_relative "DatBoi"
puts "A new meme is born, and it's name is..."
dg = DatBoi.new("Dat Girl", 365*3, Date.parse("2017-01-18"))
puts "...#{dg.name}."
dg.come()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment