Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java chess program?

84 views
Skip to first unread message

Robert Epps

unread,
May 28, 1997, 3:00:00 AM5/28/97
to

Has anyone written a chess program for Java, or ported an existing
freeware/shareware one to it? I've been thinking of porting Crafty
11.23 to Java (and probably adding a graphical UI), mainly as a Java
programming exercise. I realize that under current implementations of
the Java VM the program will take a serious hit in performance, but as
"just-in-time" VM technology improves I think the performance loss
will diminish. And a truly portable chess program with full graphical
interface would be nice to have!

--- Robert Epps


Robert Hyatt

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

Robert Epps (rob...@relm.com) wrote:
: Has anyone written a chess program for Java, or ported an existing

: --- Robert Epps

Just be careful. You don't want to do things like
x=new CreatePosition(..).. at each ply. IE, take advantage of the
OO syntax, but don't get wiped out by the OO overhead of constructing
and destroying objects, because you need to search quickly, and I haven't
seen an implementation that can "new" 50-100K objects per second very
efficiently...


Robert Hyatt

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

le...@rd.grame.fr wrote:
: In article (Dans l'article) <5mipf2$d...@juniper.cis.uab.edu>,
: hy...@crafty.cis.uab.edu (Robert Hyatt) wrote (écrivait) :

: Hi,

: I like the idea of porting Crafty in Java, and i would be interested in
: participating. I think the "new" problem will not be a real one (i mean i
: should be possible to pre-allocate objects). But looking at the Crafty
: code, and if i unserstand correctly, the "BITBOARD" type can be a problem
: beacuse Java does not have unsigned 64 bit but signed 64 bit (which is the
: "long" type in java).
: Is this really an issue?

: is there any else "data type size" which could be a problem in Java?

: Stephane Letz

no, but don't get sucked into trying double-precision floating point, it
won't work, because of normalization problems and NAN and things like
that.

You can use 2 32bit words and write code to treat them as one word, doing
your own shifts, ands, ors, etc... Since there are no structures, this would
not look real "clean"...


Reality is a point of view

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

+---- hy...@crafty.cis.uab.edu wrote (29 May 1997 02:25:38 GMT):

| Just be careful. You don't want to do things like
| x=new CreatePosition(..).. at each ply.
+----

Having written a chess client in Java I would agree. Programs
that generate moves could use sockets or some other popular
form of process communication to isolate the UI from the move
generation. If the generator was written in something like ISO
C, with minimal interface code, then portability would be an
option.

--
Gary Johnson gjoh...@season.com
Privacy on the net is still illegal.


Moritz Berger

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

On 29 May 1997 15:05:12 GMT, hy...@crafty.cis.uab.edu (Robert Hyatt)
wrote:

>le...@rd.grame.fr wrote:
>: In article (Dans l'article) <5mipf2$d...@juniper.cis.uab.edu>,
>: hy...@crafty.cis.uab.edu (Robert Hyatt) wrote (écrivait) :
>
>: > Robert Epps (rob...@relm.com) wrote:
< snip >
>: But looking at the Crafty

>: code, and if i unserstand correctly, the "BITBOARD" type can be a problem
>: beacuse Java does not have unsigned 64 bit but signed 64 bit (which is the
>: "long" type in java).
>: Is this really an issue?

>: is there any else "data type size" which could be a problem in Java?

>: Stephane Letz

>no, but don't get sucked into trying double-precision floating point, it
>won't work, because of normalization problems and NAN and things like
>that.

>You can use 2 32bit words and write code to treat them as one word, doing
>your own shifts, ands, ors, etc... Since there are no structures, this would
>not look real "clean"...

Signed 64 bit words are no problem in Java, since there exists not
only a binary right shift with sign extension (>>) but also a binary
right shift with zero extension (>>>). This allows you to treat signed
words as if they were unsigned shift-wise when you use them for
bitboards. Wow, what a geek talk ;-)

Moritz
--------
"The truth will always come out in the end."
(Komputer Korner, 28/03/1997 08:22 on rec.games.chess.computer)

Jon Dart

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

I've thought about it. I do mostly Java programming at work. It
is tempting because Java has built-in support for 64 bit ints, but I'm
afraid that even with the current generation of just-in-time compilers,
the performance would be pretty bad. However, Sun is supposedly
working on a really fast Java runtime. Asymetrix also has some
compiler technology that looks promising. I know one of the guys
who did their code generator and he is very good. So Java may
become a reasonable language for chess programming in the next
year or two.

--Jon

In article <339262ed...@snews.zippo.com>,

Peter Kappler

unread,
May 31, 1997, 3:00:00 AM5/31/97
to

On 30 May 1997 09:24:25 -0700, jd...@best.com (Jon Dart) wrote:

>I've thought about it. I do mostly Java programming at work. It
>is tempting because Java has built-in support for 64 bit ints,

Unfortunately, in Java the 64-bit long int is signed, and Java doesn't
support unsigned integers. You might consider using the BitSet class,
which defines an arbitrarily large set of bits, and provides handy
methods for doing operations on them.

My own chess program is a combination of C (movegen, search, eval) and
Java (GUI and ICC network stuff). I greatly prefer programming in
Java, and would *love* to do the whole thing in Java, but of course,
speed is a big problem. Hopefully, somebody will produce a Java to
native-code compiler, and put that issue to rest. Hmmm.... maybe I
should get started now... ;-)

--Peter

Michael F. Coyle

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

le...@rd.grame.fr wrote in article <letz-29059...@macsteph.grame.fr>...

> But looking at the Crafty
> code, and if i unserstand correctly, the "BITBOARD" type can be a problem
> beacuse Java does not have unsigned 64 bit but signed 64 bit (which is the
> "long" type in java).
> Is this really an issue?
>
> is there any else "data type size" which could be a problem in Java?
>
> Stephane Letz

It's no problem.

The only situation where signedness of integers is an issue is when
you do a right shift. In C, the result is undefined -- it might be done
as either a logical shift (zero-fill) or as an arithmetic shift
(sign-bit-fill). So C programmers use unsigned integers for logical
operations.

Java implements two different right shift operators -- the usual
">>" which does an arithmetic shift, and a new ">>>" which does
a logical shift.

Java also has a BitSet class, which can grow to any arbitrary
size, but I suspect it's less efficient than using a 64-bit int.

-- Michael


Robert Hyatt

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

Michael F. Coyle (mjc...@erols.com) wrote:
: le...@rd.grame.fr wrote in article <letz-29059...@macsteph.grame.fr>...

: > But looking at the Crafty
: > code, and if i unserstand correctly, the "BITBOARD" type can be a problem
: > beacuse Java does not have unsigned 64 bit but signed 64 bit (which is the
: > "long" type in java).
: > Is this really an issue?
: >
: > is there any else "data type size" which could be a problem in Java?
: >
: > Stephane Letz

: It's no problem.

: The only situation where signedness of integers is an issue is when
: you do a right shift. In C, the result is undefined -- it might be done
: as either a logical shift (zero-fill) or as an arithmetic shift
: (sign-bit-fill). So C programmers use unsigned integers for logical
: operations.

Actually, this is not correct. A signed int *must* fill with the sign bit
on right shifts, while an unsigned shift must zero-fill on right or left
shifts. the only oddity in the ANSI spec is that when you define a bit
field, it can default to either signed or unsigned as the compiler implementors
chose, the standard doesn't specify this...

Unless I've completely mis-read the ANSI spec, anyway...

: Java implements two different right shift operators -- the usual


: ">>" which does an arithmetic shift, and a new ">>>" which does
: a logical shift.

this is why shifts are not an issue...

: Java also has a BitSet class, which can grow to any arbitrary

Robert Epps

unread,
Jun 2, 1997, 3:00:00 AM6/2/97
to

>My own chess program is a combination of C (movegen, search, eval) and
>Java (GUI and ICC network stuff). I greatly prefer programming in
>Java, and would *love* to do the whole thing in Java, but of course,
>speed is a big problem. Hopefully, somebody will produce a Java to
>native-code compiler, and put that issue to rest. Hmmm.... maybe I
>should get started now... ;-)

Asymetrix SuperCede can compile Java apps to X86 native code, with
execution times supposedly at or very near compiled C++ speeds.

--- Robert Epps


Peter Kappler

unread,
Jun 4, 1997, 3:00:00 AM6/4/97
to

On Mon, 02 Jun 1997 06:02:36 GMT, rob...@relm.com (Robert Epps)
wrote:

Thanks!! That is very exciting!

I didn't realize their product included a "real" compiler - I thought
it was just another JIT. Does anybody have any experience with this
thing? I'd be interested to know how close it can get to compiled
C/C++ speeds.

--Peter


0 new messages