minor refactors
This commit is contained in:
parent
ad5864c7f8
commit
853eddcadd
4
game.py
4
game.py
@ -3,11 +3,11 @@ from random import randint
|
|||||||
import project_constants as const
|
import project_constants as const
|
||||||
|
|
||||||
from display_assets import blit_graphics
|
from display_assets import blit_graphics
|
||||||
from searching_algorithms import a_star
|
from algorithms.searching_algorithms import a_star
|
||||||
|
|
||||||
from minefield import Minefield
|
from minefield import Minefield
|
||||||
|
|
||||||
from mine_models.time_mine import TimeMine
|
from mines.mine_models.time_mine import TimeMine
|
||||||
|
|
||||||
from ui.ui_components_manager import UiComponentsManager
|
from ui.ui_components_manager import UiComponentsManager
|
||||||
from ui.text_box import TextBox
|
from ui.text_box import TextBox
|
||||||
|
@ -50,25 +50,24 @@ class SpecificityHash(Enum):
|
|||||||
FRAGMENTATION_MINE = 0
|
FRAGMENTATION_MINE = 0
|
||||||
|
|
||||||
|
|
||||||
# ASSUMING ALL ENUMS' MEMBERS ARE IN DESCENDING ORDER
|
MAX_VALUE = max([elem.value for elem in TypeHash]) \
|
||||||
MAX_VALUE = list(TypeHash)[0].value \
|
+ max([elem.value for elem in DangerClassHash]) \
|
||||||
+ list(DangerClassHash)[0].value \
|
+ max([elem.value for elem in SeriesHash]) \
|
||||||
+ list(SeriesHash)[0].value \
|
+ max([elem.value for elem in IndicatorHash]) \
|
||||||
+ list(IndicatorHash)[0].value \
|
+ max([elem.value for elem in SpecificityHash])
|
||||||
+ list(SpecificityHash)[0].value
|
|
||||||
|
|
||||||
|
|
||||||
def _get_wire_color(hash_sum):
|
def _get_wire_color(hash_sum):
|
||||||
if hash_sum < 0.4 * MAX_VALUE:
|
if hash_sum < 0.4 * MAX_VALUE:
|
||||||
return Wire.BLUE
|
return Wire.BLUE
|
||||||
elif 0.4 * MAX_VALUE < hash_sum <= 0.6 * MAX_VALUE:
|
elif hash_sum <= 0.6 * MAX_VALUE:
|
||||||
return Wire.GREEN
|
return Wire.GREEN
|
||||||
else:
|
else:
|
||||||
return Wire.RED
|
return Wire.RED
|
||||||
|
|
||||||
|
|
||||||
# STRING ARGUMENTS
|
# STRING ARGUMENTS
|
||||||
def get_correct_wire_str(mine_type: str, danger_cls: str, series: str, indicator: str, specificity: str):
|
def get_wire_from_str(mine_type: str, danger_cls: str, series: str, indicator: str, specificity: str):
|
||||||
|
|
||||||
type_hash = TypeHash[mine_type.upper()].value
|
type_hash = TypeHash[mine_type.upper()].value
|
||||||
danger_cls_hash = DangerClassHash[danger_cls.upper()].value
|
danger_cls_hash = DangerClassHash[danger_cls.upper()].value
|
||||||
@ -81,7 +80,7 @@ def get_correct_wire_str(mine_type: str, danger_cls: str, series: str, indicator
|
|||||||
|
|
||||||
|
|
||||||
# ENUM ARGUMENTS
|
# ENUM ARGUMENTS
|
||||||
def get_correct_wire_enums(
|
def get_wire_from_enums(
|
||||||
mine_type: TypeHash,
|
mine_type: TypeHash,
|
||||||
danger_cls: DangerClassHash,
|
danger_cls: DangerClassHash,
|
||||||
series: SeriesHash,
|
series: SeriesHash,
|
||||||
|
@ -11,6 +11,8 @@ class ChainedMine(Mine):
|
|||||||
super().__init__(position, active)
|
super().__init__(position, active)
|
||||||
|
|
||||||
def disarm(self):
|
def disarm(self):
|
||||||
if (self.predecessor.active == False):
|
if self.predecessor is None or not self.predecessor.active:
|
||||||
super().disarm()
|
super().disarm()
|
||||||
pass
|
else:
|
||||||
|
# boom?
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user