[Tux4kids-commits] r28 - in tuxmath/trunk: . data/missions docs src

dbruce at alioth.debian.org dbruce at alioth.debian.org
Thu Mar 8 21:07:37 CET 2007


Author: dbruce
Date: 2006-09-20 11:48:50 +0000 (Wed, 20 Sep 2006)
New Revision: 28

Modified:
   tuxmath/trunk/Makefile
   tuxmath/trunk/data/missions/options
   tuxmath/trunk/docs/README.txt
   tuxmath/trunk/docs/TODO.txt
   tuxmath/trunk/docs/changelog
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/fileops.h
   tuxmath/trunk/src/game.c
   tuxmath/trunk/src/mathcards.c
   tuxmath/trunk/src/mathcards.h
   tuxmath/trunk/src/tuxmath.h
Log:
feedback control system


Modified: tuxmath/trunk/Makefile
===================================================================
--- tuxmath/trunk/Makefile	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/Makefile	2006-09-20 11:48:50 UTC (rev 28)
@@ -32,7 +32,7 @@
 OWNER=$(shell if `groups root | grep root > /dev/null` ; then echo root:root ; else echo root:wheel ; fi)
 
 
-VERSION=tuxmath-0.93
+VERSION=tuxmath-0.95
 
 all:	tuxmath
 

Modified: tuxmath/trunk/data/missions/options
===================================================================
--- tuxmath/trunk/data/missions/options	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/data/missions/options	2006-09-20 11:48:50 UTC (rev 28)
@@ -1,119 +1,252 @@
 ############################################################
 #                                                          #
-#                 Tuxmath Config File                      #
+#              Tuxmath Configuration File                  #
 #                                                          #
+# The behavior of Tuxmath can be controlled to a great     #
+# extent by editing this file with any and saving it in    #
+# the default options location ($HOME/.tuxmath/options).   #
+# The file consists of 'NAME = VALUE' pairs, one pair per  #
+# line. Each option is one of the following types:         #
+#                                                          #
+#     boolean: 1 (synonyms 'true', 'T', 'yes', 'Y', 'on')  #
+#              or                                          #
+#              0 (synonyms 'false, 'F', 'no', 'N', 'off')  #
+#     integer  (i.e. non-fractional numbers)               #
+#     float    (i.e decimal fractions)                     #
+#                                                          #
+# Lines beginning with '#' or ';' are ignored as comments. #
+# The synonyms for boolean '0' and '1' are accepted as     #
+# input, but always written as '0' or '1' when Tuxmath     #
+# writes a config file to disk.                            #
+# The file is organized with the more important options    #
+# first.                                                   #
 ############################################################
 
+############################################################
+#                                                          #
+#                       Game Mode                          #
+#                                                          #
+# Parameter: play_through_list (Boolean)                   #
+# Default: 1                                               #
+#                                                          #
+# Tuxmath generates a list of math questions based on      #
+# parameters set below.  By default, (play_through_list =  #
+# 1) the questions are asked in a random order.            #
+# Correctly answered questions are removed from the list.  #
+# If the player fails to correctly answer a question       #
+# before it hits a city, the question will be reinserted   #
+# into the list in a random location.                      #
+# The player wins if all questions are answered correctly  #
+# before the cities are destroyed.                         #
+#                                                          #
+# Alternatively, Tuxmath can be played in 'Arcade Mode'    #
+# by setting play_through_list = 0 (i.e. 'false'). If this #
+# is done, all questions will be randomly reinserted into  #
+# the list whether or not they are answered correctly, and #
+# the game continues as long as there is a surviving city. #
+############################################################
 
+play_through_list = 1
+
 ############################################################
 #                                                          #
-#                 General Game Options                     #
+#                 Speed and Number of Comets               #
 #                                                          #
-# The following options are boolean (true/false) variables #
-# that control various aspects of Tuxmath's behavior.      #
-# The program writes the values to the file as either '0'  #
-# or '1'. However, the program accepts 'n', 'no', 'f', and #
-# 'false' as synonyms for '0', and similarly accepts 'y',  #
-# 'yes', 't', and 'true' as synonyms for '1' (all case-    #
-# insensitive).                                            #
+# Parameter: allow_speedup (boolean)                       #
+# Default: 1                                               #
+# Parameter: use_feedback  (boolean)                       #
+# Default: 0                                               #
+#                                                          #
+# By default, the comets become faster and more numerous   #
+# with each succeeding. The increase can be prevented      #
+# by setting 'allow_speedup' to 0.                         #
+#                                                          #
+# If 'allow_speedup' is enabled, it is also possible to    #
+# dynamically adjust the speed to the player's performance #
+# by setting 'use_feedback' to 1.  This feature attempts   #
+# to speed the game up if it is too easy for the player,   #
+# and to slow it down if the player is having trouble.     #
+#                                                          #
+# Many additional parameters under 'Advanced Options' can  #
+# be used to fine-tune these behaviors.                    #
 ############################################################
 
+allow_speedup = 1
+use_feedback = 0
+
 ############################################################
-# 'per_user_config' determines whether Tuxmath will look   #
-# in the user's home directory for settings. Default is 1  #
-# (yes). If deselected, the program will ignore the user's #
-# .tuxmath file and use the the global settings in the     #
-# installation-wide config file.                           #
-# This setting cannot be changed by an ordinary user.      #
+#                                                          #
+#               Selecting Math Operations                  #
+#                                                          #
+# Parameter: addition_allowed (boolean)                    #
+# Default: 1                                               #
+# Parameter: subtraction_allowed (boolean)                 #
+# Default: 1                                               #
+# Parameter: multiplication_allowed (boolean)              #
+# Default: 1                                               #
+# Parameter: division_allowed (boolean)                    #
+# Default: 1                                               #
+#                                                          #
+# These options enable questions for each of the four math #
+# operations.  All are 1 (yes) by default.                 #
 ############################################################
-per_user_config = 1
 
-# Self-explanatory, default is 1:
-use_sound = 1
+addition_allowed = 1
+subtraction_allowed = 1
+multiplication_allowed = 1
+division_allowed = 1
 
-# Use either fullscreen at 640x480 resolution or window of that size
-# Default is 1.  Change to 0 if SDL has trouble with fullscreen.
-fullscreen = 1
+############################################################
+#                                                          #
+#                 Negative Number Support                  #
+#                                                          #
+# Parameter: allow_negatives (boolean)                     #
+# Default: 0                                               #
+#                                                          #
+# 'allow_negatives' allows or disallows use of negative    #
+# numbers as both operands and answers.  Default is 0      #
+# (no), which disallows questions like:                    #
+#          2 - 4 = ?                                       #
+# Note: this option must be enabled in order to set the    #
+# operand ranges to include negatives. If it is changed    #
+# from 1 (yes) to 0 (no), any negative operand limits will #
+# be reset to 0.                                           #
+############################################################
 
-# Use 640x480 jpg image for background; default is 1.
-use_bkgd = 1
+allow_negatives = 0
 
-# Program runs as demo; default is 0.
-demo_mode = 0
+############################################################
+#                                                          #
+#      Minimum and Maximum Values for Operand Ranges       #
+#                                                          #
+# Parameters: (multiple - all integer type)                #
+#                                                          #
+# Operand limits can be set to any integer up to the       #
+# value of 'max_answer'. Tuxmath will generate questions   #
+# for every value in the specified range. The maximum must #
+# be greater than or equal to the corresponding minimum    #
+# for any questions to be generated for that operation.    #
+# Defaults are 0 for minima and 12 for maxima.             #
+#                                                          #
+# Note: 'allow_negatives' must be set to 1 for negative    #
+# values to be accepted (see 'Advanced Options').          #
+############################################################
 
-# Use operator selection from command line; default is 0.
-oper_override = 0
+# Addition operands:
+# augend + addend = sum
 
-# Display onscreen numeric keypad; default is 0.
-use_keypad = 0
+min_augend = 0
+max_augend = 12
+min_addend = 0
+max_addend = 12
 
+# Subtraction operands:
+# minuend - subtrahend = difference
+
+min_minuend = 0
+max_minuend = 12
+min_subtrahend = 0
+max_subtrahend = 12
+
+# Multiplication operands:
+# multiplier * multiplicand = product
+
+min_multiplier = 0
+max_multiplier = 12
+min_multiplicand = 0
+max_multiplicand = 12
+
+# Division operands:
+# dividend/divisor = quotient
+
+min_divisor = 0
+max_divisor = 12
+min_quotient = 0
+max_quotient = 12
+
+
 ############################################################
-# The remaining settings determine the speed and number    #
-# of comets.  The speed settings are float numbers (mean-  #
-# ing decimals allowed). The comet settings are integers.  #
+#                                                          #
+#                 General Game Options                     #
+#                                                          #
+# Parameter: use_sound (boolean)                           #
+# Default: 1                                               #
+# Parameter: fullscreen (boolean)                          #
+# Default: 1                                               #
+# Parameter: demo_mode (boolean)                           #
+# Default: 0                                               #
+# Parameter: use_keypad (boolean)                          #
+# Default: 0                                               #
+#                                                          #
+# These parameters control various aspects of Tuxmath's    #
+# not directly related to the math question to be asked.   #
 ############################################################
 
-# Starting comet speed. Default is 1.
-speed = 1.000000
+# Use game sounds and background music if possible:
+use_sound = 1
 
-# Speed is multiplied by this factor with each new wave.
-# Default is 1.2
-speedup_factor = 1.200000
+# Use fullscreen at 640x480 resolution instead of
+# 640x480 window. Change to 0 if SDL has trouble with
+# fullscreen on your system:
+fullscreen = 1
 
-# Maximum speed. Default is 10.
-max_speed = 10.000000
+# Display jpg images for background:
+use_bkgd = 1
 
-# Number of comets for first wave. Default is 2.
-starting_comets = 2
+# Run Tuxmath as demo (i.e. without user input):
+demo_mode = 0
 
-# Comets to add for each successive wave. Default is 2.
-extra_comets_per_wave = 2
+# Display onscreen numeric keypad - allows mouse-only
+# gameplay or use with touchscreens:
+use_keypad = 0
 
-# Maximum number of comets. Default is 10.
-max_comets = 10
 
-# Allow speed and number of comets to increase with each
-# wave.  May want to turn this off for smaller kids. Default is 1.
-allow_speedup = 1
+############################################################
+#                                                          #
+#                   Advanced Options                       #
+#                                                          #
+# The remaining settings further customize Tuxmath's       #
+# behavior.  Most users will probably not change them.     #
+############################################################
 
-# Go back to starting speed and number of comets if player
-# misses a question. Useful for smaller kids. Default is 0.
-slow_after_wrong = 0
-
 ############################################################
 #                                                          #
-#                  General Math Options                    #
+#           Advanced Math Question List Options            #
 #                                                          #
-# If 'play_through_list' is true, Tuxmath will ask each    #
-# question in an internally-generated list. The list is    #
-# generated based on the question ranges selected below.   #
-# The game ends when no questions remain.                  #
-# If 'play_through_list' is false, the game continues      #
-# until all cities are destroyed.                          #
-# Default is 1 (i.e. 'true' or 'yes').                     #
+# Parameter: question_copies (integer)                     #
+# Default: 1                                               #
+# Parameter: repeat_wrongs (boolean)                       #
+# Default: 1                                               #
+# Parameter: copies_repeated_wrongs (integer)              #
+# Default: 1                                               #
 #                                                          #
+# These settings offer further control over the question   #
+# list and are generally only useful if 'play_through_list'#
+# is enabled (as it is by default).                        #
+#                                                          #
 # 'question_copies' is the number of times each question   #
-# will be asked. It can be 1 to 10 - Default is 1.         #
+# is put into the initial list. It can be 1 to 10.         #
 #                                                          #
-# 'repeat_wrongs' tells Tuxmath whether to reinsert        #
-# incorrectly answered questions into the list to be       #
-# asked again. Default is 1 (yes).                         #
+# 'repeat_wrongs' determines whether questions the player  #
+# failed to answer correctly will be asked again.          #
 #                                                          #
-# 'copies_repeated_wrongs' gives the number of times an    #
-# incorrectly answered question will reappear. Default     #
-# is 1.                                                    #
+# 'copies_repeated_wrongs' gives the number of times a     #
+# missed question will reappear. This can be set anywhere  #
+# from 1 to 10.                                            #
 #                                                          #
 # The defaults for these values result in a 'mission'      #
 # for Tux that is accomplished by answering all            #
 # questions correctly with at least one surviving city.    #
 ############################################################
 
-play_through_list = 1
 question_copies = 1
 repeat_wrongs = 1
 copies_repeated_wrongs = 1
 
 ############################################################
+#                                                          #
+#                 Math Question Formats                    #
+#                                                          #
 # The 'format_<op>_answer_<place>  options control         #
 # generation of questions with the answer in different     #
 # places in the equation.  i.e.:                           #
@@ -128,7 +261,7 @@
 # contain questions with different formats.                #
 #                                                          #
 # The formats are set independently for each of the four   #
-# math operations.                                         #
+# math operations. All parameters are type 'boolean'.      #
 ############################################################
 
 format_add_answer_last = 1
@@ -145,88 +278,156 @@
 format_div_answer_middle = 0
 
 ############################################################
-# 'allow_negatives' allows or disallows use of negative    #
-# numbers as both operands and answers.  Default is 0      #
-# (no), which disallows questions like:                    #
-#          2 - 4 = ?                                       #
-# Note: this option must be enabled in order to set the    #
-# operand ranges to include negatives (see below). If it   #
-# is changed from 1 (yes) to 0 (no), any negative          #
-# operand limits will be reset to 0.                       #
-############################################################
-
-allow_negatives = 0
-
-############################################################
+#                                                          #
+# Parameter: max_answer (integer)                          #
+# Default: 999                                             #
+#                                                          #
 # 'max_answer' is the largest absolute value allowed in    #
 # any value in a question (not only the answer). Default   #
-# is 144. It can be set as high as 999.                    #
+# is 999, which is as high as it can be set. It can be set #
+# lower to fine-tune the list for certain 'lessons'.       #
 ############################################################
 
-max_answer = 144
+max_answer = 999
 
 ############################################################
+#                                                          #
+# Parameter: max_questions (integer)                       #
+# Default: 5000                                            #
+#                                                          #
 # 'max_questions' is limit of the length of the question   #
 # list. Default is 5000 - only severe taskmasters will     #
-# need to raise it.                                        #
+# need to raise it!                                        #
 ############################################################
 
 max_questions = 5000
 
 ############################################################
+#                                                          #
+# Parameter: randomize (boolean)                           #
+# Default: 1                                               #
+#                                                          #
 # If 'randomize' selected, the list will be shuffled       #
-# at the start of the game.  Default is 1 (yes).           #
+# at the start of the game. Otherwise, the questions       #
+# appear in the order the program generates them.          #
 ############################################################
 
 randomize = 1
 
 ############################################################
 #                                                          #
-#                 Math Operations Allowed                  #
+#                Advanced Comet Speed Options              #
 #                                                          #
-# These options enable questions for each of the four math #
-# operations.  All are 1 (yes) by default.                 #
+# Parameter: starting_comets (integer)                     #
+# Default: 2                                               #
+# Parameter: extra_comets_per_wave (integer)               #
+# Default: 2                                               #
+# Parameter: max_comets (integer)                          #
+# Default: 10                                              #
+# Parameter: speed (float)                                 #
+# Default: 1.00                                            #
+# Parameter: max_speed (float)                             #
+# Default: 10.00                                           #
+# Parameter: speedup_factor (float)                        #
+# Default: 1.20                                            #
+# Parameter: slow_after_wrong (bool)                       #
+# Default: 0                                               #
+#                                                          #
+# (for 'feedback' speed control system):                   #
+# Parameter: danger_level (float)                          #
+# Default: 0.35                                            #
+# Parameter: danger_level_speedup (float)                  #
+# Default: 1.1                                             #
+# Parameter: danger_level_max (float)                      #
+# Default: 0.9                                             #
+# Parameter: city_explode_handicap (float)                 #
+# Default: 0                                               #
+#                                                          #
+# The comet number parameters and initial/max speed apply  #
+# whether or not the feedback system is activated.         #
+#                                                          #
+# 'speedup_factor' and 'slow_after_wrong' only apply if    #
+# feedback is not activated.                               #
+#                                                          #
+# The 'danger_level_*' and 'city_explode_handicap'         #
+# parameters are only used if feedback is activated.       #
 ############################################################
 
-addition_allowed = 1
-subtraction_allowed = 1
-multiplication_allowed = 1
-division_allowed = 1
 
+# Number of comets for first wave. Default is 2.
+starting_comets = 2
+
+# Comets to add for each successive wave. Default is 2.
+extra_comets_per_wave = 2
+
+# Maximum number of comets. Default is 10.
+max_comets = 10
+
+# Starting comet speed. Default is 1.
+speed = 1.000000
+
+# Maximum speed. Default is 10.
+max_speed = 10.000000
+
+# 'speedup_factor': If feedback is not used but 
+# 'allow_speedup' isenabled, the comet speed will be
+# multiplied by this factor with each new wave.
+# Default is 1.2 (i.e. 20 percent increase per wave)
+
+speedup_factor = 1.200000
+
+# 'slow_after_wrong' tells Tuxmath to go back to  
+# starting speedand number of comets if the player misses 
+# a question. Useful for smaller kids. Default is 0.
+
+slow_after_wrong = 0
+
+# (Feedback) Set the desired danger level.
+# 0 = too safe, comets typically exploded at the very top
+# 1 = too dangerous, comets typically exploded as they
+# hit cities. Set it somewhere between these extremes. As
+# a guideline, early elementary kids might prefer
+# 0.2-0.3, older kids at around 0.4-0.6. Default 0.35.
+
+danger_level = 0.350000
+
+# (Feedback) Set danger level speedup.
+# The margin of safety will decrease by this factor each
+# wave. Default 1.1. Note 1 = no increase in danger level.
+
+danger_level_speedup = 1.100000
+
+# (Feedback) Set the maximum danger level.
+# Default 0.9.
+danger_level_max = 0.900000
+
+# (Feedback) Set the handicap for hitting cities.
+# When bigger than 0, this causes the game to slow down
+# by an extra amount after a wave in which one or more
+# cities get hit. Note that this is similar to
+# 'slow_after_wrong', but allows for more gradual
+# changes. Default 0 (no extra handicap).
+
+city_explode_handicap = 0.000000
+
+
 ############################################################
 #                                                          #
-#      Minimum and Maximum Values for Operand Ranges       #
+#                 Restricting User Settings                #
 #                                                          #
-# Operand limits can be set to any integer up to the       #
-# value of 'max_answer'.  If 'allow_negatives' is set to 1 #
-# (yes), either negative or positive values can be used.   #
-# Tuxmath will generate questions for every value in the   #
-# specified range. The maximum must be greater than or     #
-# equal to the corresponding minimum for any questions to  #
-# be generated for that operation.                         #
+# Parameter: per_user_config (boolean)                     #
+# Default: 1                                               #
+#                                                          #
+# 'per_user_config' determines whether Tuxmath will look   #
+# in the user's home directory for settings. Default is 1  #
+# (yes). If set to 0, the program will ignore the user's   #
+# .tuxmath file and use the the global settings in the     #
+# installation-wide config file.                           #
+#                                                          #
+# This setting cannot be changed by an ordinary user, i.e. #
+# it is ignored unless the config file is Tuxmath's global #
+# config file. Thus, users cannot 'lock themselves out'    #
+# by accidentally setting this to 0.                       #
 ############################################################
 
