Sha256: 826c3171db19be07f9e6022c3d35ea07298d98002ab6fd8dcad84ed2c67215ba

Contents?: true

Size: 339 Bytes

Versions: 2

Compression:

Stored size: 339 Bytes

Contents

module Lifegame
  class Life
    ALIVE = '-'
    DEAD = '_'

    def initialize(life = false)
      @life = life
    end

    def to_s
      alive? ? ALIVE : DEAD
    end

    def alive?
      @life
    end

    def dead?
      not alive?
    end

    def die!
      @life = false
    end

    def be!
      @life = true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lifegame-0.2.1 lib/lifegame/life.rb
lifegame-0.2.0 lib/lifegame/life.rb