Skip to content

Commit

Permalink
feat: implement utility-method
Browse files Browse the repository at this point in the history
  • Loading branch information
JonBergland committed Apr 15, 2024
1 parent 4fd4f04 commit 8cf7adf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/agents/heuristic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@


def utility(gameState: Tetris, aggregate_heights_weight: int, max_height_weight: int,
lines_cleared_weight: int) -> int:

lines_cleared_weight: int, bumpiness_weight: int, holes_weight: int) -> int:
"""Returns the utility of the given game state."""
pass
sum = 0

sum += aggregate_heights_weight * aggregate_heights(gameState)
sum += max_height_weight * max_height(gameState)
sum += lines_cleared_weight * lines_cleaned(gameState)
sum += bumpiness_weight * bumpiness(gameState)
sum += holes_weight * find_holes(gameState)

return sum


def aggregate_heights(gameState: Tetris) -> int:
Expand Down

0 comments on commit 8cf7adf

Please sign in to comment.