[Pachi] wfm GTP: 2 queries

jonathan chetwynd j.chetwynd at btconnect.com
Fri Jun 3 15:56:51 CEST 2011


wfm gtp.c

output is now JSON only, at least for basic moves

~:"

again maybe not the best hack...
would like to move to GIT, but had great difficulty understanding cz process

void
gtp_prefix(char prefix, int id)
{
	return;
	/*
	if (id == NO_REPLY) return;
	if (id >= 0)
		printf("%c%d ", prefix, id);
	else
		printf("%c ", prefix);
	 */
}

void
gtp_flush(void)
{
	putchar('\n');
	fflush(stdout);
}

void
gtp_output(char prefix, int id, va_list params)
{
	return;
	/*
	if (id == NO_REPLY) return;
	gtp_prefix(prefix, id);
	char *s;
	while ((s = va_arg(params, char *))) {
		fputs(s, stdout);
	}
	putchar('\n');
	gtp_flush();
	 */
}

  	
Jonathan Chetwynd

j.chetwynd at btconnect.com
http://www.peepo.com/

+44 (0) 20 7978 1764


On 3 Jun 2011, at 13:34, jonathan chetwynd wrote:

> wfm debug.h
> 
> would prefer to understand a little more,
> 
> all left is to remove GTP response such as 
> = E6
> 
> then JSON only, with \n or newlines...
> later of course debug could also be JSON...
> 
> ~:"
> 
> edit out debug option ((
> 
> /*
> #ifdef DEBUG
> #define DEBUGL_(l, n) (unlikely((l) > (n)))
> #define DEBUG_MODE (true)
> #else
> */
> 
> #define DEBUGL_(l, n) (false)
> #define DEBUG_MODE (false)
> 
> /*
> #endif
> */
> 
> 
> 
>  	
> Jonathan Chetwynd
> 
> j.chetwynd at btconnect.com
> http://www.peepo.com/
> 
> +44 (0) 20 7978 1764
> 
> 
> On 2 Jun 2011, at 12:57, jonathan chetwynd wrote:
> 
>> 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
>> 
>> _______________________________________________
>> Pachi mailing list
>> Pachi at v.or.cz
>> http://rover.ms.mff.cuni.cz/mailman/listinfo/pachi
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rover.ms.mff.cuni.cz/pipermail/pachi/attachments/20110603/1f99fe53/attachment-0001.html>


More information about the Pachi mailing list