require 'pp' require 'optparse' class Test def and(*args) args.all?{|arg| arg == 1} ? 1 : 0 end def or(*args) args.any?{|arg| arg == 1} ? 1 : 0 end def xor(*args) args.inject(:+) % 2 == 1 ? 1 : 0 end def nand(*args) args.all?{|arg| arg == 1} ? 0 : 1 end def nor(*args) args.any?{|arg| arg == 1} ? 0 : 1 end def not(*args) args.map{|arg| if arg == 0; 1 elsif arg == 1; 0 end } end end @test = Test.new