A Library to make simple minesweeper games using OOP
Project description
Minesweeper
This is a library to make simple minesweeper games using OOP
Example Usage:
from Minesweeper import Board # Import the Board object from the library
b = Board(5, 5) # Create the Board instance
b.place_mines(5) # Place 5 mines on our 5x5 board
while True: # Loop forever
inp = input("Enter row, column: ") # Take input
f_or_r = inp[0] # Check if user wants to flag or reveal
row = int(inp[1:].split()[0]) # Get the row from the input
col = int(inp[1:].split()[1]) # Get the column from the input
if f_or_r == "f": # If input is to flag
b.flag(row, col) # Use flag() to flag the cell
print(b.visualize()) # Use visualize() to get a string of the updated board
elif f_or_r == "r": # If the input is to reveal
b.reveal(row, col) # Use reveal() to reveal the value of the cell
print(b.visualize()) # Use visualize() to get a string of the updated board
Made by: Ousama Alhennawi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SweeperPy-0.0.1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for SweeperPy-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef0af26ca426b6d3074e0b968fb7c1dcfb6b8fa7b2491fa4286211febc88b15 |
|
MD5 | a7d636b1f96d21181126cbb5a031790d |
|
BLAKE2b-256 | bba0de05a63879263bf322c4478368f581658062ea97a87a38f5ee6a104ba4c2 |