require "Command.rb"
require "Commands.rb"

module RubyMud

class Move < Command
	
	def words
		return nil
	end	
	
	def initialize()
		super()
	end
	

	def execute(clientConnection,string)
		str = string.split(' ')
		
		return false if str.length > 1
			
		room = clientConnection.player.parent		
		for exit in room.exits
			#otherRoom = exit.otherRoom(room)
			for name in exit.rooms[room]
				if name == str[0]
					clientConnection.player.moveThroughExit(exit)
					return true
				end
			end
		end
		
		# Could not find an exit
		return false
	end
		
end

# Create the instance, it adds itself to the commands list
Move.new()

end #module