Beispiel #1
0
def launch(y,x,b):
    """
    launch a minesweeper game with a graphical board
    :param y: width of the game
    :type y: int
    :param x: height of the game
    :type x: int
    :param b: number of bombs
    :type b: int
    """
    game = ms.make_game(y,x,b)
    graphic.create(game)
Beispiel #2
0
def main():
    """
    main function for graphical minesweeper game
    """
    if len(sys.argv) == 4:
        width = int(sys.argv[1])
        height = int(sys.argv[2])
        nbombs = int(sys.argv[3])
    else:
        width = 20
        height = 10
        nbombs = 1
    game = Minesweeper(width, height, nbombs)
    graphicalboard.create(game)
Beispiel #3
0
def main():
    """
    main function for graphical minesweeper game
    """
    # Takes the argument from the console.
    if len(sys.argv) == 4:
        width = int(sys.argv[1])
        height = int(sys.argv[2])
        nbombs = int(sys.argv[3])
    else:
        width = 20
        height = 20
        nbombs = int(0.2*(width*height))
    game = Minesweeper(width, height, nbombs)
    graphicalboard.create(game)
Beispiel #4
0
def main():
    """
    main function for graphical minesweeper game

    :return: none
    :UC: None
    """
    if len(sys.argv) == 4:
        width = int(sys.argv[1])
        height = int(sys.argv[2])
        nbombs = int(sys.argv[3])
    else:
        width = 8
        height = 8
        nbombs = 5
    game = Minesweeper(width, height, nbombs)
    graphicalboard.create(game)
Beispiel #5
0
import sys
import minesweeper as mines
import graphicalboard as graph

if __name__ == "__main__":
	assert len(sys.argv)==4, "Give me more arguments, please."
	assert (int(sys.argv[1])>0 and int(sys.argv[2])>0 and int(sys.argv[3])>0), "All these arguments should be positive."
	graph.create(mines.make_game(int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])))
Beispiel #6
0
"""
:mod:`minesweeper` module : 

:author: `DECOTTIGNIES Cyril et MORLET Kevin`

:date: 2015, october
"""
import minesweeper as m
import graphicalboard as g
import sys

def usage ():
    print ('Usage : {:s} width height number_of_bombs'.format(sys.argv[0]))
    print ('with width the width of the minesweeper grid  ')
    print ('with height the height of the minesweeper grid ')
    print ('with number_of_bombs the number of bombs on the grid ')
    exit (1)

if len (sys.argv) ==0 :
     game=m.make_game()
     g.create(game)
elif len (sys.argv) == 4:
    width=int(sys.argv[1])
    height=int(sys.argv[2])
    nb_bombs=int(sys.argv[3])
    game=m.make_game(width,height,nb_bombs)
    g.create(game)
else :
    usage ()