Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Minesweeper

MATLAB
Simulation
CHE 492 - Computer Methods in Chemical
Engineering - Dr. Jason Bara

Done by: Fawaz Alsaiede


Abdulaziz Alhumaidi
Mohammed Alajmi
Outline

Objective Methods Results and Discussion


Minesweeper MATLAB Code logic Implemented Check Results Obtained
Simulation
Objective
 We set out to recreate the popular windows game
“Minesweeper” using a MATLAB simulation.

 Develop an algorithmic logic to solve a Minesweeper


game.

 Determine the average number of wins of a


Minesweeper game.
Methods
 Initially, we will open a cell randomly and we will make sure the first cell opened will not be a mine.
Methods
 Once a cell is opened, adjacent cells are also opened, if and only if this cell has no mines adjacent to it.
Methods
 We count the number of adjacent marked cells and closed cells after the first move is made. If total marked
and closed cells are the same as the adjacent number of mines then closed cells will be mines, so they can
be marked safely.
Methods
 If we don’t have any possible cells which can be mine or opened, then a random cell will be picked and
opened and the code logic repeated until the game is solved.
Results and Discussion

Percentage of games Average number of Average number of


Number of trials
won winning moves losing moves

10 80% 26 5

100 77% 28 11

1000 68.3% 29 9

10000 67.67% 29 10
Results and Discussion
 Further develop the code logic implemented
in order to optimally solve a Minesweeper
game in less time.

 Machine learning can be implemented to


solve such problems and real life
applications.
Thank you for listening!

You might also like