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

Fixed marking cells with bombs for example mines #792

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

xilec
Copy link
Contributor

@xilec xilec commented Jun 8, 2024

Actually I don't know goal of this example and would this changes acceptable.

For fixing auto_reveal behaviour, it needs information about marked cells in model.
When Marked state moved to border's model. All data about cells state become in the model cells, therefore much easy was remove synchronization cell's state between view and model and cell's state from view and just share cells state from model to view (and draw it).

This PR depends on #790

xilec added 5 commits June 8, 2024 00:24
…earby unmarket cells by middle mouse click and count scores.
All state moved to model (flag marks) therefore `border::view::Overlay` became meaningless type and was removed.
Now method `BoardView::draw()` using data about cells from model.
Copy link
Owner

@gyscos gyscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work, looks great! I admit I kinda forgot about this example, but it deserves more attention!

Just a couple comments, and it should be good to merge!

cursive/examples/mines/board/model.rs Outdated Show resolved Hide resolved
cursive/examples/mines/board/model.rs Outdated Show resolved Hide resolved
cursive/examples/mines/board/model.rs Outdated Show resolved Hide resolved
cursive/examples/mines/board/model.rs Outdated Show resolved Hide resolved
cursive/examples/mines/board/model.rs Outdated Show resolved Hide resolved
cursive/examples/mines/main.rs Outdated Show resolved Hide resolved
(Closed, _, false) => " □",
(Marked, _, false) => " ■",
(Opened, Free(n), false) | (_, Free(n), true) => [" ", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8"][n],
(Opened, Bomb, false) | (_, Bomb, true) => "\u{01F4A3} "
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my tests the 💣 character is rendered double-width, so no need for a space after?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I removed redundant space

cursive/examples/mines/board/view.rs Outdated Show resolved Hide resolved
cursive/examples/mines/board/view.rs Outdated Show resolved Hide resolved
xilec and others added 9 commits June 22, 2024 22:55
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
Co-authored-by: Alexandre Bury <[email protected]>
@xilec xilec marked this pull request as ready for review July 7, 2024 13:27
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

2 participants