Starlight-30036225 / ChessTCP

FILLMELATER
0 stars 0 forks source link

Knight movement #13

Closed Starlight-30036225 closed 7 months ago

Starlight-30036225 commented 7 months ago

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

Starlight-30036225 commented 7 months ago

image

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?

image

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?

Starlight-30036225 commented 7 months ago

image 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.

Starlight-30036225 commented 7 months ago

image 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

Starlight-30036225 commented 7 months ago

image

Here is a knight, and the moves it could make