diff options
Diffstat (limited to '19.c')
| -rw-r--r-- | 19.c | 18 | 
1 files changed, 13 insertions, 5 deletions
| @@ -228,14 +228,22 @@ inventory_build_exhaustive(struct inventory * i, struct blueprint const * b, int  	++exhaustive_iter; -	// Try doing nothing else this round.  	best = *i; -	inventory_tick(&best); -//	fprintf(stderr, "%d: doing nothing\n", remaining); -	inventory_build_exhaustive(&best, b, remaining - 1); -  	test = *i; +	// If there are some robots we can't build yet, try doing nothing this round. +	if (i->ore.amount < b->max_ore +			|| i->clay.amount < b->max_clay +			|| i->bsdn.amount < b->max_bsdn) +	{ +		inventory_tick(&test); +//		fprintf(stderr, "%d: doing nothing\n", remaining); +		inventory_build_exhaustive(&test, b, remaining - 1); +		if (inventory_cmp(&test, &best) > 0) +			best = test; +		test = *i; +	} +  	// Try building a geode robot, and check if that's better than doing nothing.  	if (inventory_build(&test, b, GEOD) == 0) {  //		fprintf(stderr, "%d: building a geod robot (%ld)\n", remaining, test.geod.amount); | 
