Skip to content

Instantly share code, notes, and snippets.

@ptn
Created January 22, 2012 15:42
Show Gist options
  • Save ptn/1657482 to your computer and use it in GitHub Desktop.
Save ptn/1657482 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require 'irb'
dir = File.expand_path("~/.draughts/")
unless File.directory? dir
print "LOG: ~/.draughts dir does not exist, creating..."
Dir.mkdir dir
puts "done."
end
db = File.expand_path("~/.draughts/draughts.db")
unless File.exists? db
print "LOG: Database not in directory, copying..."
sample = File.expand_path("examples/draughts.db.example")
target = File.expand_path("~/.draughts/draughts.db")
require 'fileutils'
FileUtils.cp(sample, target)
puts "done."
end
IRB.setup nil
puts "LOG: Loading modules..."
IRB.load_modules << "./lib/draughts.rb"
IRB.load_modules << "./lib/draughts/ai/setup.rb"
IRB.load_modules << "./lib/draughts/ai/training_bot.rb"
puts "LOG: Start!"
IRB.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment