def new_init(self):
     self.game_finished_timestamp = None
     game_state = GameState.get_default_with_field(3, 3)
     self.game = TicTacToeGame(game_state,
                               TicTacToeDefaultWinnerCheckStrategy(),
                               self.game_changed_callback)
     self.user_cursor_controller.cursor_position = Coordinate(1, 1)
def init_coords(file_name, ilins):
    file = open(file_name, "r", encoding="UTF-8")

    for i, line in enumerate(file, 1):
        if i in ilins:
            ilin, lat, lon = line.split()

            Coordinate(int(ilin), float(lat), float(lon))

    file.close()
 def get_board_hash(self):
     occupations = []
     for i in range(self.height):
         for j in range(self.width):
             cell = self.get_cell(Coordinate(i, j))
             if cell == CellOccupation.X:
                 occupations.append('X')
             if cell == CellOccupation.O:
                 occupations.append('O')
             if cell == CellOccupation.FREE:
                 occupations.append('-')
     return ''.join(occupations)
Exemplo n.º 4
0
 def set_Path_configure_all(self, path):
     self.path = str(os.getcwd()) + "/files/" + path if path != None else None  # O comando os.getcwd pega o diretório atual de onde o arquivo python está.
     try:
         self.file = xlrd.open_workbook(self.path,
                                        formatting_info=True)  # Abre o arquivo com o nome enviado no parâmetro diretorio
     except:
         self.file = xlrd.open_workbook(self.path)  # Abre o arquivo com o nome enviado no parâmetro diretorio
     self.write_file = copy(self.file)
     xlwt.add_palette_colour("custom_colour", 0x21)
     self.sheet_list = self.file.sheet_names()  # Pega o nome das páginas do arquivo
     self.sheet = self.file.sheet_by_index(0)  # Pega a página inicial (começa por 0)
     self.formated_sheet = self.write_file.get_sheet(0)
     # Aqui já vão ser atribuídas no decorrer do processamento.
     self.columns_total = self.sheet.ncols
     self.row_total = self.sheet.nrows
     self.coordinate = Coordinate(self.sheet)
     self.data_treatment = Data_Treatment(self.sheet)
     self.locality = Locality(self.sheet)
 def input_arrow_up(self):
     new_position = Coordinate(self.cursor_position.x,
                               self.cursor_position.y - 1)
     if self.__validate_cursor_position(new_position):
         self.cursor_position = new_position
 def __init__(self, state):
     self.cursor_position = Coordinate(1, 1)
     self.bottom_limit = state.size_y
     self.right_limit = state.size_x
 def input_arrow_left(self):
     new_position = Coordinate(self.cursor_position.x - 1,
                               self.cursor_position.y)
     if self.__validate_cursor_position(new_position):
         self.cursor_position = new_position