ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Project help required: Bitboard Fruit 2.1
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Matthew R. Brades



Joined: 17 Jul 2011
Posts: 800

PostPost subject: Re: Project help required: Bitboard Fruit 2.1    Posted: Fri May 11, 2012 10:14 am Reply to topic Reply with quote

It would appear that I have buggered the quiet piece move generator, so that only pawn quiet moves, captures and promotions are generated.

But I practically followed DC's implementation to the letter:

DC:
Code:

move_t *gen_piece_moves(const Board *B, uint64_t targets, move_t *mlist, bool king_moves)
/* Generates piece moves, when the board is not in check. Uses targets to filter the tss, eg.
 * targets = ~friends (all moves), empty (quiet moves only), enemies (captures only). */
{
   assert(!king_moves || !board_is_check(B));   // do not use when in check (use gen_evasion)
   const int us = B->turn;
   assert(!(targets & B->all[us]));
   uint64_t fss;

   // Knight Moves
   fss = B->b[us][Knight];
   while (fss) {
      int fsq = next_bit(&fss);
      uint64_t tss = NAttacks[fsq] & targets;
      while (tss) {
         int tsq = next_bit(&tss);
         mlist = serialize_moves(B, fsq, tsq, mlist);
      }
   }

   // Rook Queen moves
   fss = get_RQ(B, us);
   while (fss) {
      int fsq = next_bit(&fss);
      uint64_t tss = targets & rook_attack(fsq, B->st->occ);
      while (tss) {
         int tsq = next_bit(&tss);
         mlist = serialize_moves(B, fsq, tsq, mlist);
      }
   }

   // Bishop Queen moves
   fss = get_BQ(B, us);
   while (fss) {
      int fsq = next_bit(&fss);
      uint64_t tss = targets & bishop_attack(fsq, B->st->occ);
      while (tss) {
         int tsq = next_bit(&tss);
         mlist = serialize_moves(B, fsq, tsq, mlist);
      }
   }

   // King moves (king_moves == false is only used for check escapes)
   if (king_moves) {
      int fsq = B->king_pos[us];
      // here we also filter direct self checks, which shouldn't be sent to serial_moves
      uint64_t tss = KAttacks[fsq] & targets & ~B->st->attacks;
      while (tss) {
         int tsq = next_bit(&tss);
         mlist = serialize_moves(B, fsq, tsq, mlist);
      }
   }

   return mlist;
}


Fruit:
Code:

// add_quiet_moves()

static void add_quiet_moves(list_t * list, const board_t * board) {

   int me;
   const sq_t * ptr;
   int from, to;

   uint64 piece_bb;

   uint64 attacks;

   uint64 me_bb;

   ASSERT(list!=NULL);
   ASSERT(board!=NULL);

   me = board->turn;
   me_bb = COLOUR_IS_WHITE(me) ? WHITE_BB : BLACK_BB;

   // piece moves
   
   // knight

   piece_bb = KNIGHT_BB & me_bb;

   while (piece_bb) {
      from = next_bit(&piece_bb);
      attacks = knight_attacks(1ULL << from) & EMPTY_BB;
      while (attacks) {
         to = next_bit(&attacks);
         LIST_ADD(list,MOVE_MAKE(from,to));
      }
   }

   // bishop and queen

   piece_bb = (BISHOP_BB | QUEEN_BB) & me_bb;

   while (piece_bb) {
      from = next_bit(&piece_bb);
      attacks = bishop_attacks(from,OCC_BB) & EMPTY_BB;
      while (attacks) {
         to = next_bit(&attacks);
         LIST_ADD(list,MOVE_MAKE(from,to));
      }
   }

   // rook and queen

   piece_bb = (ROOK_BB | QUEEN_BB) & me_bb;

   while (piece_bb) {
      from = next_bit(&piece_bb);
      attacks = rook_attacks(from,OCC_BB) & EMPTY_BB;
      while (attacks) {
         to = next_bit(&attacks);
         LIST_ADD(list,MOVE_MAKE(from,to));
      }
   }

   // king

   piece_bb = KING_BB & me_bb;

   while (piece_bb) {
      from = next_bit(&piece_bb);
      attacks = king_attacks(1ULL << from) & EMPTY_BB;
      while (attacks) {
         to = next_bit(&attacks);
         LIST_ADD(list,MOVE_MAKE(from,to));
      }
   }

/**** THIS ISN'T MINE - THIS IS FABIEN'S CODE ****/

   // pawn moves

   if (COLOUR_IS_WHITE(me)) {

      for (ptr = &board->pawn[me][0]; (from=*ptr) != SquareNone; ptr++) {

         // non promotes

         if (SQUARE_RANK(from) != Rank7) {
            to = from + 16;
            if (board->square[to] == Empty) {
               ASSERT(!SQUARE_IS_PROMOTE(to));
               LIST_ADD(list,MOVE_MAKE(from,to));
               if (SQUARE_RANK(from) == Rank2) {
                  to = from + 32;
                  if (board->square[to] == Empty) {
                     ASSERT(!SQUARE_IS_PROMOTE(to));
                     LIST_ADD(list,MOVE_MAKE(from,to));
                  }
               }
            }
         }
      }

   } else { // black

      for (ptr = &board->pawn[me][0]; (from=*ptr) != SquareNone; ptr++) {

         // non promotes

         if (SQUARE_RANK(from) != Rank2) {
            to = from - 16;
            if (board->square[to] == Empty) {
               ASSERT(!SQUARE_IS_PROMOTE(to));
               LIST_ADD(list,MOVE_MAKE(from,to));
               if (SQUARE_RANK(from) == Rank7) {
                  to = from - 32;
                  if (board->square[to] == Empty) {
                     ASSERT(!SQUARE_IS_PROMOTE(to));
                     LIST_ADD(list,MOVE_MAKE(from,to));
                  }
               }
            }
         }
      }
   }
}


