@@ -374,24 +374,24 @@ def __init__(self, name):
374
374
@staticmethod
375
375
def add_rt_var (v , value = None , opt = None ):
376
376
if v not in Root .RT_VAR :
377
- Root .RT_VAR [v ] = set ()
377
+ Root .RT_VAR [v ] = []
378
378
if value is None and opt is None :
379
- Root .RT_VAR [v ].add (True )
380
- Root .RT_VAR [v ].add (False )
379
+ Root .RT_VAR [v ].append (True )
380
+ Root .RT_VAR [v ].append (False )
381
381
try :
382
382
value = float (value )
383
383
if opt in (Compare .largeEqual , Compare .small ):
384
- Root .RT_VAR [v ].add (value - 0.0001 )
384
+ Root .RT_VAR [v ].append (value - 0.0001 )
385
385
elif opt in (Compare .smallEqual , Compare .large ):
386
- Root .RT_VAR [v ].add (value + 0.0001 )
386
+ Root .RT_VAR [v ].append (value + 0.0001 )
387
387
elif opt in (Compare .repudiation , Compare .equal ):
388
388
if value == 0 :
389
- Root .RT_VAR [v ].add (1 )
389
+ Root .RT_VAR [v ].append (1 )
390
390
else :
391
- Root .RT_VAR [v ].add (- value )
391
+ Root .RT_VAR [v ].append (- value )
392
392
except (TypeError , ValueError ):
393
393
pass
394
- Root .RT_VAR [v ].add (value )
394
+ Root .RT_VAR [v ].append (value )
395
395
396
396
def add_child (self , child ):
397
397
self .children .append (child )
@@ -415,18 +415,8 @@ def py_str(self, enemy_actions=None):
415
415
416
416
rt_var_str = []
417
417
for name , values in sorted (Root .RT_VAR .items ()):
418
- # converted_values = set()
419
- # for v in values:
420
- # try:
421
- # float(v)
422
- # converted_values.add(str(v))
423
- # except ValueError:
424
- # converted_values.add(f"partial(getattr, self, {v!r})")
425
- try :
426
- values = tuple (sorted (values ))
427
- except TypeError :
428
- values = tuple (values )
429
- rt_var_str .append (Root .RT_PATTERN .format (name = s (name , prefix = "" ), values = values ))
418
+ # ensure ordering
419
+ rt_var_str .append (Root .RT_PATTERN .format (name = s (name , prefix = "" ), values = tuple ({v : None for v in values }.keys ())))
430
420
rt_var_str = "\n " .join (rt_var_str )
431
421
# rt_list_str = "" if not rt_var_str else f" RUNTIME_VARS = {tuple(Root.RT_VAR.keys())}\n"
432
422
0 commit comments