-
-# Addition operands: augend + addend = sum
-min_augend = 0
-max_augend = 12
-min_addend = 0
-max_addend = 12
-
-# Subtraction operands: minuend - subtrahend = difference
-min_minuend = 0
-max_minuend = 12
-min_subtrahend = 0
-max_subtrahend = 12
-
-# Multiplication operands: multiplier * multiplicand = product
-min_multiplier = 0
-max_multiplier = 12
-min_multiplicand = 0
-max_multiplicand = 12
-
-# Division operands: dividend/divisor = quotient
-min_divisor = 0
-max_divisor = 12
-min_quotient = 0
-max_quotient = 12
+per_user_config = 1

Modified: tuxmath/trunk/docs/README.txt
===================================================================
--- tuxmath/trunk/docs/README.txt	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/docs/README.txt	2006-09-20 11:48:50 UTC (rev 28)
@@ -2,9 +2,9 @@
 An educational math tutorial game starring Tux, the Linux Penguin
 -----------------------------------------------------------------
 
-August 11, 2006
+Sept 20, 2006
 
-For tuxmath-0.9
+For tuxmath-0.95
 
 Objective
 ---------

Modified: tuxmath/trunk/docs/TODO.txt
===================================================================
--- tuxmath/trunk/docs/TODO.txt	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/docs/TODO.txt	2006-09-20 11:48:50 UTC (rev 28)
@@ -1,6 +1,6 @@
 TODO.txt for "tuxmath"
 
-September 03, 2006
+September 20, 2006
 
 Build:
   * Fix certain file permissions issues when packaged as rpm.
@@ -39,6 +39,7 @@
   * Command-line options based on grade-level (?)
 
 Code:
+  * Error checking to make sure values from config files are sane.
   * Optimize graphics blitting!!!
   * Abstract SDL_BlitSurface() calls
 

Modified: tuxmath/trunk/docs/changelog
===================================================================
--- tuxmath/trunk/docs/changelog	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/docs/changelog	2006-09-20 11:48:50 UTC (rev 28)
@@ -1,5 +1,23 @@
 changelog for "tuxmath"
 
