Example #1
0
def move(mineBoard, statusBoard):
	if game.checkEnd(mineBoard, statusBoard) == 0:# is the end!
		return 2;
	else:
		row, col = input("Which square do you wish to uncover?\nEnter the row and colunm:").split();
		row = int(row);
		col = int(col);
		#print("row:%d,col=%d" %(row,col))
		re = game.uncoverLoc(mineBoard, statusBoard, row, col);
		if re ==0:
			displayBoard(mineBoard, statusBoard);
			return 0;
		elif re == 1:#is the mine	
			displayBoom(mineBoard,statusBoard, row, col);
			return 1;
Example #2
0
def move(mineBoard, statusBoard):
    if game.checkEnd(mineBoard, statusBoard) == 0:  # is the end!
        return 2
    else:
        row, col = input(
            "Which square do you wish to uncover?\nEnter the row and colunm:"
        ).split()
        row = int(row)
        col = int(col)
        #print("row:%d,col=%d" %(row,col))
        re = game.uncoverLoc(mineBoard, statusBoard, row, col)
        if re == 0:
            displayBoard(mineBoard, statusBoard)
            return 0
        elif re == 1:  #is the mine
            displayBoom(mineBoard, statusBoard, row, col)
            return 1
Example #3
0
#!/usr/bin/env python

import game
import gameio

r = 4 ;
l = 4;
boardsList =  game.allocBoard(r, l);
mineBoard = boardsList[0];
statusBoard =  boardsList[1];
mineBoard[0][0] = -1;
mineBoard[0][3] = -1;
print("initial board: ")
gameio.displayBoard(mineBoard, statusBoard);

game.uncoverLoc(mineBoard, statusBoard, 2, 2);
print("uncovering Loction(2,2):")
gameio.displayBoard(mineBoard, statusBoard);