Minesweeper help with resetting the display screen

2 次查看(过去 30 天)
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?

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by