+2006.Sep.03 (https://svn.tux4kids.net/tuxmath/ - revision 26)
+  Version 0.95
+
+  Setup:
+    * Config file output cleaned up with better organization
+      and better comments.
+  Game:
+    * Feedback system implemented to dynamically adjust comet
+      speed based on player performance.
+      Tim Holy <holy at wustl.edu>
+  Code:
+    * Fixed bug causing crash if max_comets set too high.
+      Tim Holy <holy at wustl.edu>
+    * Fixed bug causing crash due to SDL_FreeSurface() being
+      called twice on same pointer in certain code path.
+      David Bruce <dbruce at tampabay.rr.com>
+     
+
 2006.Sep.03 (https://svn.tux4kids.net/tuxmath/ - revision 22)
   Version 0.94
 
@@ -13,6 +31,7 @@
       only used for debugging output, but soon tuxmath will
       save lists of questions asked and questions missed to 
       files for post-game review.
+      David Bruce <dbruce at tampabay.rr.com>
 
 2006.Sep.03 (https://svn.tux4kids.net/tuxmath/ - revision 21)
   Version 0.93

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/fileops.c	2006-09-20 11:48:50 UTC (rev 28)
@@ -948,7 +948,7 @@
   fp = fopen(opt_path, "w");
   if (fp)
   {
-    write_config_file(fp);
+    write_config_file(fp, 1);
     fclose(fp);
     fp = NULL;
     return 1;
@@ -961,8 +961,8 @@
 
 /* this function writes the settings for all game options to a */
 /* human-readable file.                                        */
-
-int write_config_file(FILE *fp)
+/* FIXME add 'verbose flag' */
+int write_config_file(FILE *fp, int verbose)
 {
   #ifdef TUXMATH_DEBUG
   printf("\nEntering write_config_file()\n");
@@ -980,20 +980,549 @@
     return 0;
   }
 
-  fprintf(fp, 
+  if (verbose)
+  {
+    fprintf(fp, 
           "############################################################\n"
           "#                                                          #\n"
-          "#                 Tuxmath Config File                      #\n"
+          "#              Tuxmath Configuration File                  #\n"
           "#                                                          #\n"
+          "# The behavior of Tuxmath can be controlled to a great     #\n"
+          "# extent by editing this file with any and saving it in    #\n"
+          "# the default options location ($HOME/.tuxmath/options).   #\n"
+          "# The file consists of 'NAME = VALUE' pairs, one pair per  #\n"
+          "# line. Each option is one of the following types:         #\n"
+          "#                                                          #\n"
+          "#     boolean: 1 (synonyms 'true', 'T', 'yes', 'Y', 'on')  #\n"
+          "#              or                                          #\n"
+          "#              0 (synonyms 'false, 'F', 'no', 'N', 'off')  #\n"
+          "#     integer  (i.e. non-fractional numbers)               #\n"
+          "#     float    (i.e decimal fractions)                     #\n"
+          "#                                                          #\n"
+          "# Lines beginning with '#' or ';' are ignored as comments. #\n"
+          "# The synonyms for boolean '0' and '1' are accepted as     #\n"
+          "# input, but always written as '0' or '1' when Tuxmath     #\n"
+          "# writes a config file to disk.                            #\n"
+          "# The file is organized with the more important options    #\n"
+          "# first.                                                   #\n"
           "############################################################\n"
           "\n"
-  );
+    );
+  }
 
+  if (verbose)
+  {
+    fprintf(fp, 
+          "############################################################\n"
+          "#                                                          #\n"
+          "#                       Game Mode                          #\n"
+          "#                                                          #\n"
+          "# Parameter: play_through_list (Boolean)                   #\n"
+          "# Default: 1                                               #\n"
+          "#                                                          #\n"
+          "# Tuxmath generates a list of math questions based on      #\n"
+          "# parameters set below.  By default, (play_through_list =  #\n"
+          "# 1) the questions are asked in a random order.            #\n"
+          "# Correctly answered questions are removed from the list.  #\n"
+          "# If the player fails to correctly answer a question       #\n"
+          "# before it hits a city, the question will be reinserted   #\n"
+          "# into the list in a random location.                      #\n"
+          "# The player wins if all questions are answered correctly  #\n"
+          "# before the cities are destroyed.                         #\n"
+          "#                                                          #\n"
+          "# Alternatively, Tuxmath can be played in 'Arcade Mode'    #\n"
+          "# by setting play_through_list = 0 (i.e. 'false'). If this #\n"
+          "# is done, all questions will be randomly reinserted into  #\n"
+          "# the list whether or not they are answered correctly, and #\n"
+          "# the game continues as long as there is a surviving city. #\n"
+          "############################################################\n"
+          "\n"
+    );
+  }
+  fprintf (fp, "play_through_list = %d\n", MC_PlayThroughList());
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n" 
+                 "#                                                          #\n"
+                 "#                 Speed and Number of Comets               #\n"
+                 "#                                                          #\n"
+                 "# Parameter: allow_speedup (boolean)                       #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: use_feedback  (boolean)                       #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# By default, the comets become faster and more numerous   #\n"
+                 "# with each succeeding. The increase can be prevented      #\n"
+                 "# by setting 'allow_speedup' to 0.                         #\n"
+                 "#                                                          #\n"
+                 "# If 'allow_speedup' is enabled, it is also possible to    #\n"
+                 "# dynamically adjust the speed to the player's performance #\n"
+                 "# by setting 'use_feedback' to 1.  This feature attempts   #\n"
+                 "# to speed the game up if it is too easy for the player,   #\n"
+                 "# and to slow it down if the player is having trouble.     #\n"
+                 "#                                                          #\n"
+                 "# Many additional parameters under 'Advanced Options' can  #\n"
+                 "# be used to fine-tune these behaviors.                    #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf(fp, "allow_speedup = %d\n", game_options->allow_speedup);
+  fprintf(fp, "use_feedback = %d\n", game_options->use_feedback);
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "#               Selecting Math Operations                  #\n"
+                 "#                                                          #\n"
+                 "# Parameter: addition_allowed (boolean)                    #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: subtraction_allowed (boolean)                 #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: multiplication_allowed (boolean)              #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: division_allowed (boolean)                    #\n"
+                 "# Default: 1                                               #\n"
+                 "#                                                          #\n"
+                 "# These options enable questions for each of the four math #\n"
+                 "# operations.  All are 1 (yes) by default.                 #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf(fp, "addition_allowed = %d\n", MC_AddAllowed());
+  fprintf(fp, "subtraction_allowed = %d\n", MC_SubAllowed());
+  fprintf(fp, "multiplication_allowed = %d\n", MC_MultAllowed());
+  fprintf(fp, "division_allowed = %d\n", MC_DivAllowed());
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "#                 Negative Number Support                  #\n"
+                 "#                                                          #\n"
+                 "# Parameter: allow_negatives (boolean)                     #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# 'allow_negatives' allows or disallows use of negative    #\n"
+                 "# numbers as both operands and answers.  Default is 0      #\n"
+                 "# (no), which disallows questions like:                    #\n"
+                 "#          2 - 4 = ?                                       #\n"
+                 "# Note: this option must be enabled in order to set the    #\n"
+                 "# operand ranges to include negatives. If it is changed    #\n"
+                 "# from 1 (yes) to 0 (no), any negative operand limits will #\n"
+                 "# be reset to 0.                                           #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf (fp, "allow_negatives = %d\n", MC_AllowNegatives());
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "#      Minimum and Maximum Values for Operand Ranges       #\n"
+                 "#                                                          #\n"
+                 "# Parameters: (multiple - all integer type)                #\n"
+                 "#                                                          #\n"
+                 "# Operand limits can be set to any integer up to the       #\n"
+                 "# value of 'max_answer'. Tuxmath will generate questions   #\n"
+                 "# for every value in the specified range. The maximum must #\n"
+                 "# be greater than or equal to the corresponding minimum    #\n"
+                 "# for any questions to be generated for that operation.    #\n"
+                 "# Defaults are 0 for minima and 12 for maxima.             #\n"
+                 "#                                                          #\n"
+                 "# Note: 'allow_negatives' must be set to 1 for negative    #\n"
+                 "# values to be accepted (see 'Advanced Options').          #\n"
+                 "############################################################\n");
+  }
+
+  if (verbose)
+  {
+    fprintf(fp, "\n# Addition operands:\n"
+              "# augend + addend = sum\n\n");
+  }
+  fprintf(fp, "min_augend = %d\n", MC_AddMinAugend());
+  fprintf(fp, "max_augend = %d\n", MC_AddMaxAugend());
+  fprintf(fp, "min_addend = %d\n", MC_AddMinAddend());
+  fprintf(fp, "max_addend = %d\n", MC_AddMaxAddend());
+
+  if (verbose)
+  {
+    fprintf(fp, "\n# Subtraction operands:"
+              "\n# minuend - subtrahend = difference\n\n");
+  }
+  fprintf(fp, "min_minuend = %d\n", MC_SubMinMinuend());
+  fprintf(fp, "max_minuend = %d\n", MC_SubMaxMinuend());
+  fprintf(fp, "min_subtrahend = %d\n", MC_SubMinSubtrahend());
+  fprintf(fp, "max_subtrahend = %d\n", MC_SubMaxSubtrahend());
+
+  if (verbose)
+  {
+    fprintf(fp, "\n# Multiplication operands:"
+              "\n# multiplier * multiplicand = product\n\n");
+  }
+  fprintf(fp, "min_multiplier = %d\n", MC_MultMinMultiplier());
+  fprintf(fp, "max_multiplier = %d\n", MC_MultMaxMultiplier());
+  fprintf(fp, "min_multiplicand = %d\n", MC_MultMinMultiplicand());
+  fprintf(fp, "max_multiplicand = %d\n", MC_MultMaxMultiplicand());
+
+  if (verbose)
+  {
+    fprintf(fp, "\n# Division operands:"
+              "\n# dividend/divisor = quotient\n\n");
+  }
+  fprintf(fp, "min_divisor = %d\n",MC_DivMinDivisor());
+  fprintf(fp, "max_divisor = %d\n", MC_DivMaxDivisor());
+  fprintf(fp, "min_quotient = %d\n", MC_DivMinQuotient());
+  fprintf(fp, "max_quotient = %d\n", MC_DivMaxQuotient());
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n\n############################################################\n" 
+                 "#                                                          #\n"
+                 "#                 General Game Options                     #\n"
+                 "#                                                          #\n"
+                 "# Parameter: use_sound (boolean)                           #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: fullscreen (boolean)                          #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: demo_mode (boolean)                           #\n"
+                 "# Default: 0                                               #\n"
+                 "# Parameter: use_keypad (boolean)                          #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# These parameters control various aspects of Tuxmath's    #\n"
+                 "# not directly related to the math question to be asked.   #\n"
+                 "############################################################\n");
+
+  }
+  if (verbose)
+  {
+    fprintf (fp, "\n# Use game sounds and background music if possible:\n");
+  }
+  fprintf(fp, "use_sound = %d\n", game_options->use_sound);
+
+  if (verbose)
+  {
+    fprintf (fp, "\n# Use fullscreen at 640x480 resolution instead of\n"
+                 "# 640x480 window. Change to 0 if SDL has trouble with\n"
+                 "# fullscreen on your system:\n");
+  }
+  fprintf(fp, "fullscreen = %d\n", game_options->fullscreen);
+
+  if (verbose)
+  {
+    fprintf (fp, "\n# Display jpg images for background:\n");
+  }
+  fprintf(fp, "use_bkgd = %d\n", game_options->use_bkgd);
+
+  if (verbose)
+  {
+    fprintf (fp, "\n# Run Tuxmath as demo (i.e. without user input):\n");
+  }
+  fprintf(fp, "demo_mode = %d\n", game_options->demo_mode);
+
+  if (verbose)
+  {
+    fprintf (fp, "\n# Display onscreen numeric keypad - allows mouse-only\n"
+               "# gameplay or use with touchscreens:\n");
+  }
+  fprintf(fp, "use_keypad = %d\n", game_options->use_keypad);
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n\n\n############################################################\n" 
+                 "#                                                          #\n"
+                 "#                   Advanced Options                       #\n"
+                 "#                                                          #\n"
+                 "# The remaining settings further customize Tuxmath's       #\n"
+                 "# behavior.  Most users will probably not change them.     #\n"
+                 "############################################################\n\n");
+  }
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "#           Advanced Math Question List Options            #\n"
+                 "#                                                          #\n"
+                 "# Parameter: question_copies (integer)                     #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: repeat_wrongs (boolean)                       #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: copies_repeated_wrongs (integer)              #\n"
+                 "# Default: 1                                               #\n"
+                 "#                                                          #\n"
+                 "# These settings offer further control over the question   #\n"
+                 "# list and are generally only useful if 'play_through_list'#\n"
+                 "# is enabled (as it is by default).                        #\n"
+                 "#                                                          #\n"
+                 "# 'question_copies' is the number of times each question   #\n"
+                 "# is put into the initial list. It can be 1 to 10.         #\n"
+                 "#                                                          #\n"
+                 "# 'repeat_wrongs' determines whether questions the player  #\n"
+                 "# failed to answer correctly will be asked again.          #\n"
+                 "#                                                          #\n"
+                 "# 'copies_repeated_wrongs' gives the number of times a     #\n"
+                 "# missed question will reappear. This can be set anywhere  #\n"
+                 "# from 1 to 10.                                            #\n"
+                 "#                                                          #\n"
+                 "# The defaults for these values result in a 'mission'      #\n" 
+                 "# for Tux that is accomplished by answering all            #\n"
+                 "# questions correctly with at least one surviving city.    #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf (fp, "question_copies = %d\n", MC_QuestionCopies());
+  fprintf (fp, "repeat_wrongs = %d\n", MC_RepeatWrongs());
+  fprintf (fp, "copies_repeated_wrongs = %d\n", MC_CopiesRepeatedWrongs());
+
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "#                 Math Question Formats                    #\n"
+                 "#                                                          #\n"
+                 "# The 'format_<op>_answer_<place>  options control         #\n"
+                 "# generation of questions with the answer in different     #\n"
+                 "# places in the equation.  i.e.:                           #\n"
+                 "#                                                          #\n"
+                 "#    format_add_answer_last:    2 + 2 = ?                  #\n"
+                 "#    format_add_answer_first:   ? + 2 = 4                  #\n"
+                 "#    format_add_answer_middle:  2 + ? = 4                  #\n"
+                 "#                                                          #\n"
+                 "# By default, 'format_answer_first' is enabled and the     #\n"
+                 "# other two formats are disabled.  Note that the options   #\n"
+                 "# are not mutually exclusive - the question list may       #\n"
+                 "# contain questions with different formats.                #\n"
+                 "#                                                          #\n"
+                 "# The formats are set independently for each of the four   #\n"
+                 "# math operations. All parameters are type 'boolean'.      #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf (fp, "format_add_answer_last = %d\n", MC_FormatAddAnswerLast());
+  fprintf (fp, "format_add_answer_first = %d\n", MC_FormatAddAnswerFirst());
+  fprintf (fp, "format_add_answer_middle = %d\n", MC_FormatAddAnswerMiddle());
+  fprintf (fp, "format_sub_answer_last = %d\n", MC_FormatSubAnswerLast());
+  fprintf (fp, "format_sub_answer_first = %d\n", MC_FormatSubAnswerFirst());
+  fprintf (fp, "format_sub_answer_middle = %d\n", MC_FormatSubAnswerMiddle());
+  fprintf (fp, "format_mult_answer_last = %d\n", MC_FormatMultAnswerLast());
+  fprintf (fp, "format_mult_answer_first = %d\n", MC_FormatMultAnswerFirst());
+  fprintf (fp, "format_mult_answer_middle = %d\n", MC_FormatMultAnswerMiddle());
+  fprintf (fp, "format_div_answer_last = %d\n", MC_FormatDivAnswerLast());
+  fprintf (fp, "format_div_answer_first = %d\n", MC_FormatDivAnswerFirst());
+  fprintf (fp, "format_div_answer_middle = %d\n", MC_FormatDivAnswerMiddle());
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "# Parameter: max_answer (integer)                          #\n"
+                 "# Default: 999                                             #\n"
+                 "#                                                          #\n"
+                 "# 'max_answer' is the largest absolute value allowed in    #\n"
+                 "# any value in a question (not only the answer). Default   #\n"
+                 "# is 999, which is as high as it can be set. It can be set #\n"
+                 "# lower to fine-tune the list for certain 'lessons'.       #\n"
+                 "############################################################\n\n");
+  }
+  fprintf (fp, "max_answer = %d\n", MC_MaxAnswer());
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "# Parameter: max_questions (integer)                       #\n"
+                 "# Default: 5000                                            #\n"
+                 "#                                                          #\n"
+                 "# 'max_questions' is limit of the length of the question   #\n"
+                 "# list. Default is 5000 - only severe taskmasters will     #\n"
+                 "# need to raise it!                                        #\n"
+                 "############################################################\n\n");
+  }
+  fprintf (fp, "max_questions = %d\n", MC_MaxQuestions());  
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
+                 "# Parameter: randomize (boolean)                           #\n"
+                 "# Default: 1                                               #\n"
+                 "#                                                          #\n"
+                 "# If 'randomize' selected, the list will be shuffled       #\n"
+                 "# at the start of the game. Otherwise, the questions       #\n"
+                 "# appear in the order the program generates them.          #\n"
+                 "############################################################\n\n");
+  }
+  fprintf (fp, "randomize = %d\n", MC_Randomize());
+
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n" 
+                 "#                                                          #\n"
+                 "#                Advanced Comet Speed Options              #\n"
+                 "#                                                          #\n"
+                 "# Parameter: starting_comets (integer)                     #\n"
+                 "# Default: 2                                               #\n"
+                 "# Parameter: extra_comets_per_wave (integer)               #\n"
+                 "# Default: 2                                               #\n"
+                 "# Parameter: max_comets (integer)                          #\n"
+                 "# Default: 10                                              #\n"
+                 "# Parameter: speed (float)                                 #\n"
+                 "# Default: 1.00                                            #\n"
+                 "# Parameter: max_speed (float)                             #\n"
+                 "# Default: 10.00                                           #\n"
+                 "# Parameter: speedup_factor (float)                        #\n"
+                 "# Default: 1.20                                            #\n"
+                 "# Parameter: slow_after_wrong (bool)                       #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# (for 'feedback' speed control system):                   #\n"
+                 "# Parameter: danger_level (float)                          #\n"
+                 "# Default: 0.35                                            #\n"
+                 "# Parameter: danger_level_speedup (float)                  #\n"
+                 "# Default: 1.1                                             #\n"
+                 "# Parameter: danger_level_max (float)                      #\n"
+                 "# Default: 0.9                                             #\n"
+                 "# Parameter: city_explode_handicap (float)                 #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# The comet number parameters and initial/max speed apply  #\n"
+                 "# whether or not the feedback system is activated.         #\n"
+                 "#                                                          #\n"
+                 "# 'speedup_factor' and 'slow_after_wrong' only apply if    #\n"
+                 "# feedback is not activated.                               #\n"
+                 "#                                                          #\n"
+                 "# The 'danger_level_*' and 'city_explode_handicap'         #\n"
+                 "# parameters are only used if feedback is activated.       #\n"
+                 "############################################################\n\n");
+  }
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# Number of comets for first wave. Default is 2.\n");
+  }
+  fprintf(fp, "starting_comets = %d\n", game_options->starting_comets);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# Comets to add for each successive wave. Default is 2.\n");
+  }
+  fprintf(fp, "extra_comets_per_wave = %d\n", game_options->extra_comets_per_wave);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# Maximum number of comets. Default is 10.\n");
+  }
+  fprintf(fp, "max_comets = %d\n", game_options->max_comets);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# Starting comet speed. Default is 1.\n");
+  }
+  fprintf(fp, "speed = %f\n", game_options->speed);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# Maximum speed. Default is 10.\n");
+  }
+  fprintf(fp, "max_speed = %f\n", game_options->max_speed);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# 'speedup_factor': If feedback is not used but \n"
+                 "# 'allow_speedup' is enabled, the comet speed will be\n"
+                 "# multiplied by this factor with each new wave.\n"
+                 "# Default is 1.2 (i.e. 20 percent increase per wave)\n\n");
+  }
+  fprintf(fp, "speedup_factor = %f\n", game_options->speedup_factor);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n# 'slow_after_wrong' tells Tuxmath to go back to  \n"
+                 "# starting speed and number of comets if the player misses \n"
+                 "# a question. Useful for smaller kids. Default is 0.\n\n");
+  }
+
+  fprintf(fp, "slow_after_wrong = %d\n", game_options->slow_after_wrong);
+
+
+  if(verbose)
+  {
+     fprintf (fp, "\n# (Feedback) Set the desired danger level.\n"
+             "# 0 = too safe, comets typically exploded at the very top\n"
+             "# 1 = too dangerous, comets typically exploded as they\n"
+             "# hit cities. Set it somewhere between these extremes. As\n"
+             "# a guideline, early elementary kids might prefer\n"
+             "# 0.2-0.3, older kids at around 0.4-0.6. Default 0.35.\n\n");
+  }
+  fprintf(fp, "danger_level = %f\n", game_options->danger_level);
+
+  if(verbose)
+  {
+     fprintf (fp, "\n# (Feedback) Set danger level speedup.\n"
+                  "# The margin of safety will decrease by this factor each\n"
+                  "# wave. Default 1.1. Note 1 = no increase in danger level.\n\n");
+  }
+  fprintf(fp, "danger_level_speedup = %f\n", game_options->danger_level_speedup);
+
+  if(verbose)
+  {
+     fprintf (fp, "\n# (Feedback) Set the maximum danger level.\n"
+                  "# Default 0.9.\n");
+  }
+  fprintf(fp, "danger_level_max = %f\n", game_options->danger_level_max);
+
+  if (verbose)
+  { 
+     fprintf (fp, "\n# (Feedback) Set the handicap for hitting cities.\n"
+                  "# When bigger than 0, this causes the game to slow down\n"
+                  "# by an extra amount after a wave in which one or more\n"
+                  "# cities get hit. Note that this is similar to\n"
+                  "# 'slow_after_wrong', but allows for more gradual\n"
+                  "# changes. Default 0 (no extra handicap).\n\n");
+  }
+  fprintf(fp, "city_explode_handicap = %f\n", game_options->city_expl_handicap);
+
+  if(verbose)
+  {
+    fprintf (fp, "\n\n############################################################\n" 
+                 "#                                                          #\n"
+                 "#                 Restricting User Settings                #\n"
+                 "#                                                          #\n"
+                 "# Parameter: per_user_config (boolean)                     #\n"
+                 "# Default: 1                                               #\n"
+                 "#                                                          #\n"
+                 "# 'per_user_config' determines whether Tuxmath will look   #\n"
+                 "# in the user's home directory for settings. Default is 1  #\n"
+                 "# (yes). If set to 0, the program will ignore the user's   #\n"
+                 "# .tuxmath file and use the the global settings in the     #\n"
+                 "# installation-wide config file.                           #\n"
+                 "#                                                          #\n"
+                 "# This setting cannot be changed by an ordinary user, i.e. #\n"
+                 "# it is ignored unless the config file is Tuxmath's global #\n"
+                 "# config file. Thus, users cannot 'lock themselves out'    #\n"
+                 "# by accidentally setting this to 0.                       #\n"
+                 "############################################################\n\n");
+  }
+  fprintf(fp, "per_user_config = %d\n", game_options->per_user_config);
+
+
   /* print general game options (passing '1' as second arg causes */
   /* "help" info for each option to be written to file as comments) */
