<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -124,5 +124,5 @@ Vying::SpecialMove.require_all( [File.dirname( __FILE__ )] )
 Rules.require_all( [File.dirname( __FILE__ )] )
 Vying::Notation.require_all( [File.dirname( __FILE__ )] )
 Vying::Format.require_all( [File.dirname( __FILE__ )] )
-Bot.require_all( [File.dirname( __FILE__ )] )
+Vying::Bot.require_all( [File.dirname( __FILE__ )] )
 </diff>
      <filename>lib/vying.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,240 +1,243 @@
 # Copyright 2007, Eric Idema except where otherwise noted.
 # You may redistribute / modify this file under the same terms as Ruby.
 
-require 'vying/rules'
+require 'vying'
 
-class Bot &lt; User
-  attr_accessor :cache, :delegates
+module Vying
 
-  def initialize( username=nil, id=nil )
-    username ||= name
+  class Bot &lt; User
+    attr_accessor :cache, :delegates
 
-    super( username, id )
+    def initialize( username=nil, id=nil )
+      username ||= name
 
-    @cache = Search::Cache::FallThrough.new
-    @delegates = {}
-  end
+      super( username, id )
 
-  def bot?
-    true
-  end
+      @cache = Search::Cache::FallThrough.new
+      @delegates = {}
+    end
 
-  def ready?
-    true
-  end
+    def bot?
+      true
+    end
 
-  def self.plays?( rules )
-    Object.nested_const_defined?( &quot;#{self}::#{Rules.find( rules ).class_name}&quot; )
-  end
+    def ready?
+      true
+    end
 
-  def plays?( rules )
-    self.class.plays?( rules )
-  end
+    def self.plays?( rules )
+      Object.nested_const_defined? &quot;#{self}::#{Rules.find( rules ).class_name}&quot;
+    end
 
-  def delegate_for( position )
-    k = position.rules.class_name.intern
+    def plays?( rules )
+      self.class.plays?( rules )
+    end
 
-    return @delegates[k] if @delegates.key?( k )
+    def delegate_for( position )
+      k = position.rules.class_name.intern
 
-    if self.plays?( k )
-      d = self.class.nested_const_get( k )
+      return @delegates[k] if @delegates.key?( k )
 
-      if d
-        @delegates[k] = d.new
-        @delegates[k].cache = cache
-        @delegates[k]
+      if self.plays?( k )
+        d = self.class.nested_const_get( k )
+
+        if d
+          @delegates[k] = d.new
+          @delegates[k].cache = cache
+          @delegates[k]
+        end
       end
     end
-  end
 
-  def select( sequence, position, player )
-    return position.moves.first if position.moves.length == 1
-
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :select )
-      return delegate.select( sequence, position, player )
-    end
+    def select( sequence, position, player )
+      return position.moves.first if position.moves.length == 1
 
-    score, move = best( analyze( position, player ) )
+      delegate = delegate_for( position )
+      if delegate &amp;&amp; delegate.respond_to?( :select )
+        return delegate.select( sequence, position, player )
+      end
 
-    move 
-  end
+      score, move = best( analyze( position, player ) )
 
-  def resign?( sequence, position, player )
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :resign? )
-      return delegate.resign?( sequence, position, player )
+      move 
     end
 
-    false
-  end
+    def resign?( sequence, position, player )
+      delegate = delegate_for( position )
+      if delegate &amp;&amp; delegate.respond_to?( :resign? )
+        return delegate.resign?( sequence, position, player )
+      end
 
-  def offer_draw?( sequence, position, player )
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :offer_draw? )
-      return delegate.offer_draw?( sequence, position, player )
+      false
     end
 
-    false
-  end
+    def offer_draw?( sequence, position, player )
+      delegate = delegate_for( position )
+      if delegate &amp;&amp; delegate.respond_to?( :offer_draw? )
+        return delegate.offer_draw?( sequence, position, player )
+      end
 
-  def accept_draw?( sequence, position, player )
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :accept_draw? )
-      return delegate.accept_draw?( sequence, position, player )
+      false
     end
 
-    false
-  end
+    def accept_draw?( sequence, position, player )
+      delegate = delegate_for( position )
+      if delegate &amp;&amp; delegate.respond_to?( :accept_draw? )
+        return delegate.accept_draw?( sequence, position, player )
+      end
 
-  def request_undo?( sequence, position, player )
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :request_undo? )
-      return delegate.request_undo?( sequence, position, player )
+      false
     end
 
-    false
-  end
+    def request_undo?( sequence, position, player )
+      delegate = delegate_for( position )
+      if delegate &amp;&amp; delegate.respond_to?( :request_undo? )
+        return delegate.request_undo?( sequence, position, player )
+      end
 
-  def accept_undo?( sequence, position, player )
-    delegate = delegate_for( position )
-    if delegate &amp;&amp; delegate.respond_to?( :accept_undo? )
-      return delegate.accept_undo?( sequence, position, player )
+      false
     end
 
-    false
-  end
-
-  def analyze( position, player )
-    h = {}
-    position.moves.each do |move|
+    def accept_undo?( sequence, position, player )
       delegate = delegate_for( position )
-      if delegate &amp;&amp; delegate.respond_to?( :evaluate )
-        h[move] = delegate.evaluate( position.apply( move ), player )
-      else
-        h[move] = evaluate( position.apply( move ), player )
+      if delegate &amp;&amp; delegate.respond_to?( :accept_undo? )
+        return delegate.accept_undo?( sequence, position, player )
       end
+
+      false
     end
-    h
-  end
 
-  def best( scores )
-    scores = scores.invert
-    m = scores.max
-    #puts &quot;scores: #{scores.inspect} (taking #{m.inspect})&quot;
-    m
-  end
+    def analyze( position, player )
+      h = {}
+      position.moves.each do |move|
+        delegate = delegate_for( position )
+        if delegate &amp;&amp; delegate.respond_to?( :evaluate )
+          h[move] = delegate.evaluate( position.apply( move ), player )
+        else
+          h[move] = evaluate( position.apply( move ), player )
+        end
+      end
+      h
+    end
 
-  def fuzzy_best( scores, delta )
-    s = []
-    scores.each { |move,score| s &lt;&lt; [score,move] }
-    m = s.max
-    ties = s.select { |score,move| (score - m.first).abs &lt;= delta }
-    m = ties[rand(ties.length)]
-    #puts &quot;scores: #{s.inspect}, t: #{ties.inspect} (taking #{m.inspect})&quot;
-    m
-  end
+    def best( scores )
+      scores = scores.invert
+      m = scores.max
+      #puts &quot;scores: #{scores.inspect} (taking #{m.inspect})&quot;
+      m
+    end
 
-  def to_s
-    username || self.class.to_s
-  end
+    def fuzzy_best( scores, delta )
+      s = []
+      scores.each { |move,score| s &lt;&lt; [score,move] }
+      m = s.max
+      ties = s.select { |score,move| (score - m.first).abs &lt;= delta }
+      m = ties[rand(ties.length)]
+      #puts &quot;scores: #{s.inspect}, t: #{ties.inspect} (taking #{m.inspect})&quot;
+      m
+    end
 
-  def name
-    to_s
-  end
+    def to_s
+      username || self.class.to_s
+    end
 
-  def inspect
-    &quot;#&lt;Bot #{name}&gt;&quot;
-  end
+    def name
+      to_s
+    end
+
+    def inspect
+      &quot;#&lt;Bot #{name}&gt;&quot;
+    end
 
-  def Bot.require_all( path=$: )
-    required = []
-    path.each do |d|
-      Dir.glob( &quot;#{d}/**/bots/**/*.rb&quot; ) do |f|
-        f =~ /(.*)\/bots\/(.*\.rb)$/
-        if ! required.include?( $2 ) &amp;&amp; !f[&quot;_test&quot;]
-          required &lt;&lt; $2
-          require &quot;#{f}&quot;
+    def Bot.require_all( path=$: )
+      required = []
+      path.each do |d|
+        Dir.glob( &quot;#{d}/**/bots/**/*.rb&quot; ) do |f|
+          f =~ /(.*)\/bots\/(.*\.rb)$/
+          if ! required.include?( $2 ) &amp;&amp; !f[&quot;_test&quot;]
+            required &lt;&lt; $2
+            require &quot;#{f}&quot;
+          end
         end
       end
     end
-  end
 
-  @@bots_list = []
-  @@bots_play = {}
-
-  def self.inherited( child )
-    a = child.to_s.split( /::/ )
-    if a.length &gt; 1
-      bc = a[0,a.length-1].join( &quot;::&quot; )
-      if @@bots_list.any? { |b| b.to_s == bc }
-        b = Bot.find( bc )
-        r = Rules.find( a.last )
-        (@@bots_play[r] ||= []) &lt;&lt; b if b &amp;&amp; r
+    @@bots_list = []
+    @@bots_play = {}
+
+    def self.inherited( child )
+      a = child.to_s.split( /::/ )
+      if a.length &gt; 1
+        bc = a[0,a.length-1].join( &quot;::&quot; )
+        if @@bots_list.any? { |b| b.to_s == bc }
+          b = Bot.find( bc )
+          r = Rules.find( a.last )
+          (@@bots_play[r] ||= []) &lt;&lt; b if b &amp;&amp; r
+        else
+          @@bots_list &lt;&lt; child
+        end
       else
         @@bots_list &lt;&lt; child
       end
-    else
-      @@bots_list &lt;&lt; child
     end
-  end
 
-  def Bot.list( rules=nil )
-    return @@bots_list.select { |b| b.plays?( rules ) } if rules
-    @@bots_list
-  end
-
-  def Bot.play( rules )
-    list.select { |b| b.plays?( rules ) }
-  end
+    def Bot.list( rules=nil )
+      return @@bots_list.select { |b| b.plays?( rules ) } if rules
+      @@bots_list
+    end
 
-  def Bot.find( name )
-    Bot.list.each do |b|
-      return b if name.to_s.downcase == b.to_s.downcase ||
-                  name.to_s.downcase == b.name.downcase
+    def Bot.play( rules )
+      list.select { |b| b.plays?( rules ) }
+    end
 
-      a = name.to_s.split( &quot;::&quot; )
-      if a.length &gt; 1
-        bc = a[0,a.length-1].join( &quot;::&quot; )
-        b = Bot.find( bc )
-        r = Rules.find( a.last )
-        return b if b &amp;&amp; r &amp;&amp; b.plays?( r )
+    def Bot.find( name )
+      Bot.list.each do |b|
+        return b if name.to_s.downcase == b.to_s.downcase ||
+                    name.to_s.downcase == b.name.downcase
+
+        a = name.to_s.split( &quot;::&quot; )
+        if a.length &gt; 1
+          bc = a[0,a.length-1].join( &quot;::&quot; )
+          b = Bot.find( bc )
+          r = Rules.find( a.last )
+          return b if b &amp;&amp; r &amp;&amp; b.plays?( r )
+        end
       end
-    end
 
-    nil
-  end
+      nil
+    end
 
-  DIFFICULTY_LEVELS = { :easy   =&gt; 0,
-                        :medium =&gt; 1,
-                        :hard   =&gt; 2 }
+    DIFFICULTY_LEVELS = { :easy   =&gt; 0,
+                          :medium =&gt; 1,
+                          :hard   =&gt; 2 }
 
-  def self.difficulty( d=nil )
-    @difficulty = DIFFICULTY_LEVELS[d]
-    class &lt;&lt; self 
-      def difficulty_name; DIFFICULTY_LEVELS[@difficulty]; end
-      def difficulty; @difficulty; end
+    def self.difficulty( d=nil )
+      @difficulty = DIFFICULTY_LEVELS[d]
+      class &lt;&lt; self 
+        def difficulty_name; DIFFICULTY_LEVELS[@difficulty]; end
+        def difficulty; @difficulty; end
+      end
+      d
     end
-    d
-  end
 
-  def self.difficulty_for( rules )
-    if self.plays?( rules )
-      k = nested_const_get( Rules.find( rules ).class_name )
-      if k
-        d = k.difficulty
-        return DIFFICULTY_LEVELS.invert[d] if d &amp;&amp; DIFFICULTY_LEVELS.invert[d]
+    def self.difficulty_for( rules )
+      if self.plays?( rules )
+        k = nested_const_get( Rules.find( rules ).class_name )
+        if k
+          d = k.difficulty
+          return DIFFICULTY_LEVELS.invert[d] if d &amp;&amp; DIFFICULTY_LEVELS.invert[d]
+        end
       end
+      return :unknown
     end
-    return :unknown
-  end
 
-  def difficulty_for( rules )
-    self.class.difficulty_for( rules )
-  end
+    def difficulty_for( rules )
+      self.class.difficulty_for( rules )
+    end
 
-  def to_yaml( opts={} )
-    User.new( username, id ).to_yaml( opts )
+    def to_yaml( opts={} )
+      User.new( username, id ).to_yaml( opts )
+    end
   end
 end
 </diff>
      <filename>lib/vying/ai/bot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,9 @@
 # Copyright 2007, Eric Idema except where otherwise noted.
 # You may redistribute / modify this file under the same terms as Ruby.
 
-require 'vying/ai/bot'
-require 'vying/rules'
+require 'vying'
 
-class RandomBot &lt; Bot
+class RandomBot &lt; Vying::Bot
   def initialize( username=nil, id=nil )
     id ||= 387
 </diff>
      <filename>lib/vying/ai/bots/randombot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,127 +1,129 @@
 
-class User
-  attr_reader :id, :username
+module Vying
+  class User
+    attr_reader :id, :username
 
-  alias_method :user_id, :id
+    alias_method :user_id, :id
 
-  def initialize( username=nil, id=nil )
-    @username, @id = username, id
-  end
+    def initialize( username=nil, id=nil )
+      @username, @id = username, id
+    end
 
-  def bot?
-    false
-  end
+    def bot?
+      false
+    end
 
-  def ready?
-    false
-  end
+    def ready?
+      false
+    end
 
-  def select( sequence, position, player )
-    raise &quot;User doesn't implement #select&quot;
-  end
+    def select( sequence, position, player )
+      raise &quot;User doesn't implement #select&quot;
+    end
 
-  def resign?( sequence, position, player )
-    false
-  end
+    def resign?( sequence, position, player )
+      false
+    end
 
-  def offer_draw?( sequence, position, player )
-    false
-  end
+    def offer_draw?( sequence, position, player )
+      false
+    end
 
-  def accept_draw?( sequence, position, player )
-    false
-  end
+    def accept_draw?( sequence, position, player )
+      false
+    end
 
-  def request_undo?( sequence, position, player )
-    false
-  end
+    def request_undo?( sequence, position, player )
+      false
+    end
 
-  def accept_undo?( sequence, position, player )
-    false
-  end
+    def accept_undo?( sequence, position, player )
+      false
+    end
 
-  def eql?( u )
-    u &amp;&amp; username == u.username
-  end
+    def eql?( u )
+      u &amp;&amp; username == u.username
+    end
 
-  def ==( u )
-    eql? u
-  end
+    def ==( u )
+      eql? u
+    end
 
-  def hash
-    username.hash
-  end
+    def hash
+      username.hash
+    end
 
-  def to_user
-    self
-  end
+    def to_user
+      self
+    end
 
-  def to_s
-    username
-  end
+    def to_s
+      username
+    end
 
-  # Take over YAML deserialization.  Try to look up Bots by username, otherwise
-  # returns a User object.
+    # Take over YAML deserialization.  Try to look up Bots by username, 
+    # otherwise returns a User object.
 
-  def self.yaml_new( klass, tag, val )
-    Bot.find( val['username'] ) || User.new( val['username'], val['id'] )
-  end
+    def self.yaml_new( klass, tag, val )
+      Bot.find( val['username'] ) || User.new( val['username'], val['id'] )
+    end
+
+    def to_yaml_properties
+      [&quot;@username&quot;, &quot;@id&quot;]
+    end
 
-  def to_yaml_properties
-    [&quot;@username&quot;, &quot;@id&quot;]
   end
 
-end
+  # This is just a simple dummy Human bot class.  It accepts moves into a 
+  # queue via #&lt;&lt; and then plays them when asked for a move by Game#step and
+  # Game#play.
+  #
 
-# This is just a simple dummy Human bot class.  It accepts moves into a 
-# queue via #&lt;&lt; and then plays them when asked for a move by Game#step and
-# Game#play.
-#
+  class Human &lt; User
+    attr_reader :queue
 
-class Human &lt; User
-  attr_reader :queue
+    def initialize( *args )
+      super
+      @queue = []
+    end
 
-  def initialize( *args )
-    super
-    @queue = []
-  end
+    def &lt;&lt;( move )
+      queue &lt;&lt; move 
+    end
 
-  def &lt;&lt;( move )
-    queue &lt;&lt; move 
-  end
+    def select( sequence, position, player )
+      queue.shift
+    end
 
-  def select( sequence, position, player )
-    queue.shift
-  end
+    def resign?( sequence, position, player )
+      queue.shift if queue.first == &quot;resign&quot;
+    end
 
-  def resign?( sequence, position, player )
-    queue.shift if queue.first == &quot;resign&quot;
-  end
+    def offer_draw?( sequence, position, player )
+      queue.shift if queue.first == &quot;offer_draw&quot;
+    end
 
-  def offer_draw?( sequence, position, player )
-    queue.shift if queue.first == &quot;offer_draw&quot;
-  end
-
-  def accept_draw?( sequence, position, player )
-    return   queue.shift if queue.first == &quot;accept_draw&quot;
-    return ! queue.shift if queue.first == &quot;reject_draw&quot;
-  end
+    def accept_draw?( sequence, position, player )
+      return   queue.shift if queue.first == &quot;accept_draw&quot;
+      return ! queue.shift if queue.first == &quot;reject_draw&quot;
+    end
 
-  def request_undo?( sequence, position, player )
-    queue.shift if queue.first == &quot;request_undo&quot;
-  end
+    def request_undo?( sequence, position, player )
+      queue.shift if queue.first == &quot;request_undo&quot;
+    end
 
-  def accept_undo?( sequence, position, player )
-    return   queue.shift if queue.first == &quot;accept_undo&quot;
-    return ! queue.shift if queue.first == &quot;reject_undo&quot;
-  end
+    def accept_undo?( sequence, position, player )
+      return   queue.shift if queue.first == &quot;accept_undo&quot;
+      return ! queue.shift if queue.first == &quot;reject_undo&quot;
+    end
 
-  def ready?
-    ! @queue.empty?
-  end
+    def ready?
+      ! @queue.empty?
+    end
 
-  def to_yaml( opts={} )
-    User.new( username, id ).to_yaml( opts )
+    def to_yaml( opts={} )
+      User.new( username, id ).to_yaml( opts )
+    end
   end
 end
 </diff>
      <filename>lib/vying/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,46 +2,48 @@
 require 'test/unit'
 require 'vying'
 
-module BotTemplate
-
-  attr_reader :leaf, :nodes, :leaf_list, :nodes_list
-  attr_accessor :depth
-
-  def initialize
-    super
-    @leaf = 0
-    @nodes = 0
-  end
-
-  # select should also take a sequence argument, but we wouldn't have
-  # used it anyway (we're only interested in search results)
-
-  def select( position, player )
-    @leaf, @nodes = 0, 0
-    score, move = best( analyze( position, player ) )
-    [score, move]           #This should just return move in a real Bot
-  end                       #But we're only interested search results
+module Vying
+  module BotTemplate
+
+    attr_reader :leaf, :nodes, :leaf_list, :nodes_list
+    attr_accessor :depth
+
+    def initialize
+      super
+      @leaf = 0
+      @nodes = 0
+    end
+
+    # select should also take a sequence argument, but we wouldn't have
+    # used it anyway (we're only interested in search results)
+
+    def select( position, player )
+      @leaf, @nodes = 0, 0
+      score, move = best( analyze( position, player ) )
+      [score, move]           #This should just return move in a real Bot
+    end                       #But we're only interested search results
   
-  def evaluate( position, player )
-    @leaf += 1
-    return 1  if position.winner? player
-    return 0  if position.draw?
-    return -1
-  end
+    def evaluate( position, player )
+      @leaf += 1
+      return 1  if position.winner? player
+      return 0  if position.draw?
+      return -1
+    end
                                                               
-  def cutoff( position, depth )                               
-    position.final?  # it's very abnormal to search all the way to the bottom
+    def cutoff( position, depth )                               
+      position.final?  # it's very abnormal to search all the way to the bottom
+    end
   end
-end
 
-class MiniMaxBot &lt; Bot
-  include BotTemplate
-  include Minimax
-end
+  class MiniMaxBot &lt; Bot
+    include BotTemplate
+    include Minimax
+  end
 
-class AlphaBetaBot &lt; Bot
-  include BotTemplate
-  include AlphaBeta
+  class AlphaBetaBot &lt; Bot
+    include BotTemplate
+    include AlphaBeta
+  end
 end
 
 class TestSearch &lt; Test::Unit::TestCase</diff>
      <filename>test/vying/ai/search/search_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,15 +2,15 @@
 require 'test/unit'
 require 'vying'
 
-class FirstMoveBot &lt; Bot
-  class TicTacToe &lt; Bot
+class FirstMoveBot &lt; Vying::Bot
+  class TicTacToe &lt; Vying::Bot
     difficulty :easy
     def select( sequence, position, player )
       position.moves.first
     end
   end
 
-  class Connect6 &lt; Bot
+  class Connect6 &lt; Vying::Bot
     difficulty :medium
     def select( sequence, position, player )
       position.moves.first
@@ -19,8 +19,8 @@ class FirstMoveBot &lt; Bot
 end
 
 module NamespaceForTesting
-  class LastMoveBot &lt; Bot
-    class TicTacToe &lt; Bot
+  class LastMoveBot &lt; Vying::Bot
+    class TicTacToe &lt; Vying::Bot
       difficulty :easy
       def select( sequence, position, player )
         position.moves.first</diff>
      <filename>test/vying/bot_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b2c0158fe722d4bef5778336f3366a1659374221</id>
    </parent>
  </parents>
  <author>
    <name>Eric K Idema</name>
    <email>eki@vying.org</email>
  </author>
  <url>http://github.com/eki/vying/commit/72d8d9aba99db60e38efc3ddc6abc795d8c3604d</url>
  <id>72d8d9aba99db60e38efc3ddc6abc795d8c3604d</id>
  <committed-date>2009-03-14T18:38:48-07:00</committed-date>
  <authored-date>2009-03-14T18:38:48-07:00</authored-date>
  <message>Move User, Human, and Bot into the Vying namespace.</message>
  <tree>0c5684ca16bf7a2196719269570d42532db260e8</tree>
  <committer>
    <name>Eric K Idema</name>
    <email>eki@vying.org</email>
  </committer>
</commit>
