Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Report FDS miniproject.pdf
Binary file not shown.
12 changes: 6 additions & 6 deletions minesweeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bool ismine(int row,int col,char board[][max_side]){ // If there is a mine
return (false);
}

void make_move(int *x,int *y){
void make_move(int *x,int *y){ //take input from the user
while(true) // Correct input
{
cout<<"\nEnter your move: [row] [column] -> ";
Expand All @@ -37,7 +37,7 @@ void make_move(int *x,int *y){
}
}

void printboard(char myboard[][max_side]){
void printboard(char myboard[][max_side]){ //to print current gameplay board
clear();
cout<<"\n\n\t\t\t ";
for(int i=0;i<SIDE;i++)
Expand Down Expand Up @@ -67,7 +67,7 @@ void printboard(char myboard[][max_side]){
return;
}

int countadjacent(int row,int col,int mines[][2],char realboard[][max_side]) // Counts the no of adjacent cell that does no contain a mine
int countadjacent(int row,int col,int mines[][2],char realboard[][max_side]) // Counts the no of adjacent cell that contains a mine
{
int count=0;
if(isvalid(row-1,col)==true)
Expand Down Expand Up @@ -115,7 +115,7 @@ int countadjacent(int row,int col,int mines[][2],char realboard[][max_side]) //

bool playminesuntil(char myboard[][max_side],char realboard[][max_side],int mines[][2],int row,int col,int *moves_left)
{
if(myboard[row][col]!='-') //
if(myboard[row][col]!='-') //
return false;

int i,j;
Expand Down Expand Up @@ -181,7 +181,7 @@ bool playminesuntil(char myboard[][max_side],char realboard[][max_side],int mine
}
}

void placemines(int mines[][2],char realboard[][max_side])
void placemines(int mines[][2],char realboard[][max_side]) // to place mines randomly on the board
{
bool mark[max_side*max_side];

Expand Down Expand Up @@ -259,7 +259,7 @@ void play()
placemines(mines,realboard);

//if you want cheat and win
//cheatmines(realboard);
cheatmines(realboard);
int currentmoveindex=0;

while(gameover==false)
Expand Down
Binary file added minesweeper.pptx
Binary file not shown.