Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor app state and implement player selection (human vs. computer), piece promotion, game status, and resigning/draws #1

Merged
merged 7 commits into from Oct 9, 2022

Conversation

ntietz
Copy link
Owner

@ntietz ntietz commented Oct 8, 2022

There's a lot in this one, but I think that this gets everything into a good spot to move forward with actual strategies for the computer. Summary of the major changes:

  • Break out state into AppState and focus on interacting through its methods; it locks each sub-portion of state independently, so you don't get blocked by another portion of state being locked if you're not using it
  • Implement one runner thread per player (if the player is a computer) and clean them up when the game restarts or concludes
  • Add ability to reset the game
  • Add the ability to start the game, and lock out input when it's not started yet
  • Add the ability to select who is white or black (choices are human or one of two computer "strategies")
  • Add a menu pop-up for piece promotion so that that's possible
  • Add buttons to resign or declare a draw
  • Add display of the current game status so you know when it is started and finished

This isn't the cleanest code, and there's a lot of work left to do. I'm not hugely motivated to clean it up soon because I want to move onto the engine side of this, and I also think I want to switch to fltk-rs since egui has been difficult in some instances where I have to imitate retained mode, and I've had a lot of trouble finding docs for what I am trying to do. I don't really have a coherent thought here but I think the options going forward are:

  • Stick with egui and work through it (this sounds rather painful but do the other options not? 🤔 )
  • Create a web application instead and use web technologies (I don't really want to do this, although this might be a good chance to explore web tech again in a non-work context and learn to enjoy it again)
  • Switch to fltk-rs (this sounds like it could be better, but then again, I might end up in the same pain pit)
  • Abandoning the GUI is not an option 😄

Right now I lean toward eventually adopting fltk-rs, but I'm going to take a break from GUI stuff after this lands for a while.

@ntietz ntietz merged commit 9f0a25d into main Oct 9, 2022
@ntietz ntietz deleted the select-players branch October 9, 2022 00:33
ntietz added a commit that referenced this pull request Nov 5, 2023
…), piece promotion, game status, and resigning/draws (#1)

There's a lot in this one, but I think that this gets everything into a
good spot to move forward with actual strategies for the computer.
Summary of the major changes:

- Break out state into `AppState` and focus on interacting through its
methods; it locks each sub-portion of state independently, so you don't
get blocked by another portion of state being locked if you're not using
it
- Implement one runner thread per player (if the player is a computer)
and clean them up when the game restarts or concludes
- Add ability to reset the game
- Add the ability to start the game, and lock out input when it's not
started yet
- Add the ability to select who is white or black (choices are human or
one of two computer "strategies")
- Add a menu pop-up for piece promotion so that that's possible
- Add buttons to resign or declare a draw
- Add display of the current game status so you know when it is started
and finished

This isn't the cleanest code, and there's a lot of work left to do. I'm
not hugely motivated to clean it up soon because I want to move onto the
engine side of this, and I also think I want to switch to
[fltk-rs](https://fltk-rs.github.io/fltk-rs/) since
[egui](https://github.com/emilk/egui) has been difficult in some
instances where I have to imitate retained mode, and I've had a **lot**
of trouble finding docs for what I am trying to do. I don't really have
a coherent thought here but I think the options going forward are:

- Stick with egui and work through it (this sounds rather painful but do
the other options not? 🤔 )
- Create a web application instead and use web technologies (I don't
really want to do this, although this might be a good chance to explore
web tech again in a non-work context and learn to enjoy it again)
- Switch to fltk-rs (this sounds like it could be better, but then
again, I might end up in the same pain pit)
- Abandoning the GUI is not an option 😄 

Right now I lean toward eventually adopting fltk-rs, but I'm going to
take a break from GUI stuff after this lands for a while.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant