require './level' require './frame' $levels << Level.new do @interfaces = %w(1 2 3) @description = <<~EOD You are now a three-port hub. Your job is to forward frames from one interface to all the others. EOD def target(frame) case frame.iface when ?1 [frame.to(?2), frame.to(?3)] when ?2 [frame.to(?1), frame.to(?3)] when ?3 [frame.to(?1), frame.to(?2)] else [] end end def generate frame = Frame.new(interfaces.sample, @count) @count += 1 frame end def click end end