-  print_game_options(fp, 1);
+//  print_game_options(fp, 1);
   /* print options pertaining to math questions from MathCards: */
-  MC_PrintMathOptions(fp, 1);
+//  MC_PrintMathOptions(fp, 1);
 
   #ifdef TUXMATH_DEBUG
   printf("Leaving write_config_file()\n");
@@ -1116,12 +1645,7 @@
   }
   fprintf(fp, "allow_speedup = %d\n", game_options->allow_speedup);
 
-  if(verbose)
-  {
-    fprintf (fp, "\n# This option tells Tuxmath to go back to starting speed \n"
-                 "# and number of comets if the player misses a question\n"
-                 "# Useful for smaller kids. Default is 0.\n");
-  }
+
   fprintf(fp, "slow_after_wrong = %d\n", game_options->slow_after_wrong);
 
   if(verbose)
@@ -1169,20 +1693,7 @@
   }
   fprintf(fp, "use_feedback = %d\n", game_options->use_feedback);
 
-  if(verbose)
-  {
-    fprintf (fp, "\n# (Non-feedback) Speed is multiplied by this factor\n"
-                 "# with each new wave. Default is 1.2.\n");
-  }
-  fprintf(fp, "speedup_factor = %f\n", game_options->speedup_factor);
 
-  if(verbose)
-  {
-    fprintf (fp, "\n# Go back to starting speed and number of comets if player\n"
-                  "# misses a question. Useful for smaller kids. Default is 0.\n");
-   }
-   fprintf(fp, "slow_after_wrong = %d\n", game_options->slow_after_wrong);
-
    if(verbose)
    {
      fprintf (fp, "\n# (Feedback) Set the desired danger level.\n"
@@ -1239,7 +1750,8 @@
   if ((0 == strcasecmp(val, "true"))
     ||(0 == strcasecmp(val, "t"))
     ||(0 == strcasecmp(val, "yes"))
-    ||(0 == strcasecmp(val, "y")))
+    ||(0 == strcasecmp(val, "y"))
+    ||(0 == strcasecmp(val, "on")))
   {
     return 1;
   }
@@ -1247,7 +1759,8 @@
   if ((0 == strcasecmp(val, "false"))
     ||(0 == strcasecmp(val, "f"))
     ||(0 == strcasecmp(val, "no"))
-    ||(0 == strcasecmp(val, "n")))
+    ||(0 == strcasecmp(val, "n"))
+    ||(0 == strcasecmp(val, "off")))
   {
     return 0;
   }  

