gnushogi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnushogi-devel] gnushogi xboard support


From: Yann Dirson
Subject: Re: [Gnushogi-devel] gnushogi xboard support
Date: Thu, 24 Oct 2013 23:40:52 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Oct 24, 2013 at 10:17:10AM +0200, address@hidden wrote:
> Op Do, 24 oktober, 2013 8:03 am schreef Yann Dirson:
> > On Thu, Oct 24, 2013 at 12:14:50AM +0200, Yann Dirson wrote:
> >
> >>> In Shokidoki I don't really change the size of the board, but just
> >>> use a smaller part of it. I used a board with a rim of 'edge guards'
> >>> around it that made off-board squares inaccessible, and just put two
> >>> more rings of edge guards inside the 9x9 area. Note that this also
> >>> gets the promotion zone right for mini-Shogi. I don't know if a
> >>> similar thing could be done with GNU Shogi; I never looked at its data
> >>> structures.
> >>
> >> It's quite similar indeed, that could work, and avoid to change things
> >> like direc and max_steps - good point.
> >
> > On second thought, it is only that simple for odd board sizes, for
> > eg. Judkins Shogi it would imply asymetric promotion zones - but may still
> > be doable, didn't check.
> 
> Indeed. Fortunately Shokidoki does not test for promotion by rank number,
> but uses a board size table, which for each square contains a bitmap to
> specify which group of (colored) piece types can promote there, and which
> group of piece types must promote there (the groups being {P,L}, {N},
> {S,B,R} and {G,K,+P,+L,+N,+S,+B,+R}). That moves the problem to the
> initialization code for filling the table, where speed is no concern at
> all. So Judkins was quite easy there too, I just assume a zone width of
> board_height/3 (rounded down) for deciding whether a square is inside the
> zone. I use a similar system for handling promotions in HaChu.
> 
> But it is all very much dependent on what data structures the program uses
> to hold game state and to generate moves.

gnushogi maps the board in a monodimensional array.  While it looks
bit primitive, and makes move description hard to read by humans, it
does have some advantages for this promotion-zone issue :)

#define InBlackCamp(sq) ((sq) < 27)
#define InWhiteCamp(sq) ((sq) > 53)
#define InPromotionZone(side, sq) \
(((side) == black) ? InWhiteCamp(sq) : InBlackCamp(sq))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]