Skip to main content

A Python 3 minesweeper generator module

Project description

The minesweeperPy module for Python 3
=====================================

#### Made by Steven Shrewsbury Dev. (AKA: stshrewsburyDev)


Screenshots:
------------

![RawTerminalUsage](https://stshrewsburydev.github.io/official_site/API/ProjectScreenshots/minesweeperPy/minesweeperPy0001.png "Raw terminal usage")

ChangeLogs:
-----------

Version 1.2

* Added ``GridInfo()`` function

Installation:
-------------

###### Install with pip:

```
pip install minesweeperPy
```

###### Install from source:

```
python setup.py install
```

Using in your code:
-------------------

###### Import the module:

```py
import minesweeperPy
```

###### Make a new grid generation setting:

```py
columns = 12 # This will be the amount of columns in the grid (Must be 5+)
rows = 12 # This will be the amount of rows in the grid (Must be 5+)

MyNewGridGeneration = minesweeperPy.MineGen(columns, rows)
```

The number of cells in the grid is calculated by multiplying the column count by the row count:

| Columns | Rows | Cells |
|:-------:|:----:|:-----:|
| 10 | 10 | 100 |
| 25 | 20 | 500 |
| 48 | 50 | 2400 |

###### Generate a new grid:

```py
NumberOfMines = 25 # This will be the number of mines in the grid
#(Must be 1+ and not be more than the maximum space on the Grid generation
# (For example a 10x12 grid would have a maximum of 120 cells))

MyNewMinesweeperGrid = MyNewGridGeneration.GenerateGrid(NumberOfMines)
```

###### Output grid:

```py
>>>print(MyNewMinesweeperGrid)
[["M","1"," "," "," "],
["1","2","1","1"," "],
[" ","1","M","2","1"],
["1","2","3","M","1"],
["1","M","2","1","1"]]

>>>for row in MyNewMinesweeperGrid:
... print(row)
...
["M","1"," "," "," "]
["1","2","1","1"," "]
[" ","1","M","2","1"]
["1","2","3","M","1"]
["1","M","2","1","1"]

>>>
```

###### Get grid information:

```py
>>>minesweeperPy.GridInfo(MyNewMinesweeperGrid)
{
'GridColumns': 5,
'GridRows': 5,
'MineCount': 4,
'NonMineCells': 21,
'EmptyCells': 5,
'NumberedCells': 16
}

>>>
```

###### Links:

* [GitHub repository page](https://github.com/stshrewsburyDev/minesweeperPy)
* [The stshrewsburyDev official site](https://stshrewsburydev.github.io/official_site/)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minesweeperPy-1.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

minesweeperPy-1.2-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page