Skip to content

Instantly share code, notes, and snippets.

@c650
Last active June 18, 2018 02:29
Show Gist options
  • Save c650/2f9dce2aeb8685b175c871709973ad69 to your computer and use it in GitHub Desktop.
Save c650/2f9dce2aeb8685b175c871709973ad69 to your computer and use it in GitHub Desktop.
A very crappy judging script
#!/bin/env ruby
# A very crappy judging script
if ARGV.length < 2
puts "Usage: ./program.rb [executable] [data folder]"
exit
end
Dir.chdir(ARGV[1])
Dir.glob("case*").sort.each do |testcase|
Dir.chdir("#{ARGV[1]}/#{testcase}")
infile = "#{ARGV[1]}/#{testcase}/#{Dir.glob("*.in").first}"
outfile = "#{ARGV[1]}/#{testcase}/#{Dir.glob("*.out").first}"
`#{ARGV[0]} < #{infile} > /tmp/judge_rb_output`
puts "Case: #{testcase}"
puts `diff -qw /tmp/judge_rb_output #{outfile}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment