Browse Source

Update output and dirvar score calculation

Yann Weber 6 years ago
parent
commit
8b92e8d329
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      gte/world.py

+ 5
- 2
gte/world.py View File

@@ -15,6 +15,7 @@ def eval_prog(args):
15 15
     ''' @brief Return an array of fractdim
16 16
         @param args : dirty argparser returned arguments
17 17
     '''
18
+    startall = time.time()
18 19
     generation, progid, prog, trynum, args = args
19 20
     w = World(args.world_height, args.world_width, gray=True)
20 21
     logger.debug('Running P%d run#%d %s' % (progid, trynum, prog))
@@ -38,9 +39,10 @@ def eval_prog(args):
38 39
     sinfo = {'F':score_fract, 'D':score_dir}
39 40
     #score = sum([score_fract] + [score_dir] * 4) / 5
40 41
     if not args.quiet:
41
-        msg = 'G%d P%d run#%d %d steps scores %.3f:(D:%.3f,F:%.3f) in %.2fs (%dus per step)\t%s'
42
+        tall = time.time() - startall
43
+        msg = 'G%d P%d R%d: %d steps scores %.3f:(D:%.3f,F:%.3f) in %.3fs (%dus per step)\t%s'
42 44
         msg %= (generation, progid, trynum, steps, score, score_dir,
43
-                score_fract, stop - start,
45
+                score_fract, tall,
44 46
                 ((stop - start)*1000000)//steps//len(turmits),
45 47
                 str(prog))
46 48
         logger.info(msg)
@@ -224,6 +226,7 @@ class LivingTurmit(Turmit):
224 226
                 pdvar = self._prev_dirvar
225 227
                 self._dirvar += abs(pdvar[0] - dy) + abs(pdvar[1] - dx)
226 228
             self._prev_dirvar = (dy, dx)
229
+            self._dirvar_res += 1
227 230
             
228 231
         self._steps += 1
229 232
 

Loading…
Cancel
Save