diff --git a/main.py b/main.py index 9877935..f907777 100644 --- a/main.py +++ b/main.py @@ -41,6 +41,7 @@ def test(): # # manager.startGame() +<<<<<<< HEAD # # train() @@ -52,3 +53,7 @@ def test(): # cProfile.run('main()', 'restats') +======= + #train() + +>>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced) diff --git a/src/agents/agent.py b/src/agents/agent.py index 88d6c5b..b4e0a68 100644 --- a/src/agents/agent.py +++ b/src/agents/agent.py @@ -47,6 +47,7 @@ def play_game(agent: Agent, board: Tetris, actions_per_drop: int = 1, max_pieces Returns: The final state of the board after the game is over. """ +<<<<<<< HEAD <<<<<<< HEAD #count = 0 @@ -55,6 +56,10 @@ def play_game(agent: Agent, board: Tetris, actions_per_drop: int = 1, max_pieces pieces_dropped = 0 while not board.isGameOver() and pieces_dropped < max_pieces_dropped: >>>>>>> b842fc6 (feat: :rocket: genetic agent class and it's training algorithm commenced) +======= + pieces_dropped = 0 + while not board.isGameOver() and pieces_dropped < max_pieces_dropped: +>>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced) # Get the result of the agent's action for _ in range(actions_per_drop): result = agent.result(board) diff --git a/src/agents/heuristic.py b/src/agents/heuristic.py index a328a51..caadfb3 100644 --- a/src/agents/heuristic.py +++ b/src/agents/heuristic.py @@ -81,8 +81,12 @@ def max_height(gameState: Tetris) -> int: return max(checkedList) +<<<<<<< HEAD # Does this work? row cleared in get_possible_boards?? def lines_cleaned(gameState: Tetris) -> int: +======= +def lines_cleared(gameState: Tetris) -> int: +>>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced) """Retrurns the number of lines cleared.""" sum = 0 for row in gameState.board: diff --git a/src/agents/heuristic_agent.py b/src/agents/heuristic_agent.py index 6ae948c..2778f0d 100644 --- a/src/agents/heuristic_agent.py +++ b/src/agents/heuristic_agent.py @@ -24,6 +24,16 @@ def result(self, board: Tetris) -> list[Action]: # Find the actions needed to transform the current board to the new board actions = [] +<<<<<<< HEAD actions = transition_model(board, best_board) return actions +======= + try: + actions = transition_model(board, best_board) + return actions + except: + return actions + + +>>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced)