fixed bugs in ai.rb and added new matcher