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 

Skipping duplicat moves
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Steve Maughan



Joined: 08 Mar 2006
Posts: 1013
Location: Florida, USA

PostPost subject: Re: Skipping duplicat moves    Posted: Mon Dec 04, 2017 3:07 pm Reply to topic Reply with quote

It's all done as part of the "move_ordering". Here's the relevant code:

Code:
void order_moves(struct t_board *board, struct t_move_list *move_list, int ply) {

    struct t_move_record *hash_move = move_list->hash_move;
    struct t_move_record *move;

    struct t_move_record *killer1 = board->pv_data[ply].killer1;
    struct t_move_record *killer2 = board->pv_data[ply].killer2;
    struct t_move_record *killer3 = NULL;
    struct t_move_record *killer4 = NULL;

   t_chess_color color = board->to_move;


    struct t_move_record *refutation = NULL;

    if (ply > 1) {
        killer3 = board->pv_data[ply - 2].killer1;
        killer4 = board->pv_data[ply - 2].killer2;
      board->pv_data[ply].killer3 = killer3;
      board->pv_data[ply].killer4 = killer4;
   }
   else{
      board->pv_data[ply].killer3 = NULL;
      board->pv_data[ply].killer4 = NULL;
   }

   for (int i = move_list->count - 1; i >= 0; i--)
   {
      move = move_list->move[i];
      assert(move);
      if (move == hash_move) {
         move_list->value[i] = MOVE_ORDER_HASH;
      }
      else if (move->captured) {
         move_list->value[i] = move->mvvlva + MOVE_ORDER_CAPTURE - COLOR_RANK(color, move->to_square);
      }
      else if (move == killer1) {
         move_list->value[i] = MOVE_ORDER_KILLER1;
      }
      else if (move == refutation) {
         move_list->value[i] = MOVE_ORDER_REFUTATION;
      }
      else if (move == killer2) {
         move_list->value[i] = MOVE_ORDER_KILLER2;
      }
      else if (move == killer3) {
         move_list->value[i] = MOVE_ORDER_KILLER3;
      }
      else if (move == killer4) {
         move_list->value[i] = MOVE_ORDER_KILLER4;
      }
      else {
         move_list->value[i] = move->history;
      }
    }
}

_________________
http://www.chessprogramming.net - Maverick Chess Engine
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
Skipping duplicat moves H.G.Muller Sun Dec 03, 2017 10:30 pm
      Re: Skipping duplicat moves H.G.Muller Mon Dec 04, 2017 9:08 am
      Re: Skipping duplicat moves Steve Maughan Mon Dec 04, 2017 2:00 pm
            Re: Skipping duplicat moves H.G.Muller Mon Dec 04, 2017 2:52 pm
                  Re: Skipping duplicat moves Steve Maughan Mon Dec 04, 2017 3:07 pm
                        Re: Skipping duplicat moves H.G.Muller Mon Dec 04, 2017 6:16 pm
      Re: Skipping duplicat moves Álvaro Begué Mon Dec 04, 2017 6:17 pm
            Re: Skipping duplicat moves H.G.Muller Mon Dec 04, 2017 6:50 pm
                  Re: Skipping duplicat moves Sven Schüle Mon Dec 04, 2017 10:19 pm
                        Re: Skipping duplicat moves H.G.Muller Tue Dec 05, 2017 10:35 am
                              Re: Skipping duplicat moves Michael Sherwin Mon Dec 11, 2017 10:48 pm
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