btmux/autom4te.cache/
btmux/doc/.svn/
btmux/event/.svn/
btmux/game/.svn/
btmux/game/bin/.svn/
btmux/game/data/.svn/
btmux/game/logs/.svn/
btmux/game/maps/
btmux/game/maps/.svn/
btmux/game/maps/.svn/prop-base/
btmux/game/maps/.svn/props/
btmux/game/maps/.svn/text-base/
btmux/game/maps/.svn/wcprops/
btmux/game/mechs/
btmux/game/mechs/.svn/
btmux/game/mechs/.svn/prop-base/
btmux/game/mechs/.svn/props/
btmux/game/mechs/.svn/text-base/
btmux/game/mechs/.svn/wcprops/
btmux/game/text/.svn/
btmux/include/.svn/
btmux/misc/
btmux/misc/.svn/
btmux/misc/.svn/prop-base/
btmux/misc/.svn/props/
btmux/misc/.svn/text-base/
btmux/misc/.svn/wcprops/
btmux/python/
btmux/python/.svn/
btmux/python/.svn/prop-base/
btmux/python/.svn/props/
btmux/python/.svn/text-base/
btmux/python/.svn/wcprops/
btmux/src/.svn/prop-base/
btmux/src/.svn/props/
btmux/src/.svn/text-base/
btmux/src/.svn/wcprops/
btmux/src/hcode/.svn/
btmux/src/hcode/btech/
btmux/src/hcode/btech/.svn/
btmux/src/hcode/btech/.svn/prop-base/
btmux/src/hcode/btech/.svn/props/
btmux/src/hcode/btech/.svn/text-base/
btmux/src/hcode/btech/.svn/wcprops/
btmux/src/hcode/include/.svn/
/*
 * $Id: mech.stat.c,v 1.1.1.1 2005/01/11 21:18:23 kstevens Exp $
 *
 * Author: Markus Stenberg <fingon@iki.fi>
 *
 *  Copyright (c) 1997 Markus Stenberg
 *  Copyright (c) 1998-2002 Thomas Wouters
 *  Copyright (c) 2000-2002 Cord Awtry
 *       All rights reserved
 *
 * Created: Tue Aug 12 19:06:48 1997 fingon
 * Last modified: Tue Aug 12 20:04:59 1997 fingon
 *
 */

/* Make statistics 'bout what we do.. whatever it is we _do_ */

#define MECH_STAT_C
#include "mech.stat.h"
#include "db.h"
#include "externs.h"

stat_type rollstat;

void init_stat()
{
    /* This is not necessary -- globals are always initialized empty */
    /* bzero(&stat, sizeof(stat)); */
}

static int chances[11] = { 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 };

void do_show_stat(dbref player, dbref cause, int key, char *arg1,
    char *arg2)
{
    int i;
    float f1, f2;

    if (!rollstat.totrolls) {
	notify(player, "No rolls to show statistics for!");
	return;
    }
    for (i = 0; i < 11; i++) {
	if (i == 0) {
	    notify(player, "#   Rolls  Optimal% Present% Diff. in 1000");
	}
	f1 = (float) chances[i] * 100.0 / 36.0;
	f2 = (float) rollstat.rolls[i] * 100.0 / rollstat.totrolls;
	notify(player, tprintf("%-3d %6d %8.3f %8.3f %.3f", i + 2,
		rollstat.rolls[i], f1, f2, 10.0 * f2 - 10.0 * f1));
    }
    notify(player, tprintf("Total rolls: %d", rollstat.totrolls));
}