def __init__(self, height = 9, width = 9, rewards = None, winscore = 100, red_player = None, blue_player = None, ai_delay = 60 ): ## initialise pygame pygame.init() pygame.font.init() ## board self.board = ConnectFourBoard.EmptyBoard(height, width, rewards, winscore) ## interface self.selected_index = -1 self.display = ConnectFourGraphics.setup_display(self.board) ### PLAYER SETTINGS ### self.red_player = red_player self.blue_player = blue_player self.ai_delay = ai_delay self.time_cumulative = {ConnectFourBoard.RED : 0, ConnectFourBoard.BLUE : 0} ## state of the game (scoreboard, who's turn it is, etc.) self.score_red = 0 self.score_blue = 0 self.winner = 0 self.game_running = True self.red_turn = True ## draw initial board self.draw()
def __init__(self, height=9, width=9, rewards=None, red_player=None, blue_player=None, ai_delay=60, winscore=1000): self.field_state = [[0, 0, 0, 0, 0, 0], [1, 2, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0], [2, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]] self.col_heights = [0, 4, 1, 2, 1, 0, 0] ## initialise pygame pygame.init() pygame.font.init() ## board self.board = ConnectFourBoard.EmptyBoard(height, width, rewards, winscore) ## interface self.selected_index = -1 self.display = \ ConnectFourGraphics.setup_display(self.board) ### PLAYER SETTINGS ### self.red_player = red_player self.blue_player = blue_player self.ai_delay = ai_delay ## state of the game (scoreboard, who's turn it is, etc.) self.score_red = 0 self.score_blue = 0 self.winner = 0 self.score_win = 1000 self.game_running = True self.red_turn = True ## draw initial board self.draw()