Some thoughts by a noob

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Some thoughts by a noob

Post by ZirconiumX »

Hello everyone!

First things first, I have read the chess programming wiki, and know roughly how a chess engine works.

I would like to ask you all what you think to my (IMO rubbish) idea.

It is basically a move ordering type search. It works by starting with a piece type (say, the king), and searches for d depth, using only that piece type (king) moves. If we get a beta cutoff, we open the window to +INFINITY and -INFINITY, and search again (Transposition Table may be useful for this bit); if this causes a cutoff, we return beta(fail-hard) or the value of the full window search. If we get a value that is alpha > value > beta, we give alpha and beta a window of, say, half a pawn;

The issue with this is that you have always got to be aware of the fact that there may not be any available moves. For this reason, in my pseudocode, I have added a parameter, which tells us if the search had any available moves. If we are in check, and king moves returns no moves, then we may well have a checkmate. If we are not in check, and all pieces give no moves, then it's stalemate.

I have nicknamed it the "commitee" move pruner, because of the way it consults all moves(-ish) before returning a score.

Code: Select all

int comSearch(int alpha, int beta, int depth, pvtype * BestMove) // I've included the latter parameter so that it is easy to get the PV
{
    int val, moves;
    pvtype pv;

    val = KingSearch(alpha, beta, depth, &pv, &moves);

    if (val > beta) {
        alpha = +INFINITY;
        beta = -INFINITY;
        val = KingSearch(alpha, beta, depth, &pv); // research
        if (val > beta)
            return beta;
    }
    else if (val > alpha) {
        alpha = val;
        beta = val + 50;
        BestMove = pv;
    }
    // continue for other piece types
    if (moves = 0) {
        if (AreWeInCheck())
            return val_checkmate;
        return val_contempt;
    }
    return alpha; // alpha should be the same as the best value;
}
If you have to - kick me, but it was only an idea (though I'd love for it to be taken seriously, I doubt it will be because of processing costs).

Also, why do we have 8*8 bitboards with all the bit twiddling? Why don't we have 16*8 bitboards, with several properties of 0x88 (you could fit two bitboards there, one for, say, white bishops, and one for black bishops)?

A noob saying...
Matthew:out
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Some thoughts by a noob

Post by lucasart »

ZirconiumX wrote: It is basically a move ordering type search. It works by starting with a piece type (say, the king), and searches for d depth, using only that piece type (king) moves. If we get a beta cutoff, we open the window to +INFINITY and -INFINITY, and search again (Transposition Table may be useful for this bit); if this causes a cutoff, we return beta(fail-hard) or the value of the full window search. If we get a value that is alpha > value > beta, we give alpha and beta a window of, say, half a pawn;
It sounds quite silly indeed. And your pseudo code isn't precise enough. Perhaps you could refine it a little, so we can actually understand what you want to do
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Some thoughts by a noob

Post by Daniel Shawul »

If you have to - kick me, but it was only an idea (though I'd love for it to be taken seriously, I doubt it will be because of processing costs).

Also, why do we have 8*8 bitboards with all the bit twiddling? Why don't we have 16*8 bitboards, with several properties of 0x88 (you could fit two bitboards there, one for, say, white bishops, and one for black bishops)?
Yes beginners better avoid bitboards. Even 0x88 is not necessary , just use plain two dimensional board[x][y]. Then do a perft , then alpha-beta search, material evaluation, piece square tables etc...

As for your idea, I think it is good that you think of search ideas by yourself however rubbish it sounds.
I can see some problems with searching moves of one type (say king), because you are assuming the rest of the pieces are static. One move by other pieces makes our search invalid. A min-max search assumes the opponent does its best to hurt us. So that means he can use any weapon (the queen, knight etc..). Don't assume fair fights, one can bring a bomb to a gun fight :)

cheers
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: Some thoughts by a noob

Post by ZirconiumX »

Daniel,
That is a good point :oops: - the original plan was MakeMove(blahmove) then search responses - but this merely makes it a minimax-type search.

Matthew:out