X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/mm/blobdiff_plain/7a869046513cff8cf3c3ccea0c28d2ccab29b868..409fd5353621727a71e1c54fee10badc38777e1b:/mm.c diff --git a/mm.c b/mm.c index e25f5d4..df68992 100644 --- a/mm.c +++ b/mm.c @@ -115,6 +115,7 @@ static void rate_init(ratectx *r, const dig *s) static ratectx *rate_new(const mm *m, const dig *s) { ratectx *r = rate_alloc(m); + rate_init(r, s); return (r); } @@ -144,11 +145,7 @@ static void rate(const ratectx *r, const dig *g, unsigned *b, unsigned *w) *w = ww; } -static void rate_free(ratectx *r) -{ - xfree(r->v); - DESTROY(r); -} +static void rate_free(ratectx *r) { xfree(r->v); DESTROY(r); } /*----- Computer player ---------------------------------------------------*/ @@ -222,6 +219,7 @@ static void foreach_proto(cpc *c, void (*fn)(cpc *c, unsigned x)) { unsigned k = c->m.k, n = c->m.n; + dofep(c, fn, k, n, 0, c->x); } @@ -351,9 +349,7 @@ static void cpc_free(cpc *c) } static void cp_rate(void *r, const dig *g, unsigned *b, unsigned *w) -{ - rate(r, g, b, w); -} + { rate(r, g, b, w); } static const dig *cp_guess(void *cc) { @@ -497,10 +493,7 @@ again: } static void sp_update(void *ss, const dig *g, unsigned b, unsigned w) -{ - spc *s = ss; - cp_update(s->c, g, b, w); -} + { spc *s = ss; cp_update(s->c, g, b, w); } /*----- Main game logic ---------------------------------------------------*/