Advertisement
Null_Cat

The Minesweeper Projects

Apr 13th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Board Generation:

Board Generation is simple:

  • Create an array. This will be the whole board.
  • Create more arrays inside the initial array. The amount of arrays will correspond to height I believe.
  • Start to put Spaces/Mines in the board.
    • Each Space/Mine on the board will go into the smaller arrays.
    • There will be a "width" amount of Spaces/Mines in each array.
    • Mines are set by RNG (1-10/15, where 1 = Mine, = 6%-10% of a mine in each space).
  • If the amount of mines placed last step was less than the amount of mines needed, then go through the board again.
    • If the Mine Count needed is more than spaces on the board, it will create an infinite loop, so make sure there's a check for that.
  • After the mines have been placed, place down the numbers.
  • Finished!

Board Generation but it's better in every way:

If you want to see the better board generation, then go see the Roblox Lua edition below.
This type of Board Generation makes it so that the player ALWAYS starts on a Zero space, with no mines around.

  • Create the Array(s). Similar to normal board generation.
    • Don't place the mines until later.
  • Wait until the player picks the first space.
  • Once the player picks the first spot, then mark it.
    • This spot and the surrounding spots will be excluded from the generation.
    • You could also mark the other spots around the first spot, and exclude all marked spots.
  • Generate the board like normal, but don't allow any mines to generate on the first spot and around it.

Creating lots of Minesweeper.

This is part of a small project to see how many languages I can make Minesweeper in.
It also helps me learn which languages I want to stick with, and what I want to not work with.
This is a list of what I plan to use, or what I've already done.

Created + Link

Working on

Deciding

  • Lua (OpenComputers [how the hecc do i use this])
  • Python (Pygame)
  • Java (Unknown)
  • JavaScript (Webpage)
  • C++ (Unknown)

i tried

  • LOLCODE - Reason: No RNG system available.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement