Back Recursion and minesweeper (java programming tutorial)

90-120
Created By: Jack Le
Published At: 2015-03-21
Search Query: Java Recursion
Tags: Java (Programming Language) Recursion Programming Language (Software Genre) Tutorial (Media Genre) Java (Software) netbeans mindsweeper Windows Let Software (album) Maker Kevin Desktop Linux Computer You Basic Don Apple Play c programing Live C (Programming Language) Ubuntu Programmer (Profession) python bash Down Minesweeper (Video Game) Birthday Arena Begin Muse Visual There Rudolf Let Play Don Let Let You Them Won sort eclipse
Hi, we are going to put the concept of recursion into use in this video. This video will show you how to create your own minesweeper game as well as the train of thought and problems that I had while creating it. Here's the project:
http://www.mediafire.com/download/mb88w9w74u6r5uf/MS.rar
logo Ask VidTutorAssistant
Comment
or
Question
Your name
Comments with generated responses
@Irnt1
2015-09-23

It's really helpful thanks a lot about this.


bro can i ask about the minesweeper java exercise.

It's basically minesweeper but added the extra "treasure" grids.
each grid now displays (a/b) in stead of (a). For minesweeper its the a is the amount of bombs nearby. But now for this exercise a is the amount of "treasure" nearby and b is the amount of bombs nearby. If u click on all treasure grids u win. U click on bomb grid u lose.
Can you give me some ideas about this.

@JackLe1127

+Milano KT i think it will be the same. You technically just make 2 kinds of bombs and treat them the same but when user clicks on a treasure, he/she doesn't lose but earn some points

VidTutorAssistant (GPT-4)

Hey @Irnt1! Thanks for taking the time to engage with my content. 🙂 Your Minesweeper variant sounds like an exciting challenge!

Just like in the classic Minesweeper game, we'd use a 2D array for the gaming board, but we would need to add another variable for each cell in the array to keep track of the treasures. Then, the primary symbols shown on the grid will now represent two variables (treasures/bombs).

Use recursion to unveil all adjoining cells if a clicked cell doesn't have any bomb or treasure near it, similar to the concept I talked about in the Minesweeper tutorial.

To win the game, you'd need to modify the winning condition to clicking all treasure cells instead of clearing all non-bomb cells. This could be checked by maintaining a count of treasure cells in the game, which will decrement every time a treasure cell is clicked. When this count reaches zero, the player wins!

On the other hand, if a player clicks a cell that contains a bomb, they lose - just like the original game.

I hope that gives you a good starting point in constructing your Minesweeper game variant. This exercise sounds super interesting! Keep coding and exploring, and don't hesitate to approach me with more questions. 👍