Changeset 795

Show
Ignore:
Timestamp:
03/19/08 08:12:08 (8 months ago)
Author:
takkaria
Message:

Get the statistics generator working again:

  • Update after r_ptr->flags change.
  • Add another utility function to just print (level, x) pairs, for easier graphing
  • Change licence to BSD
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/wiz-stats.c

    r604 r795  
    33 * Purpose: Statistics collection on dungeon generation 
    44 * 
    5  * Copyright (c) 2007 Angband Contributors 
    6  * 
    7  * This work is free software; you can redistribute it and/or modify it 
    8  * under the terms of either: 
    9  * 
    10  * a) the GNU General Public License as published by the Free Software 
    11  *    Foundation, version 2, or 
    12  * 
    13  * b) the "Angband licence": 
    14  *    This software may be copied and distributed for educational, research, 
    15  *    and not for profit purposes provided that this copyright and statement 
    16  *    are included in all such copies.  Other copyrights may also apply. 
     5 * Copyright (c) 2008 Andrew Sidwell 
     6 * 
     7 * Redistribution and use in source and binary forms, with or without 
     8 * modification, are permitted provided that the following conditions are met: 
     9 * 
     10 *  * Redistributions of source code must retain the above copyright notice, 
     11 *    this list of conditions and the following disclaimer. 
     12 * 
     13 *  * Redistributions in binary form must reproduce the above copyright notice, 
     14 *    this list of conditions and the following disclaimer in the documentation 
     15 *    and/or other materials provided with the distribution. 
    1716 */ 
    1817#include "angband.h" 
     
    6665        for (i = 0; i < no_results; i++) 
    6766                printf("%s,", results[i].value); 
     67 
     68        printf("\n"); 
     69} 
     70 
     71void results_print_csv_pair(const char *field1, const char *field2) 
     72{ 
     73        size_t i; 
     74        for (i = 0; i < no_results; i++) 
     75        { 
     76                if (strcmp(results[i].key, field1) == 0) 
     77                { 
     78                        printf("%s,", results[i].value); 
     79                        break; 
     80                } 
     81        } 
     82 
     83        for (i = 0; i < no_results; i++) 
     84        { 
     85                if (strcmp(results[i].key, field2) == 0) 
     86                { 
     87                        printf("%s,", results[i].value); 
     88                        break; 
     89                } 
     90        } 
    6891 
    6992        printf("\n"); 
     
    131154void stats_monster(const monster_type *m_ptr) 
    132155{ 
    133         u32b f1 = r_info[m_ptr->r_idx].flags1
     156        u32b f1 = r_info[m_ptr->r_idx].flags[0]
    134157        float prob = 0.0; 
    135158 
     
    137160        bool item_ok = (!(f1 & (RF1_ONLY_GOLD))); 
    138161 
    139         if (f1 & RF1_DROP_60)  prob += 0.6
    140         if (f1 & RF1_DROP_90)  prob += 0.9
    141         if (f1 & RF1_DROP_1D2) prob += 1.5
    142         if (f1 & RF1_DROP_2D2) prob += 3.0
    143         if (f1 & RF1_DROP_3D2) prob += 4.5
    144         if (f1 & RF1_DROP_4D2) prob += 6.0
     162        if (f1 & RF1_DROP_60)  prob += 0.6/* 0.4*/
     163        if (f1 & RF1_DROP_90)  prob += 0.9/* 0.6*/
     164        if (f1 & RF1_DROP_1D2) prob += 1.5/* 1.0*/
     165        if (f1 & RF1_DROP_2D2) prob += 3.0/* 2.0*/
     166        if (f1 & RF1_DROP_3D2) prob += 4.5/* 3.0*/
     167        if (f1 & RF1_DROP_4D2) prob += 6.0/* 4.0*/
    145168 
    146169        if (gold_ok && item_ok) 
     
    215238        if (first) 
    216239        { 
     240                /* printf("level,mon-drops"); */ 
    217241                results_print_csv_titles(); 
    218242                first = FALSE; 
    219243        } 
    220244 
     245        /* results_print_csv_pair("level", "mon-drops"); */ 
    221246        results_print_csv(); 
    222247 
     
    230255        int depth; 
    231256 
    232         for (depth = 0; depth < 40; depth += 5) 
     257        for (depth = 0; depth < 101; depth += 5) 
    233258        { 
    234259                p_ptr->depth = depth;