final a_star adjustments

This commit is contained in:
s452645 2021-05-09 17:55:42 +02:00
parent 36258b11d0
commit 03b17f293f
2 changed files with 5 additions and 6 deletions

View File

@ -17,7 +17,7 @@ V_NAME_OF_WINDOW = "MineFusion TM"
DIR_ASSETS = os.path.join("resources", "assets") DIR_ASSETS = os.path.join("resources", "assets")
V_FPS = 60 V_FPS = 60
ACTION_INTERVAL = 0.5 # interval between two actions in seconds ACTION_INTERVAL = 0.75 # interval between two actions in seconds
V_TILE_SIZE = 60 V_TILE_SIZE = 60
V_GRID_VER_TILES = 10 # vertical (number of rows) V_GRID_VER_TILES = 10 # vertical (number of rows)
@ -71,9 +71,9 @@ class Coords(Enum):
class Terrain(Enum): class Terrain(Enum):
CONCRETE = 1 CONCRETE = 2
GRASS = 2 GRASS = 4
MUD = 4 MUD = 8
# =============== # # =============== #

View File

@ -31,13 +31,12 @@ def get_node_cost(node: Node, minefield: Minefield):
row = node.state.row row = node.state.row
column = node.state.column column = node.state.column
# Rotation Cost??
if node.action != Action.GO: if node.action != Action.GO:
return node.parent.cost + 1 return node.parent.cost + 1
# if Tile considered its mine in cost calculation, this code would be priettier # if Tile considered its mine in cost calculation, this code would be priettier
if minefield.matrix[row][column].mine is not None: if minefield.matrix[row][column].mine is not None:
return node.parent.cost + 10 return node.parent.cost + 100
else: else:
return node.parent.cost + minefield.matrix[row][column].cost.value return node.parent.cost + minefield.matrix[row][column].cost.value