diff --git a/main.py b/main.py index cd0d288..fff6320 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,7 @@ from src.agents.heuristic import ( utility ) +from src.agents.geneticAlgAgent import GeneticAgent, train_genetic_algorithm from src.agents.heuristic_trainer import train from src.agents.geneticAlgAgentJon import GeneticAlgAgentJM @@ -37,6 +38,7 @@ def test(): # print(utility(boards, 0, -1, 0, 0, 0)) # boards.printBoard() +<<<<<<< HEAD <<<<<<< HEAD # board = Tetris() # manager = TetrisGameManager(board) @@ -61,10 +63,16 @@ def test(): >>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced) ======= +======= +>>>>>>> fa9eeb924767729763e18a070d98dd0646936c29 board = Tetris() # manager = TetrisGameManager(board) # agent = create_agent("heuristic") agents = train_genetic_algorithm(10) +<<<<<<< HEAD # manager.startDemo(agent) >>>>>>> fa9eeb9 (Co-authored-by: HÃ¥vard Fossdal ) +======= + # manager.startDemo(agent) +>>>>>>> fa9eeb924767729763e18a070d98dd0646936c29 diff --git a/src/agents/agent.py b/src/agents/agent.py index b4e0a68..010fa13 100644 --- a/src/agents/agent.py +++ b/src/agents/agent.py @@ -48,6 +48,7 @@ def play_game(agent: Agent, board: Tetris, actions_per_drop: int = 1, max_pieces The final state of the board after the game is over. """ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD #count = 0 @@ -60,6 +61,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: >>>>>>> c14418b (feat: :rocket: genetic agent class and it's training algorithm commenced) +======= + pieces_dropped = 0 + while not board.isGameOver() and pieces_dropped < max_pieces_dropped: +>>>>>>> fa9eeb924767729763e18a070d98dd0646936c29 # 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 caadfb3..e95d69f 100644 --- a/src/agents/heuristic.py +++ b/src/agents/heuristic.py @@ -81,12 +81,16 @@ def max_height(gameState: Tetris) -> int: return max(checkedList) +<<<<<<< HEAD <<<<<<< 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) +======= +def lines_cleared(gameState: Tetris) -> int: +>>>>>>> fa9eeb924767729763e18a070d98dd0646936c29 """Retrurns the number of lines cleared.""" sum = 0 for row in gameState.board: