From acd149ea2e5944d943e01fb53d6f034db3142c10 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Tue, 29 Dec 2020 17:30:45 +0800 Subject: [PATCH] movegen: Change some iterator val to auto --- src/movegen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/movegen.cpp b/src/movegen.cpp index 3c989b9f..561d974c 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -55,7 +55,7 @@ ExtMove *generate(Position &pos, ExtMove *moveList) ExtMove *cur = moveList; // move piece that location weak first - for (int i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { + for (auto i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { from = MoveList::movePriorityList[i]; if (!pos.select_piece(from)) { @@ -64,7 +64,7 @@ ExtMove *generate(Position &pos, ExtMove *moveList) if (pos.pieces_count_on_board(pos.side_to_move()) > rule.nPiecesAtLeast || !rule.allowFlyWhenRemainThreePieces) { - for (int direction = MD_BEGIN; direction < MD_NB; direction++) { + for (auto direction = MD_BEGIN; direction < MD_NB; ++direction) { to = static_cast(MoveList::adjacentSquares[from][direction]); if (to && !pos.get_board()[to]) { *cur++ = make_move(from, to); @@ -96,7 +96,7 @@ ExtMove *generate(Position &pos, ExtMove *moveList) ExtMove *cur = moveList; if (pos.is_all_in_mills(them)) { - for (int i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { + for (auto i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { s = MoveList::movePriorityList[i]; if (pos.get_board()[s] & make_piece(them)) { *cur++ = (Move)-s; @@ -106,7 +106,7 @@ ExtMove *generate(Position &pos, ExtMove *moveList) } // not is all in mills - for (int i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { + for (auto i = EFFECTIVE_SQUARE_NB - 1; i >= 0; i--) { s = MoveList::movePriorityList[i]; if (pos.get_board()[s] & make_piece(them)) { if (rule.allowRemovePieceInMill || !pos.in_how_many_mills(s, NOBODY)) {