--- Robert Epps
: --- 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...
: 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"...
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.
>: 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
In article <339262ed...@snews.zippo.com>,
>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
> 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
: > 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
Asymetrix SuperCede can compile Java apps to X86 native code, with
execution times supposedly at or very near compiled C++ speeds.
--- Robert Epps
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