/* -*-c-*-
- *
- * $Id$
*
* Simple mastermind game
*
* (c) 2006 Mark Wooding
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of mm: a simple Mastermind game.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* mm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with mm; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void foreach_proto(cpc *c, void (*fn)(cpc *c,
const dig *g,
unsigned x))
-{
+{
unsigned k = c->m.k, n = c->m.n;
dofep(c, fn, k, n, 0, c->x);
scanf("%u", &x);
h->t[i] = x;
}
- return (h->t);
+ return (h->t);
}
static void sp_update(void *ss, const dig *g, unsigned b, unsigned w)
fputs(": ", stdout);
fflush(stdout);
}
-
+
c = cpc_new(a->m, CPCF_QUIET);
for (;;) {
t0 = clock();
t0 = clock();
cp_update(c, g, b, w);
t1 = clock();
- t += t1 - t0;
+ t += t1 - t0;
}
a->t += t;
a->g += n;
} break;
case 0: {
cpc *cc = cpc_new(&m, 0);
- if (rr)
+ if (rr)
n = play(&m, ratefn, rr, cp_guess, cp_update, cc);
else
n = play(&m, hp_rate, &m, cp_guess, cp_update, cc);