Skip to content

Commit

Permalink
fix: 🚑 Rebase dev into the branch
Browse files Browse the repository at this point in the history
  • Loading branch information
oystkva committed Apr 29, 2024
2 parents 03789ff + fa9eeb9 commit 58652b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,6 +38,7 @@ def test():
# print(utility(boards, 0, -1, 0, 0, 0))
# boards.printBoard()

<<<<<<< HEAD
<<<<<<< HEAD
# board = Tetris()
# manager = TetrisGameManager(board)
Expand All @@ -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 <HFossdal@users.noreply.github.com>)
=======
# manager.startDemo(agent)
>>>>>>> fa9eeb924767729763e18a070d98dd0646936c29
5 changes: 5 additions & 0 deletions src/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/agents/heuristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 58652b9

Please sign in to comment.