[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: computer-go: Languages for programming go are?
Bob Myers <rtm@xxxxxxxxxxxxxxxxx> wrote:
> I have two questions for the members of this list.
>
> 1) What are the pluses and minuses of writing a go program in various existing > computer languages?
Hello,
There are various parts in a go program, basically tree:
an algorithmic part a test part and a knowledge part.
>From the algorithmic point of view a low level language will always
be faster than a hi level language, C or C++ seems to fit well because
lot of people already knows these languages.
The test part must not be neglected: we need to check if a modification
in the program is good or bad for that a set of tests is described
in a test script. There is already a nice test language proposed in
gnugo, it should be a standard.
If we think go programs as knowledge based programs
it is obvious that fast sequential languages are not well suited for
"constraint propagation problem":
Let me give you an example:
If you have a set of couples "constraints" / "actions" like in
a Go pattern database.
Suppose you write all in a sequential language like C :
if(Pattern_A) do_Action1();
if(Pattern_B) do_Action2();
(...) /* 9998 constraints */
Everything is fine until you add a new couple constraint/action:
if(Pattern_A && Pattern_B && Constraint_W) do_Action10001();
of course you add this test at the end:
if(Pattern_A) do_Action1();
if(Pattern_B) do_Action2();
(...) /* 9998 constraints */
if(Pattern_A && Pattern_B && Constraint_W) do_Action10001();
It will work, but the best is to rewrite all your code to have a global
minimization of constraints tests, something like:
if(Pattern_A)
{
do_Action1();
if(Pattern_B && Constraint_W) do_Action10001();
(...) /* constraints were A is involved */
}
if(Pattern_B) do_Action2();
(...) /* other constraints */
>
> 2) If one were to imagine a new language, invented solely for the purpose of
> writing a great computer go system, what would its characteristics likely be? > (Or would there be multiple new languages, for different parts of the problem?)
I do not know if a totally new language is needed for the sequential
part of a Go program, we may use the one we prefer. The Test part
already exist.
But i am certain that we need a new logical language for Go knowledge
description
and efficient algorithms to convert this knowledge into fast sequential
code.
Why not develop a standard language for that ?
There is already a lot of constraint oriented languages
http://www.cs.unh.edu/ccc/archive/constraints/archive/byte.html
or
http://gnu-prolog.inria.fr/
Some of them like gnuprolog are able to generate C/C++/ASM
code from logical constraints. But the main problem is that they are
too generic and from this fact not optimal for a particular domain like
Go.
Lot of Go program already use something like that, for example
GnuGo uses .db text files where its knowledge is described.
These files are converted into C files by a "compiler" called mkpat.
A .db file is a simple set of entries of the form
" pattern + logical constraint => action "
It is still very simple but it already looks like a go programing
language.
There is a lot of work to build up a robust and efficient compiler
for Go knowledge. But how amazing it is !!
--
----------------------------------------------------
Tanguy Urvoy http://www.irisa.fr/prive/Tanguy.Urvoy/
----------------------------------------------------