Open ElizabethGraham opened 4 years ago
@ElizabethGraham, could you elaborate more on why you want to split up the qbr_moves() function?
@ElizabethGraham, could you elaborate more on why you want to split up the qbr_moves() function?
Well my main reasoning is that, to me, the script is looking a little over if'd at the moment, but also a good thing to focus on would be objectifying and simplifying the script overall.
My main goal yesterday was to reduce if's first, so I implemented the dictionary call. Issue was the main get_(pawn/rook)_moves() took only r + c as arguments while get_qbr_moves() took the piece argument too. get_qbr_moves() was actually the most correct function there though and the goal should be to make one big function operate largely like it did, but in it's own pieces.py script. The way it's set up now, we can work towards only having one get_piece_moves function instead of multiple -- ultimately reducing the length of the program and making it far more readable while keeping a more branchless programming approach.
Added a piece dictionary to get_validmoves() to reduce if statement usage. Broke up the queen, bishop, and rook move functions to make it play nicer with a dictionary call and improve readability -- this technically added more code, but the get(piece)_move functions should be adjusted anyway.