Sapphire
Sapphire
Created by user:Shannarra
Sapphire is Ruby's evil twin.
In Sapphire, you write pure Ruby code, but with a twist.
Your code MUST fail to execute. If you are unfortunate enough to run a Ruby program in Sapphire that exits properly, you will be SEVERELY punished - one randomly selected file from your computer will be permanently deleted.
It can be absolutely anything, from a simple file on your desktop to a system file that breaks your computer.
This means that Sapphire ensures that you write the worst possible code.
Example of good Sapphire code:
puts 'helllo' raise 'adasd' # <--- Note the `raise`, without it, your program will fail and you will lose a file
FizzBuzz in Sapphire:
1.upto 100 do |i|
string = ""
string += "Fizz" if i % 3 == 0
string += "Buzz" if i % 5 == 0
puts "#{i} = #{string}"
end
1/0
Sapphire interpreter
The interpreter was written in Ruby, but could just as easily be written in C or Assembly even.
# frozen_string_literal: true
`ruby #{ARGV[0]}`
unless $?.success?
puts "ok, I'll allow it...this time"
return
end
file = Dir.glob('/home/**/*').sample
puts "Deleting your file \"#{file}\"..."
File.delete(file)
puts "Your file \"#{file}\" was permamently deleted. Write worse code next time."
Latest possible version of the Sapphire interpreter can be found at Sapphire.rb