Re: [computer-go] Ruby GTP shell

2007-10-26 Thread Phil Garcia
From: Don Dailey <[EMAIL PROTECTED]>
> Ruby is the best language I've ever programmed in.  Unfortunately, 
> it's also one of the slowest but that's ok for most things.

Using Microsoft's new DLR (Dynamic Language Runtime), dynamic languages, like 
Ruby, Python, and Javascript, can be compiled into MSIL (not interpreted). 
That's also pretty cool for another reason - you can mix programming languages 
within a single application. You can write one part in Ruby, and another part 
in C#. Plus with Silverlight (Moonlight on Linux) you can download and have the 
application running securely within your web browser. 
 
The Mono team is doing a great job creating an open source version of .NET 
Framework for other OSs besides Windows.
 
Phil
 
BTW. Please no flames if you think Microsoft is evil.___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Re: [computer-go] Ruby GTP shell

2007-10-26 Thread Don Dailey
Ruby is the best language I've ever programmed in.   Unfortunately, 
it's also one of the slowest but that's ok for most things.

- Don


Chris Fant wrote:
> On 10/24/07, Chris Fant <[EMAIL PROTECTED]> wrote:
>   
>> Since no one knew of one, I had to write it myself.  Hopefully someone
>> else can also make use of it.  This is my first Ruby script, so please
>> do criticize so I can learn.  Thanks.
>>
>> 
>
> I got zero responses to this.  Anyway, the latest version will be available 
> at:
>
> http://fantius.com/Gtp.rb
> http://fantius.com/GtpTest.rb
>
> So far, I'm quite happy with Ruby.
> ___
> computer-go mailing list
> computer-go@computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/
>
>   
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


Re: [computer-go] Ruby GTP shell

2007-10-26 Thread Ben Shoemaker
Chris,

Thanks for sharing your code.

I've been experimenting with go in Python and Ruby.  I'm just learning both 
languages, but eventually, I hope to have well-designed, easily modified, 
GTP-talking, random players to share with everyone.  I may include other 
languages after that, but the initial plan is Python and Ruby.

Ben.

- Original Message 
From: Chris Fant <[EMAIL PROTECTED]>
To: computer-go 
Sent: Friday, October 26, 2007 12:24:48 PM
Subject: Re: [computer-go] Ruby GTP shell


On 10/24/07, Chris Fant <[EMAIL PROTECTED]> wrote:
> Since no one knew of one, I had to write it myself.  Hopefully
 someone
> else can also make use of it.  This is my first Ruby script, so
 please
> do criticize so I can learn.  Thanks.
>

I got zero responses to this.  Anyway, the latest version will be
 available at:

http://fantius.com/Gtp.rb
http://fantius.com/GtpTest.rb

So far, I'm quite happy with Ruby.
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


Re: [computer-go] Ruby GTP shell

2007-10-26 Thread Chris Fant
On 10/24/07, Chris Fant <[EMAIL PROTECTED]> wrote:
> Since no one knew of one, I had to write it myself.  Hopefully someone
> else can also make use of it.  This is my first Ruby script, so please
> do criticize so I can learn.  Thanks.
>

I got zero responses to this.  Anyway, the latest version will be available at:

http://fantius.com/Gtp.rb
http://fantius.com/GtpTest.rb

So far, I'm quite happy with Ruby.
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


Re: [computer-go] Ruby GTP shell

2007-10-24 Thread Chris Fant
Since no one knew of one, I had to write it myself.  Hopefully someone
else can also make use of it.  This is my first Ruby script, so please
do criticize so I can learn.  Thanks.



class Gtp

  def initialize (engine, input, output)
@engine = engine
@input = input
@output = output
@commands = {}

AutoRegister(self)
AutoRegister(@engine)

#Re-register commands that were auto-registered under the wrong
gtp command name
RegisterCommand("kgs-genmove_cleanup",
@engine.method(:gtp_kgs_genmove_cleanup))
  end

  def AutoRegister(provider)
#Assumes methods that start with "gtp_" are implemented gtp commands
for functionName in provider.methods
  if functionName.slice(0,4) == "gtp_"
RegisterCommand(functionName.slice(4, functionName.length -
1), provider.method(functionName))
  end
end
  end

  def RegisterCommand(name, function)
#Overrides any previous registration for name or function
@commands.delete_if {| key, value | value == function }
@commands[name] = function
  end

  def ProcessCommands()
#Main GTP command processing loop
continue = true
while continue
  continue = ProcessCommand(@input.gets)
end
  end

  def ProcessCommand(commandLine)
commandParts = commandLine.strip.split(" ")
command = commandParts[0]
args = commandParts.slice(1, commandLine.length - 1)
if command
  if @commands[command]
@output.puts "= " + @commands[command].call(*args).to_s
  else
@output.puts "? Command not implemented: " << command
  end
  @output.puts
  @output.flush
end
command != "quit"
  end

  def TestCommand(commandLine)
@output.puts "TEST>" << commandLine
ProcessCommand(commandLine)
  end

  def gtp_list_commands(*unused)
list = ""
@commands.keys.sort.each {| commandName | list << commandName << "\n"}
list
  end

  def gtp_known_command(command, *unused)
@commands.has_key?(command)
  end

  def gtp_quit(*unused)
""
  end

end

#  Testbench 

class TestEngine
  def non_gtp_function
#This should not show up as an implemented GTP command
  end
  def gtp_name(*unused)
"TestEngine"
  end
  def gtp_kgs_genmove_cleanup(color, *unused)
"a1"
  end
end

@engine = TestEngine.new
gtp = Gtp.new(@engine, $stdin, $stdout)
gtp.TestCommand("list_commands")
gtp.TestCommand("known_command quit")
gtp.TestCommand("known_command asdf")
gtp.TestCommand("asdf")
gtp.TestCommand("name")
gtp.ProcessCommands
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


Re: [computer-go] Ruby GTP shell

2007-10-23 Thread Don Dailey
I have a simple GO class in ruby that you can have if you are interested
and if I can find it.

It's doesn't do GTP but it creates a game object and validates moves and
calculates scores.

Send me private email if you are interested and I will look around for it.

- Don


Chris Fant wrote:
> Does anyone know of a simple GTP engine written in Ruby that I would
> be able to use as a starting point?
> ___
> computer-go mailing list
> computer-go@computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/
>
>   
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/


[computer-go] Ruby GTP shell

2007-10-23 Thread Chris Fant
Does anyone know of a simple GTP engine written in Ruby that I would
be able to use as a starting point?
___
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/