Closed JeromeSchmied closed 6 months ago
As far as I could understand the Pages
enum, the Help
variant was completely unnecessary and just made life harder. Therefore I removed it and utilized the app.show_help_popup
. I also removed 'x' keybinding and replaced it's functionality with Esc
. Let me know if there's anything that you think could further be changed.
Sorry bro dunno how this works
I haven't tested many scenarios, but one thing that still doesn't work is promotions. I'll try to implement them though.
I haven't tested many scenarios, but one thing that still doesn't work is promotions. I'll try to implement them though.
Nice job already hope you will be able to get over the promotion !
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of [i8; 2]
or Vec<i8>
, which is not that much to the point to tell the truth, I made something like this:
struct Coordinate {
x: i8,
y: i8,
}
I also started rewriting every occurence to comply with this new Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time.
What do you think about it?
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of
[i8; 2]
orVec<i8>
, which is not that much to the point to tell the truth, I made something like this:struct Coordinate { x: i8, y: i8, }
I also started rewriting every occurence to comply with this new
Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time.What do you think about it?
might be a pain in the ass but can be worth it in the end so what does x and y represent x being the rows and y the lines of the board ?
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of
[i8; 2]
orVec<i8>
, which is not that much to the point to tell the truth, I made something like this:struct Coordinate { x: i8, y: i8, }
I also started rewriting every occurence to comply with this new
Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time. What do you think about it?might be a pain in the ass but can be worth it in the end so what does x and y represent x being the rows and y the lines of the board ?
just the other way round: y: rows, x: lines
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of
[i8; 2]
orVec<i8>
, which is not that much to the point to tell the truth, I made something like this:struct Coordinate { x: i8, y: i8, }
I also started rewriting every occurence to comply with this new
Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time. What do you think about it?might be a pain in the ass but can be worth it in the end so what does x and y represent x being the rows and y the lines of the board ?
just the other way round: y: rows, x: lines
ok i see maybe we could directly put
struct Coordinate { line: i8, row: i8, }
for it to be very clear ?
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of
[i8; 2]
orVec<i8>
, which is not that much to the point to tell the truth, I made something like this:struct Coordinate { x: i8, y: i8, }
I also started rewriting every occurence to comply with this new
Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time. What do you think about it?might be a pain in the ass but can be worth it in the end so what does x and y represent x being the rows and y the lines of the board ?
just the other way round: y: rows, x: lines
ok i see maybe we could directly put
struct Coordinate { line: i8, row: i8, }
for it to be very clear ?
only: col (column) instead of line, is that good?
Now that I know the code somewhat better, I got fed up with the way coordinates are stored, so this is what I came up with: instead of
[i8; 2]
orVec<i8>
, which is not that much to the point to tell the truth, I made something like this:struct Coordinate { x: i8, y: i8, }
I also started rewriting every occurence to comply with this new
Coordinate
design. It is quite a pain in the neck, but overall I'd say it's worth the time. What do you think about it?might be a pain in the ass but can be worth it in the end so what does x and y represent x being the rows and y the lines of the board ?
just the other way round: y: rows, x: lines
ok i see maybe we could directly put struct Coordinate { line: i8, row: i8, } for it to be very clear ?
only: col (column) instead of line, is that good?
sounds good to me !
Fixes #55, #56, hopefully will once fix #52.
As I'm working on dealing with edge cases for takeback:
I explored some weird things: I wrote some tests, made Coords check(panic) if a coordinate is not between 0 and 7. Well that happens quite often, not only when UNDEFINED_POSITION
is used. Why is that? I can't work it out really, if I'm right, only between (0;0) and (7;7) coordinates are correct to index board
which I made a type alias now(also Piece
).
One more thing: board::tests::takeback_kick
is a test I wrote to check whether takeback works in case of a piece has been kicked, needs to be placed back on the board. Well as far as you can tell (from actually playing with the game) it works. But the test fails for some reason I can't find. Could you check please? it'd be a huge help.
One more thing:
board::tests::takeback_kick
is a test I wrote to check whether takeback works in case of a piece has been kicked, needs to be placed back on the board. Well as far as you can tell (from actually playing with the game) it works. But the test fails for some reason I can't find. Could you check please? it'd be a huge help.
Hi, thanks for the feedback I will check both your test and the panick you mentioned above in the week (lot of work in parallel :disappointed: I don't have a lot of time) !
One more thing:
board::tests::takeback_kick
is a test I wrote to check whether takeback works in case of a piece has been kicked, needs to be placed back on the board. Well as far as you can tell (from actually playing with the game) it works. But the test fails for some reason I can't find. Could you check please? it'd be a huge help.Hi, thanks for the feedback I will check both your test and the panick you mentioned above in the week (lot of work in parallel 😞 I don't have a lot of time) !
I'm sorry to hear. It can wait anyway.
How is it going @JeromeSchmied I see that you made a lot of commits which is great ! feel free to put the pr in a ready tstae when you need be to review it
Hey @JeromeSchmied,
I was looking at the source and was going to submit some ideas I had to improve this, but this PR seems to be a large rewrite of a significant portion of the app. It has many different changes rolled up into a single PR. Monolithic changes like this are problematic as it makes it difficult to work in any areas of the app without conflict, and they're more difficult to review as the time investment to do so scales exponentially (or at least more than linearly) with the size of the changes.
@thomas-mauran / @JeromeSchmied what's your preferred way forward here? I see a couple of options:
Regarding coordinates: currently these are Row/Col but the chess terms are Rank/File, why not make these explicit enums and implement ops::Index against the board https://doc.rust-lang.org/std/ops/trait.Index.html
@joshka thanks for this comment, I couldn't agree with you more. The only reason for putting this huge amount of commits in one PR is because I have no idea how to create more than one PRs at once, but I spotted out some crucial issues in the code while working on the takeback.
issues? I fixed:
Coords
has a huge impact on development speed I think.self
as argument.movehistory
now doesn't hold an Option<PieceType>
, but a PieceType
as it can't anyway, right?issues I've been working on, but are not yet done:
To resolve the conflict, in my opinion it'd be best if I reverted my commits about
KeyRelease
fix
and then make PRs for each remaining, also implement std::ops::Index
for Board
.I'll see what I can do.
I'm sorry, it looks like I can't actually revert any commits other than KeyRelease fix from the issues I just mentioned, as my git history is such a huge mess.
To fix this, may we merge this PR as is, if I just comment out code using functions I wrote for pgn import (takeback is already commented out), so that the extra code I wrote will remain there, and soon I'll try to implement then one by one.
Is this ok?
Sorry for any inconveniences I made.
Hey, no problem on the inconvenience. If @thomas-mauran is ok with your direction, then that's his call as he code owner, not mine. I have a preference for small orthogonal chunks of work over large ones, but not everyone shares that approach.
It sounds like you're using git as a single branch in your local repository, and so you're thinking about the history is one dimensional. What I'd generally try to do in this sort of thing is a branch for each feature, trying to make each branch have little overlaps in the code that they're touching, and having a clear goal / finished state. Thing two dimensional in terms of non-overlapping areas.
At a high level splitting up the PR looks something like:
git branch all-the-things
to create a new branch at the current point in your local to come back to if you need to, then run git reset --hard upstream/main
to reset your main branch to be the same as the repo main. (your remote name might be different than upstream, run git remote -v
to check).git switch -c coords
)git cherry-pick fc42fc5
) to bring in fc42fc53fadf1fd5e00ffc08dc6f839036f70ca0 and then pick up more commits to make up the PRRepeat for each small chunk of work.
Another approach is to just throwaway your changes (but use them as a reference point for doing them again right upfront). I do this fairly often myself (implement something incrementally and then redo it correctly).
The last approach is just to get this to a point where it's bug free and mergable as-is. I think this might be difficult.
Yep, as @joshka said the best thing would be to split your pr in multiple ones, thanks a lot @joshka for providing details on how to do that easily for @JeromeSchmied I think this will be very hepful. @JeromeSchmied tell me if you are having any issue splitting the pr
I started extracting my commits to different PR-s. I think I shall close this one, as I'll make new ones anyway, right?
I started extracting my commits to different PR-s. I think I shall close this one, as I'll make new ones anyway, right?
Sounds good!
This creates an error: Pressing
Esc
return toHome
when playing. I'll fix it soon(probably tomorrow).