So what am I doing wrong?

I ran the test again between Fruit 2.1 and Fruit 2.1 Bitboard. 10- 0= 0+

Matthew:out
_________________
Well, that's that.

Account. Gone.
Back to top
View user's profile Send private message
Display posts from previous:   
Subject Author Date/Time
Project help required: Bitboard Fruit 2.1 Matthew R. Brades Tue May 08, 2012 3:20 pm
      Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Tue May 08, 2012 3:31 pm
            Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Tue May 08, 2012 5:06 pm
                  Re: Project help required: Bitboard Fruit 2.1 Ronald de Man Tue May 08, 2012 6:43 pm
                  Re: Project help required: Bitboard Fruit 2.1 Evert Glebbeek Tue May 08, 2012 8:34 pm
                        Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Tue May 08, 2012 8:41 pm
                  Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Tue May 08, 2012 8:43 pm
                        Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Tue May 08, 2012 10:09 pm
                              Re: Project help required: Bitboard Fruit 2.1 Ronald de Man Tue May 08, 2012 10:15 pm
                                    Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Tue May 08, 2012 10:21 pm
                                          Re: Project help required: Bitboard Fruit 2.1 Ronald de Man Tue May 08, 2012 10:59 pm
                                                Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Wed May 09, 2012 11:33 am
                                                      Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Sun May 13, 2012 5:11 pm
                                                            Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sun May 13, 2012 10:13 pm
                                                                  Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Mon May 14, 2012 2:17 am
                                                                        Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Mon May 14, 2012 10:19 am
                                                                              Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Mon May 14, 2012 10:53 am
                                                                                    Re: Project help required: Bitboard Fruit 2.1 Mincho Georgiev Mon May 14, 2012 12:19 pm
                                                                                    Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Mon May 14, 2012 12:28 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Mon May 14, 2012 3:10 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Mon May 14, 2012 4:25 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Mon May 14, 2012 4:34 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Mon May 14, 2012 4:46 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Mon May 14, 2012 5:05 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Mon May 14, 2012 8:51 pm
                                                                                    Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Mon May 14, 2012 10:43 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Tue May 15, 2012 5:41 am
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Tue May 15, 2012 2:45 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Tue May 15, 2012 4:04 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Evert Glebbeek Tue May 15, 2012 4:41 pm
                                                                              Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Mon May 14, 2012 10:41 pm
                                                                  Re: Project help required: Bitboard Fruit 2.1 Mincho Georgiev Mon May 14, 2012 6:22 am
                                                Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Sun May 13, 2012 5:09 pm
                        Re: Project help required: Bitboard Fruit 2.1 Ronald de Man Tue May 08, 2012 10:11 pm
                              Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Tue May 08, 2012 10:18 pm
                  Re: Project help required: Bitboard Fruit 2.1 Robert Hyatt Sun May 13, 2012 5:14 pm
                        Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Sun May 13, 2012 6:35 pm
                        Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Sun May 13, 2012 8:24 pm
                              Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sun May 13, 2012 10:22 pm
                              Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Mon May 14, 2012 6:56 am
                        Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sun May 13, 2012 10:18 pm
      Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Tue May 08, 2012 4:12 pm
      Re: Project help required: Bitboard Fruit 2.1 Lucas Braesch Wed May 09, 2012 5:01 am
      Re: Project help required: Bitboard Fruit 2.1 Lucas Braesch Wed May 09, 2012 5:13 am
            Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Wed May 09, 2012 11:35 am
                  Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Wed May 09, 2012 2:50 pm
                        Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Wed May 09, 2012 2:57 pm
                              Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Wed May 09, 2012 3:27 pm
                                    Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Thu May 10, 2012 1:32 pm
                                          Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Thu May 10, 2012 2:47 pm
                                                Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Thu May 10, 2012 3:11 pm
                                                      Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Thu May 10, 2012 3:14 pm
                                                            Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Thu May 10, 2012 11:06 pm
                                                                  Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Fri May 11, 2012 10:14 am
                                                                        Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Fri May 11, 2012 10:28 am
                                                                        Re: Project help required: Bitboard Fruit 2.1 Lucas Braesch Fri May 11, 2012 11:26 am
                                                                        Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sat May 12, 2012 2:06 pm
                                                                              Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Sat May 12, 2012 3:54 pm
                                                                                    Re: Project help required: Bitboard Fruit 2.1 Evert Glebbeek Sat May 12, 2012 4:20 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Sat May 12, 2012 5:00 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Sat May 12, 2012 5:15 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sat May 12, 2012 5:32 pm
                                                                                          Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sat May 12, 2012 8:54 pm
                                                                                    Re: Project help required: Bitboard Fruit 2.1 Sven Schüle Sat May 12, 2012 5:21 pm
                                                      Re: Project help required: Bitboard Fruit 2.1 H.G.Muller Thu May 10, 2012 3:25 pm
                                          Re: Project help required: Bitboard Fruit 2.1 Matthew R. Brades Thu May 10, 2012 3:06 pm
                                                Re: Project help required: Bitboard Fruit 2.1 Ronald de Man Thu May 10, 2012 6:42 pm
                        Re: Project help required: Bitboard Fruit 2.1 Lucas Braesch Thu May 10, 2012 10:51 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads