示例#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;
示例#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
示例#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("uncoverint Loction(2,2):")
gameio.displayBoard(mineBoard, statusBoard);

if game.checkEnd(mineBoard, statusBoard)==0:
	print("it is the end of game!")
else:
	print("it is not the end of game.")
示例#4
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("uncoverint Loction(2,2):")
gameio.displayBoard(mineBoard, statusBoard)

if game.checkEnd(mineBoard, statusBoard) == 0:
    print("it is the end of game!")
else:
    print("it is not the end of game.")