Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Python Minesweeper

Name: Anonymous 2008-11-16 17:37

I have a programming project due tomorrow at midnight and I am supposed to make a minesweeper game using a class.
The game board is 5X5 and should have 5 mines randomly placed on the grid. Basically there will be two grids(one that holds the data for mines and how many mines are near each space, and another that is the players view)which should just be a list of lists. The player view grid should start out showing an 'H' in each spot till they are removed by player input.
Example below

Actual Grid  Player View
0 1 1 1 1     H H 1 0 1
1 M 1 2 M     1 H 1 0 H
3 3 2 2 M     H H 2 0 H
M M 1 1 1     H H 1 0 1
2 2 1 0 0     H H 1 0 0


Also, if the player should choose a spot that contains a 0(there are no mines in its neighborhood) the program should also reveal all the other adjacent 0's if any.

Please, any help is greatly appreciated

Name: Anonymous 2008-11-16 17:42

Do your own homework.

Name: Anonymous 2008-11-16 17:45

GO BACK TO /pr/ AND ENJOY YOUR SICP ALONG WITH YOUR NO EXCEPTIONS.

WABTE

Name: Anonymous 2008-11-16 17:56

I made a skeleton to work off but i don't even know if it is right

class sweep:

    def __init__()

    def setup(self):
        '''creates the playing field a 5X5 field as a list of lists'''
       
    def place_mines(self):
        '''places 5 mines randomly in the list of lists'''

    def print_game(self):
        '''prints the player's view of the game'''

    def is_mine(self,tRow):
        '''checks if the player's input position is a mine'''
        '''returns a boolean'''

    def move(self,boo,tRow):
        ''' if the players move is not a mine, changes the player view to
            reveal the number behind the "H" '''

    def ripple(self,boo,tRow):
        '''if the players move reveals a blank space, ripple reveals all other
            adjacent blank spaces'''

Name: Anonymous 2008-11-16 17:57

So what's the problem? Just write the fucking thing.

Name: Anonymous 2008-11-16 18:04

Maybe you should have stared a week earlier.

Name: Anonymous 2008-11-16 18:05

I've been studying for the past 48 hours for a big Circuits exam for another class. once I'm done with that exam at 9am tomorrow, I'm getting right to work on this program, so any help to start would really help

Name: Anonymous 2008-11-16 18:14

>>7
USE THE FUCKING CODE TAGS YOU HAVE ANY GODFUCKINGDAMN IDEA HOW BATSHIT UGLY YOUR TABLE LOOKS IN A SHITTY PROPORTIONAL FONT

Name: Anonymous 2008-11-16 18:24

use a list in a list for an array.

array = [[0,0,0,0,0],
         [0,0,0,0,0],
         [0,0,0,0,0],
         [0,0,0,0,0],
         [0,0,0,0,0] ]

Name: Anonymous 2008-11-17 23:49

I remember this thread being on /code/. No one gave a fuck there either.

Name: Anonymous 2009-03-06 12:33

The man for me Asking for professional   assistance This is   clearly just your   way to say   than she and?

Don't change these.
Name: Email:
Entire Thread Thread List