Modified: tuxmath/trunk/src/fileops.h
===================================================================
--- tuxmath/trunk/src/fileops.h	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/fileops.h	2006-09-20 11:48:50 UTC (rev 28)
@@ -169,7 +169,7 @@
 
 /* FIXME these will probably become "local" functions: */
 int read_config_file(FILE* fp, int file_type);
-int write_config_file(FILE* fp);
+int write_config_file(FILE* fp, int verbose);
 void print_game_options(FILE* fp, int verbose);
 
 int load_image_data();

Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/game.c	2006-09-20 11:48:50 UTC (rev 28)
@@ -256,6 +256,7 @@
             looping = 0;
           }   
         }
+
         if (bkgd)
           SDL_BlitSurface(bkgd, NULL, screen, NULL);
 
@@ -365,6 +366,7 @@
   if (bkgd != NULL)
   {
     SDL_FreeSurface(bkgd);
+    bkgd = NULL;
   }
 
   /* Stop music: */
@@ -1206,12 +1208,12 @@
   digits[2] = 0;
   neg_answer_picked = 0;
 
+
+
   /* Load random background image: */
-
   do
   {
     /* Don't pick the same one as last time... */
-
     i = rand() % NUM_BKGDS;
   }
   while (i == last_bkgd);
@@ -1221,9 +1223,11 @@
   sprintf(fname, "%s/images/backgrounds/%d.jpg", DATA_PREFIX, i);
 
   if (bkgd != NULL)
