Minesweeper help with resetting the display screen

3 views (last 30 days)
How do I create code that will reset the screen back to the original code? Basically I am playing minesweeper and the player (my_position) is set on the top right of the matrix as 100. I need to reset my matrix back to -1s and the 100 at the top.. when my_position steps on a mine (or a 1 in the 'mines' matrix). mines = rand(10) > .85
I had to create a 10x10 matrix of -1s (game_window(1:10,1:10) = -1) . So when my_position on the mines field in correlation to the game_window steps on a (1) in mines I need to reset the screen to 10x10 of -1s and 100 at the top.
Any help?

Answers (1)

Walter Roberson
Walter Roberson on 28 Feb 2020
clf() or cla()
Anything beyond that would require knowledge of how you are drawing onto the screen at present.

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!