예제 #1
0
파일: Main.py 프로젝트: rkapdi/SENG265-1
def main():
    key = GameBoard.Board()
    board = GameBoard.Board(bombs=0)

    # GameBoard.printBoard(board)

    while (not gameWon(key, board)):
        GameBoard.printBoard(board)

        # get guess
        g = getGuess(key.gridSize)
        i = g[0]
        j = g[1]

        f = input("enter f to place a flag: ")
        if (f in 'fF'):
            flag(i, j, board)
        else:
            guess(i, j, board, key)

    print("NICE WORK")
    print("---------")
    GameBoard.printBoard(key)
예제 #2
0
# TicTacToe Neural Network
# Eduardo B <*****@*****.**>

import BackPropagation
import Player
import GameBoard
import GameRegister

#Crea una red neuronal de 9 entradas 9 salidas
neuralNetwork = BackPropagation.NN(9, 9, 9)
#prepara el tablero
board = GameBoard.Board()
#para el registro de movimientos
register = GameRegister.Register()

# Entrena a la red neuronal con las jugadas realizadas
def Learn():
    global neuralNetwork
    global register

    train = raw_input("\n Do I need to train more? (y/n): ")

    if train == "y":
        print "\n Training with %s movements madafaka..." % (register.Len())
        neuralNetwork.train(register.GetGame())

def Play():
    global neuralNetwork
    global register
    global board
예제 #3
0
 def __init__(self):
     self.board = GameBoard.Board(CheckerBoard.BOARD_SIZE,
                                  CheckerBoard.BOARD_SIZE)
     self.place_starting_pieces()
예제 #4
0
    def print_knowledge(self):
        for x in self.knowledge:
            x.print_sentence()


print('Enter height: ', end='')
height = int(input())
print('Enter width: ', end='')
width = int(input())
print('Enter number of mines: ', end='')
mineNumber = int(input())

pygame.init()
screen = pygame.display.set_mode([21 * width, 21 * height])

board = GameBoard.Board(height, width, mineNumber, screen)

running = True

while running:
    # Did the user click the window close button?

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == MOUSEBUTTONDOWN and event.button == BUTTON_LEFT:
            mouse_x, mouse_y = event.pos  # Now it will have the coordinates of click point.
            board.clear_cell(int(mouse_y / 21), int(mouse_x / 21))
            board_knowledge = Knowledge(board)
            board_knowledge.refine_knowledge()
        if board.game_state == 1 or board.game_state == 0: