Closed Starlight-30036225 closed 7 months ago
I only had to write the first Move to find where the repetition is going to be, I can move this all into a function and just feed in the moves and have it return a Boolean?
This will work but it still leaves a lot of whole chunk of if statements inside the knight class to check the Boolean, Can I just shift dependency of adding to the list over to the function?
Only problem I can see with this, is now the piece wont know if the square is achieved by taking a piece. Which isnt important for the rook, but is important here: #10 for knowing when to stop movement. I will come back to this.
This is what the knight movement looks like now, I could simplify this even further by moving the differences in x and y into an array or something similar, I will return to this to simplify
Here is a knight, and the moves it could make
I am mostly using this to identify the weakness in my current method and simplify everything. But for my first attempt I will use the same methodology I used here: #10