[Pachi] 2 queries

jonathan chetwynd j.chetwynd at btconnect.com
Thu Jun 2 13:57:12 CEST 2011


How to switch debug so that the only output is JSON? [1]

How to insert comma in all but last foreach loop? [2] 

best

Jonathan

[1] ie remove:

tree pruned in 0.242646 s, prev 0 s ago, dest depth 16 wanted 4, size 204597008->99756184/295279001, playouts 38867
playing move F6
Move:   1  Komi: 0.0  Handicap: 0  Captures B: 0 W: 0
      A B C D E F G H J        A B C D E F G H J  
    +-------------------+    +-------------------+
  9 | . . . . . . . . . |  9 | , , , , , , , , , |
  8 | . . . . . . . . . |  8 | , , , , x , , , , |
  7 | . . . . . . . . . |  7 | , , , , x x , , , |
  6 | . . . . . X). . . |  6 | , , , , , x , , , |
  5 | . . . . . . . . . |  5 | , , , , , , , , , |
  4 | . . . . . . . . . |  4 | , , , , , , , , , |
  3 | . . . . . . . . . |  3 | , , , , , , , , , |
  2 | . . . . . . . . . |  2 | , , , , , , , , , |
  1 | . . . . . . . . . |  1 | , , , , , , , , , |
    +-------------------+    +-------------------+

= F6

[2]

		foreach_point(t->board) {
			if (board_at(t->board, c) != S_NONE) continue;
			floating_t rate = (floating_t) u->ownermap.map[c][S_BLACK] / u->ownermap.playouts;
 			fprintf(stderr, "%.0f", 1000*rate); 
			fprintf(stderr, "%s", 1 ? "," : ""); /* Please edit to prevent comma on last iteration */
		} foreach_point_end;

advice I found is not to use foreach, particulary in this use-case



More information about the Pachi mailing list