+  {
     SDL_FreeSurface(bkgd);
+    bkgd = NULL;
+  }
 
-  
   if (game_options->use_bkgd)
   {
     bkgd = IMG_Load(fname);
@@ -1250,12 +1254,6 @@
   if (wave == 1 || slowdown)
   {
     next_wave_comets = game_options->starting_comets;
-
-    /* NOTE: not sure this really goes here: */
-    prev_wave_comets = next_wave_comets;
-    comet_feedback_number = 0;
-    comet_feedback_height = 0;
-
     speed = game_options->speed;
     slowdown = 0;
   }
@@ -1263,7 +1261,7 @@
   else /* Otherwise increase comets and speed if selected, not to */
        /* exceed maximum:                                         */
   {
-    next_wave_comets = prev_wave_comets; /* here's the important fix */
+    next_wave_comets = prev_wave_comets;
     if (game_options->allow_speedup)
     {
       next_wave_comets += game_options->extra_comets_per_wave;
@@ -1343,6 +1341,11 @@
       }
     }
   }
+
+  comet_feedback_number = 0;
+  comet_feedback_height = 0;
+
+  prev_wave_comets = next_wave_comets;
   num_attackers = prev_wave_comets;
 }
 
@@ -2119,7 +2122,7 @@
 void reset_comets(void)
 {
   int i =0;
-  for (i = 0; i < game_options->max_comets; i++)
+  for (i = 0; i < MAX_COMETS; i++)
   {
     comets[i].alive = 0;
     comets[i].expl = 0;

Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/mathcards.c	2006-09-20 11:48:50 UTC (rev 28)
@@ -1184,6 +1184,18 @@
   return math_opts->max_answer;
 }
 
+
+int MC_MaxQuestions(void)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_MaxQuestions(): math_opts not valid!\n");
+    return MC_MATH_OPTS_INVALID;
+  }
+  return math_opts->max_questions;
+}
+
+
 int MC_AllowNegatives(void)
 {
   if (!math_opts)

Modified: tuxmath/trunk/src/mathcards.h
===================================================================
--- tuxmath/trunk/src/mathcards.h	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/mathcards.h	2006-09-20 11:48:50 UTC (rev 28)
@@ -101,7 +101,7 @@
 #define DEFAULT_REPEAT_WRONGS   1         /* reuse incorrectly answered questions or not */
 #define DEFAULT_COPIES_REPEATED_WRONGS 1  /* how many copies of an incorrectly answered */                                                                              /* question to re-insert*/
 #define DEFAULT_ALLOW_NEGATIVES 0
-#define DEFAULT_MAX_ANSWER 144
+#define DEFAULT_MAX_ANSWER 999
 #define DEFAULT_MAX_QUESTIONS 5000
 #define DEFAULT_QUESTION_COPIES 1         /* how many times each question is put in list */
 #define DEFAULT_RANDOMIZE 1               /* whether to shuffle cards */
@@ -325,6 +325,7 @@
 int MC_RepeatWrongs(void);
 int MC_CopiesRepeatedWrongs(void);
 int MC_MaxAnswer(void);
+int MC_MaxQuestions(void);
 int MC_AllowNegatives(void);
 int MC_QuestionCopies(void);         /* how many times each question is put in list */
 int MC_Randomize(void);         

Modified: tuxmath/trunk/src/tuxmath.h
===================================================================
--- tuxmath/trunk/src/tuxmath.h	2006-09-11 10:27:22 UTC (rev 27)
+++ tuxmath/trunk/src/tuxmath.h	2006-09-20 11:48:50 UTC (rev 28)
@@ -32,7 +32,7 @@
 //#define TUXMATH_DEBUG   /* for conditional compilation of debugging output */
 //#define FEEDBACK_DEBUG  /* for Tim's feedback speed control code           */
 
-#define TUXMATH_VERSION 0.93
+#define TUXMATH_VERSION 0.95
 
 #define PATH_MAX 4096
 




More information about the Tux4kids-commits mailing list