Skip to main content

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


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)

Uploaded Source

Built Distribution

SweeperPy-0.0.1-py3-none-any.whl (7.1 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