A focused rename pass to bring the codebase in line with Python naming conventions. Distinct from #45 (PEP 8 layout / whitespace / line length) — this issue is specifically about what things are named, while #45 is about how the code is formatted. There is some overlap on case style (camelCase → snake_case).
Scheduling note: this work is deferred until the following rlm.py-touching PRs land, to avoid heavy rebases:
Quick bug bag: six independent small fixes (#29, #30, #31, #32, #33, #36) #49 (quick bug bag)
Type hints for Board + Move; mypy CI workflow (advisory) (#46) #54 (type hints, Board+Move)
Inline docs: docstrings + comment cleanup for Board + Move (#47) #55 (docstrings, Board+Move)
Types + docs follow-up: Player/Game/GameController/Piece subclasses (#46, #47) #56 (types + docs, Player / Game / Piece subclasses)
Small cleanups: dead code, version string, Loudmouth regex (#40, #41, #28) #57 (small cleanups)
Once those merge, this should be doable as one focused PR.
Scope
Four categories:
camelCase / mixedCase → snake_case for methods, attributes, and locals (PEP 8 for callables).
Privacy conventions — single underscore prefix (_foo) for methods and attributes that are clearly internal helpers.
Class-name cleanup — KQRBN_Piece has an underscore; PEP 8 says CapWords with no underscores.
Factory-method naming convention — classmethods that construct an instance should use the from_X form (e.g. Board.from_fen).
Concrete renames
Public method names (snake_case)
Current
Proposed
Board.isValidFENboard
Board.is_valid_fen_board
Board.is_FEN
Board.is_fen
Board.to_FEN_board
Board.to_fen_board
Board.convert_FEN_to_board_array
Board.fen_to_array (classmethod returning np.ndarray — not a Board factory, so not from_fen)
Board.squareIdx_to_boardIdxs
Board.square_idx_to_board_idxs
Privacy renames (only-called-internally → _-prefixed)
Currently public but only called from within their own class:
Current
Proposed
KQRBN_Piece.get_single_move
KQRBN_Piece._single_move
KQRBN_Piece.get_ray_moves
KQRBN_Piece._ray_moves
King.get_kingside_castle_move
King._kingside_castle_move
King.get_queenside_castle_move
King._queenside_castle_move
King.get_castling_allowed_by_position
King._castling_allowed_by_position
King.get_castling_allowed_by_check
King._castling_allowed_by_check
If any of these turn out to have external callers we haven't identified, that's a sign the privacy choice was wrong and they should stay public.
Class name
Current
Proposed
KQRBN_Piece
KQRBNPiece (or NonPawnPiece if we prefer descriptive over abbreviated — open to discussion)
Local variable names (camelCase → snake_case)
Mostly in Board.convert_FEN_to_board_array and Board.squareIdx_to_boardIdxs:
Current
Proposed
squareIdx
square_idx
fileIdx
file_idx
rankIdx
rank_idx
FEN_board, FEN_chars
fen_board, fen_chars
K_str (in find_king_square)
king_char
Already correct — no change needed
All dunder methods (__init__, __getitem__, etc.)
Class-level constants (EMPTY_SQUARE, FILE_TO_IDX_DICT, IDX_TO_FILE_DICT, PIECE_TO_FIGURINE_DICT, VALID_BOARD_SQUARE_CONTENTS_PATTERN)
The Game, Board, Move, Piece, Player, King, Queen, Rook, Bishop, Knight, Pawn, Lexicon, Loudmouth, GameController, RLMPlayer, HumanPlayer, NRLMPlayer, TestRLM class names
Module-level __version__ (after Cleanup: store versionNumber as a string, not a float #41 / Small cleanups: dead code, version string, Loudmouth regex (#40, #41, #28) #57 land)
Method-role tagging (@classmethod vs @staticmethod vs instance)
The current classmethod vs instance method split is mostly sensible. Two minor calls worth considering during the pass:
Move.square_to_string(cls, sq) uses cls.IDX_TO_FILE_DICT. Could be @staticmethod if we hoisted IDX_TO_FILE_DICT out of the class, but cleaner as-is.
Board.square_rank_str, Board.square_file_lett: similar — use Board.IDX_TO_FILE_DICT, fine as classmethods.
Reviewer judgement at the time, but defaulting to "leave as-is unless there's a reason."
Test plan
Out of scope
A focused rename pass to bring the codebase in line with Python naming conventions. Distinct from #45 (PEP 8 layout / whitespace / line length) — this issue is specifically about what things are named, while #45 is about how the code is formatted. There is some overlap on case style (camelCase → snake_case).
Scheduling note: this work is deferred until the following rlm.py-touching PRs land, to avoid heavy rebases:
Once those merge, this should be doable as one focused PR.
Scope
Four categories:
_foo) for methods and attributes that are clearly internal helpers.KQRBN_Piecehas an underscore; PEP 8 says CapWords with no underscores.from_Xform (e.g.Board.from_fen).Concrete renames
Public method names (snake_case)
Board.isValidFENboardBoard.is_valid_fen_boardBoard.is_FENBoard.is_fenBoard.to_FEN_boardBoard.to_fen_boardBoard.convert_FEN_to_board_arrayBoard.fen_to_array(classmethod returning np.ndarray — not a Board factory, so notfrom_fen)Board.squareIdx_to_boardIdxsBoard.square_idx_to_board_idxsPrivacy renames (only-called-internally →
_-prefixed)Currently public but only called from within their own class:
KQRBN_Piece.get_single_moveKQRBN_Piece._single_moveKQRBN_Piece.get_ray_movesKQRBN_Piece._ray_movesKing.get_kingside_castle_moveKing._kingside_castle_moveKing.get_queenside_castle_moveKing._queenside_castle_moveKing.get_castling_allowed_by_positionKing._castling_allowed_by_positionKing.get_castling_allowed_by_checkKing._castling_allowed_by_checkIf any of these turn out to have external callers we haven't identified, that's a sign the privacy choice was wrong and they should stay public.
Class name
KQRBN_PieceKQRBNPiece(orNonPawnPieceif we prefer descriptive over abbreviated — open to discussion)Local variable names (camelCase → snake_case)
Mostly in
Board.convert_FEN_to_board_arrayandBoard.squareIdx_to_boardIdxs:squareIdxsquare_idxfileIdxfile_idxrankIdxrank_idxFEN_board,FEN_charsfen_board,fen_charsK_str(infind_king_square)king_charAlready correct — no change needed
__init__,__getitem__, etc.)EMPTY_SQUARE,FILE_TO_IDX_DICT,IDX_TO_FILE_DICT,PIECE_TO_FIGURINE_DICT,VALID_BOARD_SQUARE_CONTENTS_PATTERN)Game,Board,Move,Piece,Player,King,Queen,Rook,Bishop,Knight,Pawn,Lexicon,Loudmouth,GameController,RLMPlayer,HumanPlayer,NRLMPlayer,TestRLMclass names__version__(after Cleanup: store versionNumber as a string, not a float #41 / Small cleanups: dead code, version string, Loudmouth regex (#40, #41, #28) #57 land)Method-role tagging (
@classmethodvs@staticmethodvs instance)The current classmethod vs instance method split is mostly sensible. Two minor calls worth considering during the pass:
Move.square_to_string(cls, sq)usescls.IDX_TO_FILE_DICT. Could be@staticmethodif we hoistedIDX_TO_FILE_DICTout of the class, but cleaner as-is.Board.square_rank_str,Board.square_file_lett: similar — useBoard.IDX_TO_FILE_DICT, fine as classmethods.Reviewer judgement at the time, but defaulting to "leave as-is unless there's a reason."
Test plan
rlm.py,demo_splash.py, andtests/.import rlmstill succeeds with no warnings.Out of scope
versionNumberrename — already in PR Small cleanups: dead code, version string, Loudmouth regex (#40, #41, #28) #57.single_char(sometimes the piece glyph, sometimes the piece letter) — those are best left to a content-aware refactor, not a mechanical rename pass.