refl3ction / minesweeper-rs

Play minesweeper on your terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minesweeper

Getting Started

cargo run

Notes for myself

Entities

Game

  • board: Board
  • game_difficult: GameDifficult
  • lost: bool
  • open_field(pos: Position)
  • create_board()
  • populate_mines()

Board

  • new(width, height, mine_count)
  • open_fields_pos
  • mine_fields_pos
  • flag_fields_pos
  • get_neighbors() -> Vec
  • count_neighboring_mines()
  • is_open()
  • is_mine()
  • is_flag()

Use Cases

open field

  • The field can't be flagged
  • if not mine:
    • Count all the mines surrounding the field
    • If count is 0, count all the mines surrounding the neighbors
  • else
    • Game is lost

References

About

Play minesweeper on your terminal.


Languages

Language:Rust 100.0%