Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Easiest way to write an interface? (Java)

Author: Ralf Elvsén

Date: 20:03:08 02/25/00

Go up one level in this thread


On February 25, 2000 at 19:13:01, Heiko Mikala wrote:

>On February 23, 2000 at 23:36:30, John Coffey wrote:
>
>>I have some MFC experience but probably not enough to slap an interface together
>>really quickly.   Somebody told me that Visual BASIC is a fast way to write
>>interfaces, but I don't know.  (I used VB 1.0 like 10 years ago and haven't
>>touched it since.)
>>
>>I have never used JAVA, but wondered if it might be a fast way to put together
>>an interface and if it can link to C programs?
>
>To build good user interfaces using Java you would have to use Java's class
>library "Swing". To build such interfaces by hand is not completely trivial,
>because you have to take care about platform-independence of the look of the
>interface. Maybe you could try JBuilder Foundation, as someone else suggested
>already, which includes a visual designer to design interfaces using drag and
>drop techniques. I haven't tried this yet though, I prefer to do everything by
>hand ;-)
>
>Concerning your second question: no, it's not possible to link Java and C into
>one single program.

It is possible, using the JNI (Java Native Interface) to call e.g.
your engine written in C from your Java interface. If it is "one" program
is a matter of definition, the engine would reside in a DLL-file.
I have played with the idea and made some tests but have at the
moment decided against it for various reasons.


But you could for example make your own engine
>Winboard-compatible and implement the basic Winboard commands in your
>user-interface so that you could run your chess program as an engine in you
>interface. The nice side-effect would be, that all the other winboard-engines
>would run in your interface too :-) In fact I've been thinking about doing
>exactly that too.
>
>The only reason that speaks against Java in this case is it's garbage collector.
>If you use a user interface to run tournaments between two or more engines for
>example, it would be crucial to give all engines the same amount of processor
>time. But if Java at some point (and you don't know when in advance) starts its
>garbage collector, this would steal processor time from the currently running
>engine. I'm not sure, if there is a way to switch off the garbage collector at
>least for some amount of time.

I don't claim to be an expert on anything, least of all Java, but I have
never noticed the garbage collector when running Java-programs of chess engine
character. I think it partly is a question of having enough RAM, but also
that the carbage collector isn't a problem unless you have large amounts
of unused data around. In a chess program or an interface I don't see any
reason to e.g. instantiate huge amounts of new objects which have to be
garbage collected. As I said, I am not an expert and stand ready to
be corrected.

Ralf


>
>I already wrote a (very) small Java-program that implemented only the most
>important Winboard commands and was able to start two engines and let them play
>a match against each other. It worked fine and it was fun to watch :) The
>garbage collector thing made me stop the experiment though, at least for a
>while. I may return to this project, since I really would like to write a nice
>GUI for my chess program.
>
>
>Greetings,
>
>Heiko.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.