Browse Source

placement mode parameter

Bastien Sevajol 6 years ago
parent
commit
b28e436878
2 changed files with 11 additions and 1 deletions
  1. 1 0
      opencombat/simulation/behaviour.py
  2. 10 1
      run.py

+ 1 - 0
opencombat/simulation/behaviour.py View File

106
         }
106
         }
107
 
107
 
108
 
108
 
109
+@disable_when(config_value('_runtime.placement_mode'))
109
 class EngageOpponent(AliveSubjectBehaviour):
110
 class EngageOpponent(AliveSubjectBehaviour):
110
     visible_mechanism = OpponentVisibleMechanism
111
     visible_mechanism = OpponentVisibleMechanism
111
     use = [visible_mechanism]
112
     use = [visible_mechanism]

+ 10 - 1
run.py View File

21
     seed_value: int=None,
21
     seed_value: int=None,
22
     state_file_path: str=None,
22
     state_file_path: str=None,
23
     state_save_dir: str='.',
23
     state_save_dir: str='.',
24
+    placement_mode: bool = False,
24
 ):
25
 ):
25
     if seed_value is not None:
26
     if seed_value is not None:
26
         seed(seed_value)
27
         seed(seed_value)
29
     config.load_yaml('config.yaml')
30
     config.load_yaml('config.yaml')
30
 
31
 
31
     # Runtime config
32
     # Runtime config
32
-    config.setdefault('_runtime', {})['state_save_dir'] = state_save_dir
33
+    config['_runtime'] = {}
34
+    config['_runtime']['state_save_dir'] = state_save_dir
35
+    config['_runtime']['placement_mode'] = placement_mode
33
 
36
 
34
     level = logging.getLevelName(config.resolve('global.logging_level', 'ERROR'))
37
     level = logging.getLevelName(config.resolve('global.logging_level', 'ERROR'))
35
     logger = get_default_logger(level=level)
38
     logger = get_default_logger(level=level)
76
         dest='state_save_dir',
79
         dest='state_save_dir',
77
         default='.',
80
         default='.',
78
     )
81
     )
82
+    parser.add_argument(
83
+        '--placement-mode',
84
+        dest='placement_mode',
85
+        action='store_true',
86
+    )
79
 
87
 
80
     args = parser.parse_args()
88
     args = parser.parse_args()
81
 
89
 
84
         seed_value=args.seed,
92
         seed_value=args.seed,
85
         state_file_path=args.state,
93
         state_file_path=args.state,
86
         state_save_dir=args.state_save_dir,
94
         state_save_dir=args.state_save_dir,
95
+        placement_mode=args.placement_mode,
87
     )
96
     )