adjust image loading to new structure

This commit is contained in:
matixezor 2021-06-01 22:50:04 +02:00
parent 5469278f88
commit e148f98bc7

View File

@ -16,49 +16,41 @@ HEIGHT = 800
IMAGES = [] IMAGES = []
for name, val in { for name, val in {
'grass_01': 0, 'grass': 0,
'grass_02': 1, 'dry ground': 1,
'dry ground_01': 2, 'concrete': 2,
'concrete_01': 3,
'concrete_02': 4,
'grass_01_rock': 0,
'grass_02_rock': 1,
'grass_01_mineAT_01': 0,
'grass_01_mineAP_02': 0,
'grass_01_mineAP_03': 0,
'grass_01_mineAT_04': 0,
'grass_01_mineADM': 0,
'grass_02_mineAT_01': 1,
'grass_02_mineAP_02': 1,
'grass_02_mineAP_03': 1,
'grass_02_mineADM': 1,
'mud_01': 0, 'mud_01': 0,
'mud_02': 1, 'mud_02': 1,
'dry ground_01_mineADM': 2, 'grass_mineAT_01': 0,
'dry ground_01_mineAP_02': 2, 'grass_mineAP_02': 0,
'dry ground_01_mineAP_03': 2, 'grass_mineAP_03': 0,
'dry ground_01_mineAT_01': 2, 'grass_mineAT_04': 0,
'dry ground_01_mineAT_04': 2, 'grass_mineADM': 0,
'dry ground_01_rock_01': 2, 'dry ground_mineADM': 1,
'dry ground_01_rock_02': 2, 'dry ground_mineAP_02': 1,
'concrete_01_mineAT_01': 3, 'dry ground_mineAP_03': 1,
'concrete_01_mineAP_02': 3, 'dry ground_mineAT_01': 1,
'concrete_01_mineAP_03': 3, 'dry ground_mineAT_04': 1,
'concrete_01_mineAT_04': 3, 'concrete_mineAT_01': 2,
'concrete_01_mineADM': 3, 'concrete_mineAP_02': 2,
'concrete_02_mineAT_01': 4, 'concrete_mineAP_03': 2,
'concrete_02_mineAP_02': 4, 'concrete_mineAT_04': 2,
'concrete_02_mineAP_03': 4, 'concrete_mineADM': 2,
'concrete_02_mineADM': 4, 'concrete_rock_01': 2,
'concrete_rock_02': 2,
'grass_rock_01': 0,
'grass_rock_02': 0,
'dry ground_rock_01': 1,
'dry ground_rock_02': 1,
}.items(): }.items():
folder_name = name.split('_')[0] folder_name = name.split('_')[0]
path = f'{main_path}/images/Tiles/{folder_name} Tiles'
IMAGES.append( IMAGES.append(
Image( Image(
val, val,
name, name,
pg.image.load( f'{path}/big/{name}.png',
f'{main_path}/images/Tiles/{folder_name} Tiles/{name}.png' pg.image.load(f'{path}/small/{name}.png'),
),
None if 'mine' not in name else ( None if 'mine' not in name else (
'AP' if 'AP' in name else ( 'AP' if 'AP' in name else (
'AT' if 'AT' in name else 'ADM' 'AT' if 'AT' in name else 'ADM'
@ -91,7 +83,7 @@ for name in [
f'{main_path}/images/agent/agent_kaboom/{name}.png' f'{main_path}/images/agent/agent_kaboom/{name}.png'
)) ))
ROCK_INDEXES = (5, 6, 23, 24) ROCK_INDEXES = ( 20, 21, 22, 23, 24, 25)
try: try:
with open(f'{main_path}/src/machine_learning/decision_tree/decision_tree.pkl', 'rb') as file: with open(f'{main_path}/src/machine_learning/decision_tree/decision_tree.pkl', 'rb') as file: