@@ -455,12 +455,6 @@ class Move:
455455 promotion : Optional [PieceType ] = None
456456 drop : Optional [PieceType ] = None
457457
458- def __init__ (self , from_square : Square , to_square : Square , promotion : Optional [PieceType ] = None , drop : Optional [PieceType ] = None ) -> None :
459- self .from_square = from_square
460- self .to_square = to_square
461- self .promotion = promotion
462- self .drop = drop
463-
464458 def uci (self ) -> str :
465459 """
466460 Gets a UCI string for the move.
@@ -568,7 +562,7 @@ def _reset_board(self) -> None:
568562 self .occupied = BB_RANK_1 | BB_RANK_2 | BB_RANK_7 | BB_RANK_8
569563
570564 def reset_board (self ) -> None :
571- """Resets piece positions to the starting position."""
565+ """Resets pieces to the starting position."""
572566 self ._reset_board ()
573567
574568 def _clear_board (self ) -> None :
@@ -978,13 +972,13 @@ def set_piece_map(self, pieces: Mapping[Square, Piece]) -> None:
978972 """
979973 self ._set_piece_map (pieces )
980974
981- def _set_chess960_pos (self , sharnagl : int ) -> None :
982- if not 0 <= sharnagl <= 959 :
983- raise ValueError (f"chess960 position index not 0 <= { sharnagl !r} <= 959" )
975+ def _set_chess960_pos (self , scharnagl : int ) -> None :
976+ if not 0 <= scharnagl <= 959 :
977+ raise ValueError (f"chess960 position index not 0 <= { scharnagl !r} <= 959" )
984978
985979 # See http://www.russellcottrell.com/Chess/Chess960.htm for
986980 # a description of the algorithm.
987- n , bw = divmod (sharnagl , 4 )
981+ n , bw = divmod (scharnagl , 4 )
988982 n , bb = divmod (n , 4 )
989983 n , q = divmod (n , 6 )
990984
@@ -1039,16 +1033,16 @@ def _set_chess960_pos(self, sharnagl: int) -> None:
10391033 self .occupied = BB_RANK_1 | BB_RANK_2 | BB_RANK_7 | BB_RANK_8
10401034 self .promoted = BB_EMPTY
10411035
1042- def set_chess960_pos (self , sharnagl : int ) -> None :
1036+ def set_chess960_pos (self , scharnagl : int ) -> None :
10431037 """
10441038 Sets up a Chess960 starting position given its index between 0 and 959.
10451039 Also see :func:`~chess.BaseBoard.from_chess960_pos()`.
10461040 """
1047- self ._set_chess960_pos (sharnagl )
1041+ self ._set_chess960_pos (scharnagl )
10481042
10491043 def chess960_pos (self ) -> Optional [int ]:
10501044 """
1051- Gets the Chess960 starting position index between 0 and 959
1045+ Gets the Chess960 starting position index between 0 and 959,
10521046 or ``None``.
10531047 """
10541048 if self .occupied_co [WHITE ] != BB_RANK_1 | BB_RANK_2 :
@@ -1295,7 +1289,7 @@ def empty(cls: Type[BaseBoardT]) -> BaseBoardT:
12951289 return cls (None )
12961290
12971291 @classmethod
1298- def from_chess960_pos (cls : Type [BaseBoardT ], sharnagl : int ) -> BaseBoardT :
1292+ def from_chess960_pos (cls : Type [BaseBoardT ], scharnagl : int ) -> BaseBoardT :
12991293 """
13001294 Creates a new board, initialized with a Chess960 starting position.
13011295
@@ -1305,7 +1299,7 @@ def from_chess960_pos(cls: Type[BaseBoardT], sharnagl: int) -> BaseBoardT:
13051299 >>> board = chess.Board.from_chess960_pos(random.randint(0, 959))
13061300 """
13071301 board = cls .empty ()
1308- board .set_chess960_pos (sharnagl )
1302+ board .set_chess960_pos (scharnagl )
13091303 return board
13101304
13111305
@@ -1436,6 +1430,11 @@ def reset(self) -> None:
14361430 self .reset_board ()
14371431
14381432 def reset_board (self ) -> None :
1433+ """
1434+ Resets only pieces to the starting position. Use
1435+ :func:`~chess.Board.reset()` to fully restore the starting position
1436+ (including turn, castling rights, etc.).
1437+ """
14391438 super ().reset_board ()
14401439 self .clear_stack ()
14411440
@@ -2114,7 +2113,7 @@ def pop(self: BoardT) -> Move:
21142113 """
21152114 Restores the previous position and returns the last move from the stack.
21162115
2117- :raises: :exc:`IndexError` if the stack is empty.
2116+ :raises: :exc:`IndexError` if the move stack is empty.
21182117 """
21192118 move = self .move_stack .pop ()
21202119 self ._stack .pop ().restore (self )
@@ -2130,7 +2129,7 @@ def peek(self) -> Move:
21302129
21312130 def find_move (self , from_square : Square , to_square : Square , promotion : Optional [PieceType ] = None ) -> Move :
21322131 """
2133- Finds a matching legal move for an origin square, a target square and
2132+ Finds a matching legal move for an origin square, a target square, and
21342133 an optional promotion piece type.
21352134
21362135 For pawn moves to the backrank, the promotion piece type defaults to
@@ -2386,8 +2385,8 @@ def set_piece_map(self, pieces: Mapping[Square, Piece]) -> None:
23862385 super ().set_piece_map (pieces )
23872386 self .clear_stack ()
23882387
2389- def set_chess960_pos (self , sharnagl : int ) -> None :
2390- super ().set_chess960_pos (sharnagl )
2388+ def set_chess960_pos (self , scharnagl : int ) -> None :
2389+ super ().set_chess960_pos (scharnagl )
23912390 self .chess960 = True
23922391 self .turn = WHITE
23932392 self .castling_rights = self .rooks
@@ -2399,7 +2398,7 @@ def set_chess960_pos(self, sharnagl: int) -> None:
23992398
24002399 def chess960_pos (self , * , ignore_turn : bool = False , ignore_castling : bool = False , ignore_counters : bool = True ) -> Optional [int ]:
24012400 """
2402- Gets the Chess960 starting position index between 0 and 956
2401+ Gets the Chess960 starting position index between 0 and 956,
24032402 or ``None`` if the current position is not a Chess960 starting
24042403 position.
24052404
@@ -3536,9 +3535,9 @@ def from_epd(cls: Type[BoardT], epd: str, *, chess960: bool = False) -> Tuple[Bo
35363535 return board , board .set_epd (epd )
35373536
35383537 @classmethod
3539- def from_chess960_pos (cls : Type [BoardT ], sharnagl : int ) -> BoardT :
3538+ def from_chess960_pos (cls : Type [BoardT ], scharnagl : int ) -> BoardT :
35403539 board = cls .empty (chess960 = True )
3541- board .set_chess960_pos (sharnagl )
3540+ board .set_chess960_pos (scharnagl )
35423541 return board
35433542
35443543
0 commit comments