Vinatorul / minesweeper-rs

Simple minesweeper in Rust
MIT License
76 stars 9 forks source link

feat: when you click on a revealed number #16

Closed waynenilsen closed 9 years ago

waynenilsen commented 9 years ago

The game "clicks" on unrevealed, unmarked neighbors for you. This makes solving minesweeper puzzles much faster.

This is a little bit "fast and dirty" but I wanted to get something done and it was neat to actually change the behavior of a game (that there is no way I could have created from scratch). One refactor that I think would be useful would be to add functions to check for a board position on an edge. Maybe adding an enum and a function to field such as fn on_edge(e: Edge, i : u32) -> bool and the enum Edge { Top, Bottom, Left, Right, }

Vinatorul commented 9 years ago

Thank you for your contribution! I was thinking about to implement this, but in original minesweeper neighbors will be opened only when number cell have same number of marked neighbors.

I will check and merge this when will come home.

about on_edge: maybe will be better to do comething like: fn get_neighbour_inds which return slice of u32 numbers, or fn bypass_neighbour which takes closure and passes to it valid inds

Vinatorul commented 9 years ago

Merged :+1: Thank you!