Sha256: b93c954ce71d86b983388b6cc5d483f1b5304f66933161e23019258ce97e41a6

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

class Languages
  ALL_LANGUAGES = %w(rb cpp c)
  def initialize(solve_file)
    @solve_file = solve_file
  end

  def compile(problem_name)
    raise 'Error: Not Implemented'
  end

  def execute(input_path, output_path)
    raise 'Error: Not Implemented'
  end
end

class Rb < Languages
  def compile(problem_name)
    true
  end

  def execute(input_path, output_path)
    system "ruby #{@solve_file} < #{input_path} > #{output_path}"
  end
end

class Cpp < Languages
  def compile(problem_name)
    @exec_file = "#{problem_name}.out"
    system "g++ #{@solve_file} -o #{problem_name}.out"
  end

  def execute(input_path, output_path)
    system "./#{@exec_file} < #{input_path} > #{output_path}"
  end
end

class C < Languages
  def compile(problem_name)
    @exec_file = "#{problem_name}.out"
    system "gcc #{@solve_file} -o #{problem_name}.out"
  end

  def execute(input_path, output_path)
    system "./#{@exec_file} < #{input_path} > #{output_path}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atcoder_greedy-0.5.0 lib/atcoder_greedy/lib/languages.rb
atcoder_greedy-0.4.0 lib/atcoder_greedy/lib/languages.rb
atcoder_greedy-0.3.1 lib/atcoder_greedy/lib/languages.rb