[Tux4kids-commits] r567 - in tuxmath/branches/mathcards_newarch: data/missions/arcade src

cheezmeister-guest at alioth.debian.org cheezmeister-guest at alioth.debian.org
Thu Jul 10 03:20:05 UTC 2008


Author: cheezmeister-guest
Date: 2008-07-10 03:20:04 +0000 (Thu, 10 Jul 2008)
New Revision: 567

Added:
   tuxmath/branches/mathcards_newarch/data/missions/arcade/commando
Modified:
   tuxmath/branches/mathcards_newarch/data/missions/arcade/ace
   tuxmath/branches/mathcards_newarch/data/missions/arcade/ranger
   tuxmath/branches/mathcards_newarch/data/missions/arcade/scout
   tuxmath/branches/mathcards_newarch/data/missions/arcade/space_cadet
   tuxmath/branches/mathcards_newarch/src/game.c
   tuxmath/branches/mathcards_newarch/src/highscore.c
   tuxmath/branches/mathcards_newarch/src/mathcards.c
   tuxmath/branches/mathcards_newarch/src/mathcards.h
   tuxmath/branches/mathcards_newarch/src/titlescreen.c
   tuxmath/branches/mathcards_newarch/src/tuxmath.h
Log:
Branch: More work cleaning up new functionality. Commando difficulty 
added for multiple operand questions.


Modified: tuxmath/branches/mathcards_newarch/data/missions/arcade/ace
===================================================================
--- tuxmath/branches/mathcards_newarch/data/missions/arcade/ace	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/data/missions/arcade/ace	2008-07-10 03:20:04 UTC (rev 567)
@@ -8,6 +8,8 @@
 multiplication_allowed = 1
 division_allowed = 1
 allow_negatives = 1
+max_formula_nums = 2
+min_formula_nums = 2
 min_augend = -20
 max_augend = 20
 min_addend = -20

Added: tuxmath/branches/mathcards_newarch/data/missions/arcade/commando
===================================================================
--- tuxmath/branches/mathcards_newarch/data/missions/arcade/commando	                        (rev 0)
+++ tuxmath/branches/mathcards_newarch/data/missions/arcade/commando	2008-07-10 03:20:04 UTC (rev 567)
@@ -0,0 +1,61 @@
+# arcade commando lesson file
+
+play_through_list = 0
+allow_speedup = 1
+use_feedback = 0
+addition_allowed = 1
+subtraction_allowed = 1
+multiplication_allowed = 1
+division_allowed = 1
+allow_negatives = 1
+min_formula_nums = 3
+max_formula_nums = 4
+min_augend = -20
+max_augend = 20
+min_addend = -20
+max_addend = 20
+min_minuend = -20
+max_minuend = 20
+min_subtrahend = 0
+max_subtrahend = 20
+min_multiplier = -20
+max_multiplier = 20
+min_multiplicand = -20
+max_multiplicand = 20
+min_divisor = -20
+max_divisor = 20
+min_quotient = -20
+max_quotient = 20
+use_bkgd = 1
+demo_mode = 0
+save_summary = 1
+question_copies = 1
+repeat_wrongs = 1
+copies_repeated_wrongs = 1
+format_add_answer_last = 1
+format_add_answer_first = 1
+format_add_answer_middle = 1
+format_sub_answer_last = 1
+format_sub_answer_first = 1
+format_sub_answer_middle = 1
+format_mult_answer_last = 1
+format_mult_answer_first = 1
+format_mult_answer_middle = 1
+format_div_answer_last = 1
+format_div_answer_first = 1
+format_div_answer_middle = 1
+randomize = 1
+max_answer = 400
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 0.25
+max_speed = 10.00
+speedup_factor = 1.125
+slow_after_wrong = 0
+max_questions = 25000
+bonus_comet_interval = 20
+fraction_to_keep = 1
+allow_pause = 0
+bonus_speed_ratio = 2.0
+

Modified: tuxmath/branches/mathcards_newarch/data/missions/arcade/ranger
===================================================================
--- tuxmath/branches/mathcards_newarch/data/missions/arcade/ranger	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/data/missions/arcade/ranger	2008-07-10 03:20:04 UTC (rev 567)
@@ -8,6 +8,8 @@
 multiplication_allowed = 1
 division_allowed = 1
 allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 3
 min_augend = 0
 max_augend = 20
 min_addend = 0

Modified: tuxmath/branches/mathcards_newarch/data/missions/arcade/scout
===================================================================
--- tuxmath/branches/mathcards_newarch/data/missions/arcade/scout	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/data/missions/arcade/scout	2008-07-10 03:20:04 UTC (rev 567)
@@ -8,6 +8,8 @@
 multiplication_allowed = 0
 division_allowed = 0
 allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 2
 min_augend = 0
 max_augend = 10
 min_addend = 0

Modified: tuxmath/branches/mathcards_newarch/data/missions/arcade/space_cadet
===================================================================
--- tuxmath/branches/mathcards_newarch/data/missions/arcade/space_cadet	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/data/missions/arcade/space_cadet	2008-07-10 03:20:04 UTC (rev 567)
@@ -8,6 +8,8 @@
 multiplication_allowed = 0
 division_allowed = 0
 allow_negatives = 0
+max_formula_nums = 2
+min_formula_nums = 2
 min_augend = 0
 max_augend = 10
 min_addend = 0

Modified: tuxmath/branches/mathcards_newarch/src/game.c
===================================================================
--- tuxmath/branches/mathcards_newarch/src/game.c	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/game.c	2008-07-10 03:20:04 UTC (rev 567)
@@ -490,7 +490,6 @@
     return 0;
   }
 
-
   /* Allocate memory */
   comets = NULL;  // set in case allocation fails partway through
   cities = NULL;
@@ -1059,7 +1058,7 @@
 
 void game_handle_answer(void)
 {
-  int i, j, num, lowest, lowest_y;
+  int i, j, lowest, lowest_y;
   char ans[MAX_DIGITS+2]; //extra space for negative, and for final '\0'
   Uint32 ctime;
 
@@ -1858,7 +1857,7 @@
 void game_draw_comets(void)
 {
 
-  int i,j, img, max_layer,offset;
+  int i, img;
   SDL_Rect dest;
   char* comet_str;
 
@@ -3363,7 +3362,7 @@
 {
   int i;
   for (i = 0; i < MAX_MAX_COMETS; ++i)
-    MC_FreeFlashcard(&comets[i].flashcard);
+    MC_FreeFlashcard(&(comets[i].flashcard));
   free(comets);
   free(cities);
   free(penguins);

Modified: tuxmath/branches/mathcards_newarch/src/highscore.c
===================================================================
--- tuxmath/branches/mathcards_newarch/src/highscore.c	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/highscore.c	2008-07-10 03:20:04 UTC (rev 567)
@@ -777,7 +777,7 @@
 {
   /* Make sure diff_level is valid: */
   if (diff_level < 0
-   || diff_level > ACE_HIGH_SCORE)
+   || diff_level > COMMANDO_HIGH_SCORE)
   {
     fprintf(stderr, "In HS_Score(), diff_level invalid!\n");
     return -1;

Modified: tuxmath/branches/mathcards_newarch/src/mathcards.c
===================================================================
--- tuxmath/branches/mathcards_newarch/src/mathcards.c	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/mathcards.c	2008-07-10 03:20:04 UTC (rev 567)
@@ -25,12 +25,12 @@
 
 const char* const MC_OPTION_TEXT[NOPTS+1] = {
 "PLAY_THROUGH_LIST",
+"QUESTION_COPIES",
 "REPEAT_WRONGS",
 "COPIES_REPEATED_WRONGS",
 "ALLOW_NEGATIVES",
 "MAX_ANSWER",
 "MAX_QUESTIONS",
-"QUESTION_COPIES",
 "MAX_FORMULA_NUMS",
 "MIN_FORMULA_NUMS",
 
@@ -55,6 +55,7 @@
 "MULTIPLICATION_ALLOWED",
 "DIVISION_ALLOWED",
 "TYPING_PRACTICE_ALLOWED",
+"COMPARISON_ALLOWED",
 
 "MIN_AUGEND",
 "MAX_AUGEND",
@@ -89,14 +90,14 @@
 
 const int MC_DEFAULTS[] = {
   1,    //PLAY_THROUGH_LIST         
+  1,    //QUESTION_COPIES           
   1,    //REPEAT_WRONGS             
   1,    //COPIES_REPEATED_WRONGS    
   0,    //ALLOW_NEGATIVES           
   999,  //MAX_ANSWER                
   5000, //MAX_QUESTIONS             
-  1,    //QUESTION_COPIES           
-  3,    //MAX_FORMULA_NUMS          
-  3,    //MIN_FORMULA_NUMS          
+  2,    //MAX_FORMULA_NUMS          
+  2,    //MIN_FORMULA_NUMS          
         //                          
   1,    //FORMAT_ANSWER_LAST        
   0,    //FORMAT_ANSWER_FIRST       
@@ -119,7 +120,8 @@
   1,    //MULTIPLICATION_ALLOWED    
   1,    //DIVISION_ALLOWED          
   0,    //TYPING_PRACTICE_ALLOWED   
-        //                          
+  0,    //COMPARISON_ALLOWED
+        //
   0,    //MIN_AUGEND                
   12,   //MAX_AUGEND                
   0,    //MIN_ADDEND                
@@ -144,6 +146,7 @@
   12,   //MAX_TYPING_NUM            
         //                          
   1,    //RANDOMIZE
+  
   100,  //AVG_LIST_LENGTH
   1     //VARY_LIST_LENGTH
 };                      
@@ -742,20 +745,120 @@
 void MC_PrintMathOptions(FILE* fp, int verbose)
 {
   int i, vcommentsprimed = 0;
-  static char* vcomments[NOPTS]; //comments when writing out verbose
+  //comments when writing out verbose...perhaps they can go somewhere less conspicuous
+  static char* vcomments[NOPTS]; 
   if (!vcommentsprimed) //we only want to initialize these once
   {
     vcommentsprimed = 1;
     for (i = 0; i < NOPTS; ++i)
       vcomments[i] = NULL;
-    //TODO place comments in the slots where they should be written
-    
+    vcomments[PLAY_THROUGH_LIST] = 
+      "\n############################################################\n"
+      "#                                                          #\n"
+      "#                  General Math Options                    #\n"
+      "#                                                          #\n"
+      "# If 'play_through_list' is true, Tuxmath will ask each    #\n"
+      "# question in an internally-generated list. The list is    #\n"
+      "# generated based on the question ranges selected below.   #\n"
+      "# The game ends when no questions remain.                  #\n"
+      "# If 'play_through_list' is false, the game continues      #\n"
+      "# until all cities are destroyed.                          #\n"
+      "# Default is 1 (i.e. 'true' or 'yes').                     #\n"
+      "#                                                          #\n"
+      "# 'question_copies' is the number of times each question   #\n"
+      "# will be asked. It can be 1 to 10 - Default is 1.         #\n"
+      "#                                                          #\n"
+      "# 'repeat_wrongs' tells Tuxmath whether to reinsert        #\n"
+      "# incorrectly answered questions into the list to be       #\n"
+      "# asked again. Default is 1 (yes).                         #\n"
+      "#                                                          #\n"
+      "# 'copies_repeated_wrongs' gives the number of times an    #\n"
+      "# incorrectly answered question will reappear. Default     #\n"
+      "# is 1.                                                    #\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";
+      
+    vcomments[FORMAT_ADD_ANSWER_LAST] =
+      "\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.                                         #\n"
+      "############################################################\n\n";
+      
+    vcomments[ALLOW_NEGATIVES] =   
+      "\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 (see below). If it   #\n"
+      "# is changed from 1 (yes) to 0 (no), any negative          #\n"
+      "# operand limits will be reset to 0.                       #\n"
+      "############################################################\n\n";
+      
+    vcomments[MAX_ANSWER] =   
+      "\n############################################################\n"
+      "# 'max_answer' is the largest absolute value allowed in    #\n"
+      "# any value in a question (not only the answer). Default   #\n"
+      "# is 144. It can be set as high as 999.                    #\n"
+      "############################################################\n\n";
+      
+    vcomments[MAX_QUESTIONS] =  
+      "\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";
+      
+    vcomments[RANDOMIZE] =   
+      "\n############################################################\n"
+      "# If 'randomize' selected, the list will be shuffled       #\n"    
+      "# at the start of the game.  Default is 1 (yes).           #\n"    
+      "############################################################\n\n";
+            
+    vcomments[ADDITION_ALLOWED] =   
+      "\n############################################################\n"
+      "#                                                          #\n"
+      "#                 Math Operations Allowed                  #\n"
+      "#                                                          #\n"
+      "# These options enable questions for each of the four math #\n"
+      "# operations.  All are 1 (yes) by default.                 #\n"
+      "############################################################\n\n";
+      
+    vcomments[MIN_AUGEND] = 
+      "\n############################################################\n"
+      "#                                                          #\n"
+      "#      Minimum and Maximum Values for Operand Ranges       #\n"
+      "#                                                          #\n"
+      "# Operand limits can be set to any integer up to the       #\n"
+      "# value of 'max_answer'.  If 'allow_negatives' is set to 1 #\n"
+      "# (yes), either negative or positive values can be used.   #\n"
+      "# Tuxmath will generate questions for every value in the   #\n"
+      "# specified range. The maximum must be greater than or     #\n"
+      "# equal to the corresponding minimum for any questions to  #\n"    
+      "# be generated for that operation.                         #\n"    
+      "############################################################\n\n";
+         
   }
   
   
-  #ifdef MC_DEBUG
-  printf("\nEntering MC_PrintMathOptions()\n");
-  #endif
+  mcdprintf("\nEntering MC_PrintMathOptions()\n");
 
   /* bail out if no struct */
   if (!math_opts)
@@ -763,190 +866,14 @@
     fprintf(stderr, "\nMath Options struct does not exist!\n");
     return;
   }
-#ifdef MC_USE_NEWARC
+
   for (i = 0; i < NOPTS; ++i)
     {
     if (verbose && vcomments[i] != NULL)
       fprintf(fp, vcomments[i]);
     fprintf(fp, "%s = %d\n", MC_OPTION_TEXT[i], math_opts->iopts[i]);
-    }
-  return;
-#endif
-
-  if (verbose)
-  {
-    fprintf (fp, "\n############################################################\n"
-                 "#                                                          #\n"
-                 "#                  General Math Options                    #\n"
-                 "#                                                          #\n"
-                 "# If 'play_through_list' is true, Tuxmath will ask each    #\n"
-                 "# question in an internally-generated list. The list is    #\n"
-                 "# generated based on the question ranges selected below.   #\n"
-                 "# The game ends when no questions remain.                  #\n"
-                 "# If 'play_through_list' is false, the game continues      #\n"
-                 "# until all cities are destroyed.                          #\n"
-                 "# Default is 1 (i.e. 'true' or 'yes').                     #\n"
-                 "#                                                          #\n"
-                 "# 'question_copies' is the number of times each question   #\n"
-                 "# will be asked. It can be 1 to 10 - Default is 1.         #\n"
-                 "#                                                          #\n"
-                 "# 'repeat_wrongs' tells Tuxmath whether to reinsert        #\n"
-                 "# incorrectly answered questions into the list to be       #\n"
-                 "# asked again. Default is 1 (yes).                         #\n"
-                 "#                                                          #\n"
-                 "# 'copies_repeated_wrongs' gives the number of times an    #\n"
-                 "# incorrectly answered question will reappear. Default     #\n"
-                 "# is 1.                                                    #\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, "play_through_list = %d\n", math_opts->iopts[PLAY_THROUGH_LIST]);
-  fprintf (fp, "question_copies = %d\n", math_opts->iopts[QUESTION_COPIES]);
-  fprintf (fp, "repeat_wrongs = %d\n", math_opts->iopts[REPEAT_WRONGS]);
-  fprintf (fp, "copies_repeated_wrongs = %d\n", math_opts->iopts[COPIES_REPEATED_WRONGS]);
-
-  if (verbose)
-  {
-    fprintf (fp, "\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.                                         #\n"
-                 "############################################################\n\n");
-  }  
-  fprintf (fp, "format_add_answer_last = %d\n", math_opts->iopts[FORMAT_ADD_ANSWER_LAST]);
-  fprintf (fp, "format_add_answer_first = %d\n", math_opts->iopts[FORMAT_ADD_ANSWER_FIRST]);
-  fprintf (fp, "format_add_answer_middle = %d\n", math_opts->iopts[FORMAT_ADD_ANSWER_MIDDLE]);
-  fprintf (fp, "format_sub_answer_last = %d\n", math_opts->iopts[FORMAT_SUB_ANSWER_LAST]);
-  fprintf (fp, "format_sub_answer_first = %d\n", math_opts->iopts[FORMAT_SUB_ANSWER_FIRST]);
-  fprintf (fp, "format_sub_answer_middle = %d\n", math_opts->iopts[FORMAT_SUB_ANSWER_MIDDLE]);
-  fprintf (fp, "format_mult_answer_last = %d\n", math_opts->iopts[FORMAT_MULT_ANSWER_LAST]);
-  fprintf (fp, "format_mult_answer_first = %d\n", math_opts->iopts[FORMAT_MULT_ANSWER_FIRST]);
-  fprintf (fp, "format_mult_answer_middle = %d\n", math_opts->iopts[FORMAT_MULT_ANSWER_MIDDLE]);
-  fprintf (fp, "format_div_answer_last = %d\n", math_opts->iopts[FORMAT_DIV_ANSWER_LAST]);
-  fprintf (fp, "format_div_answer_first = %d\n", math_opts->iopts[FORMAT_DIV_ANSWER_FIRST]);
-  fprintf (fp, "format_div_answer_middle = %d\n", math_opts->iopts[FORMAT_DIV_ANSWER_MIDDLE]);
-
-  if (verbose)
-  {
-    fprintf (fp, "\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 (see below). If it   #\n"
-                 "# is changed from 1 (yes) to 0 (no), any negative          #\n"
-                 "# operand limits will be reset to 0.                       #\n"
-                 "############################################################\n\n");
-  }  
-  fprintf (fp, "allow_negatives = %d\n", math_opts->iopts[ALLOW_NEGATIVES]);
-
-  if (verbose)
-  {
-    fprintf (fp, "\n############################################################\n"
-                 "# 'max_answer' is the largest absolute value allowed in    #\n"
-                 "# any value in a question (not only the answer). Default   #\n"
-                 "# is 144. It can be set as high as 999.                    #\n"
-                 "############################################################\n\n");
-  }  
-  fprintf (fp, "max_answer = %d\n", math_opts->iopts[MAX_ANSWER]);
-
-  if (verbose)
-  {
-    fprintf (fp, "\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", math_opts->iopts[MAX_QUESTIONS]);  
-
-  if (verbose)
-  {
-    fprintf (fp, "\n############################################################\n"
-                 "# If 'randomize' selected, the list will be shuffled       #\n"
-                 "# at the start of the game.  Default is 1 (yes).           #\n"
-                 "############################################################\n\n");
-  }
-  fprintf (fp, "randomize = %d\n", math_opts->iopts[RANDOMIZE]);
-
-  if (verbose)
-  {
-    fprintf (fp, "\n############################################################\n"
-                 "#                                                          #\n"
-                 "#                 Math Operations Allowed                  #\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", math_opts->iopts[ADDITION_ALLOWED]);
-  fprintf(fp, "subtraction_allowed = %d\n", math_opts->iopts[SUBTRACTION_ALLOWED]);
-  fprintf(fp, "multiplication_allowed = %d\n", math_opts->iopts[MULTIPLICATION_ALLOWED]);
-  fprintf(fp, "division_allowed = %d\n", math_opts->iopts[DIVISION_ALLOWED]);
-
-
-  if (verbose)
-  {
-    fprintf (fp, "\n############################################################\n"
-                 "#                                                          #\n"
-                 "#      Minimum and Maximum Values for Operand Ranges       #\n"
-                 "#                                                          #\n"
-                 "# Operand limits can be set to any integer up to the       #\n"
-                 "# value of 'max_answer'.  If 'allow_negatives' is set to 1 #\n"
-                 "# (yes), either negative or positive values can be used.   #\n"
-                 "# Tuxmath will generate questions for every value in the   #\n"
-                 "# specified range. The maximum must be greater than or     #\n"
-                 "# equal to the corresponding minimum for any questions to  #\n"
-                 "# be generated for that operation.                         #\n"
-                 "############################################################\n\n");
-  }
-  fprintf(fp, "\n# Addition operands: augend + addend = sum\n");
-  fprintf(fp, "min_augend = %d\n", math_opts->iopts[MIN_AUGEND]);
-  fprintf(fp, "max_augend = %d\n", math_opts->iopts[MAX_AUGEND]);
-  fprintf(fp, "min_addend = %d\n", math_opts->iopts[MIN_ADDEND]);
-  fprintf(fp, "max_addend = %d\n", math_opts->iopts[MAX_ADDEND]);
-
-  fprintf(fp, "\n# Subtraction operands: minuend - subtrahend = difference\n");
-  fprintf(fp, "min_minuend = %d\n", math_opts->iopts[MIN_MINUEND]);
-  fprintf(fp, "max_minuend = %d\n", math_opts->iopts[MAX_MINUEND]);
-  fprintf(fp, "min_subtrahend = %d\n", math_opts->iopts[MIN_SUBTRAHEND]);
-  fprintf(fp, "max_subtrahend = %d\n", math_opts->iopts[MAX_SUBTRAHEND]);
-
-  fprintf(fp, "\n# Multiplication operands: multiplier * multiplicand = product\n");
-  fprintf(fp, "min_multiplier = %d\n", math_opts->iopts[MIN_MULTIPLIER]);
-  fprintf(fp, "max_multiplier = %d\n", math_opts->iopts[MAX_MULTIPLIER]);
-  fprintf(fp, "min_multiplicand = %d\n", math_opts->iopts[MIN_MULTIPLICAND]);
-  fprintf(fp, "max_multiplicand = %d\n", math_opts->iopts[MAX_MULTIPLICAND]);
-
-  fprintf(fp, "\n# Division operands: dividend/divisor = quotient\n");
-  fprintf(fp, "min_divisor = %d\n",math_opts->iopts[MIN_DIVISOR]);
-  fprintf(fp, "max_divisor = %d\n", math_opts->iopts[MAX_DIVISOR]);
-  fprintf(fp, "min_quotient = %d\n", math_opts->iopts[MIN_QUOTIENT]);
-  fprintf(fp, "max_quotient = %d\n", math_opts->iopts[MAX_QUOTIENT]);
-
-  fprintf(fp, "\n# Typing practice:\n");
-  fprintf(fp, "min_typing_num = %d\n",math_opts->iopts[MIN_TYPING_NUM]);
-  fprintf(fp, "max_typing_num = %d\n",math_opts->iopts[MAX_TYPING_NUM]);
-
-  #ifdef MC_DEBUG
-  printf("\nLeaving MC_PrintMathOptions()\n");
-  #endif
+    }    
+  mcdprintf("\nLeaving MC_PrintMathOptions()\n");
 }
 
 
@@ -1069,382 +996,382 @@
     math_opts->iopts[MAX_TYPING_NUM] = 0;
 }
 
-/* using parameters from the mission struct, create linked list of "flashcards" */
-/* FIXME should figure out how to proceed correctly if we run out of memory */
-/* FIXME very redundant code - figure out way to iterate through different */
-/* math operations and question formats                                    */
-#ifndef MC_USE_NEWARC
-MC_MathQuestion* generate_list(void)
-{
-  MC_MathQuestion* top_of_list = NULL;
-  MC_MathQuestion* end_of_list = NULL;
-  MC_MathQuestion* tmp_ptr = NULL;
+///* using parameters from the mission struct, create linked list of "flashcards" */
+///* FIXME should figure out how to proceed correctly if we run out of memory */
+///* FIXME very redundant code - figure out way to iterate through different */
+///* math operations and question formats                                    */
+//#ifndef MC_USE_NEWARC
+//MC_MathQuestion* generate_list(void)
+//{
+//  MC_MathQuestion* top_of_list = NULL;
+//  MC_MathQuestion* end_of_list = NULL;
+//  MC_MathQuestion* tmp_ptr = NULL;
+//
+//  int i, j, k;
+//  int length = 0;
+//
+//  #ifdef MC_DEBUG
+//  printf("\nEntering generate_list()");
+//  MC_PrintMathOptions(stdout, 0);
+//  #endif
+// 
+//  /* add nodes for each math operation allowed */
+//
+//  #ifdef MC_DEBUG
+//  printf("\ngenerating addition questions\n");
+//  #endif
+//
+//  if (math_opts->iopts[ADDITION_ALLOWED])
+//  {
+//    #ifdef MC_DEBUG
+//    printf("\nAddition problems");
+//    #endif
+//    for (i = math_opts->iopts[MIN_AUGEND]; i <= math_opts->iopts[MAX_AUGEND]; i++)
+//    {
+//      for (j = math_opts->iopts[MIN_ADDEND]; j <= math_opts->iopts[MAX_ADDEND]; j++)
+//      {
+//        /* check if max_answer exceeded or if question */
+//        /* contains undesired negative values:         */
+//        if (validate_question(i, j, i + j))
+//        {  
+//          /* put in the desired number of copies: */
+//          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
+//          {
+//            /* put in questions in each selected format: */
+//
+//            /* questions like num1 + num2 = ? */
+//            if (math_opts->iopts[FORMAT_ADD_ANSWER_LAST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_LAST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like num1 + ? = num3 */
+//            if (math_opts->iopts[FORMAT_ADD_ANSWER_MIDDLE])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_MIDDLE);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like ? + num2 = num3 */
+//            if (math_opts->iopts[FORMAT_ADD_ANSWER_FIRST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_FIRST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//          }
+//        }
+//      }
+//    }
+//  }
+//
+//  #ifdef MC_DEBUG
+//  printf("generating subtraction questions\n");
+//  #endif
+//
+//  if (math_opts->iopts[SUBTRACTION_ALLOWED])
+//  {
+//    #ifdef MC_DEBUG
+//    printf("\nSubtraction problems");
+//    #endif
+//    for (i = math_opts->iopts[MIN_MINUEND]; i <= math_opts->iopts[MAX_MINUEND]; i++)
+//    {
+//      for (j = math_opts->iopts[MIN_SUBTRAHEND]; j <= math_opts->iopts[MAX_SUBTRAHEND]; j++)
+//      {
+//        /* check if max_answer exceeded or if question */
+//        /* contains undesired negative values:         */
+//        if (validate_question(i, j, i - j))
+//        {  
+//          /* put in the desired number of copies: */
+//          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
+//          {
+//            /* put in questions in each selected format: */
+//
+//            /* questions like num1 - num2 = ? */
+//            if (math_opts->iopts[FORMAT_SUB_ANSWER_LAST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_LAST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like num1 - ? = num3 */
+//            if (math_opts->iopts[FORMAT_SUB_ANSWER_MIDDLE])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_MIDDLE);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like ? - num2 = num3 */
+//            if (math_opts->iopts[FORMAT_SUB_ANSWER_FIRST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_FIRST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//          }
+//        }
+//      }
+//    }
+//  }
+//
+//  #ifdef MC_DEBUG
+//  printf("generating multiplication questions\n");
+//  #endif
+//
+//  if (math_opts->iopts[MULTIPLICATION_ALLOWED])
+//  {
+//    #ifdef MC_DEBUG
+//    printf("\nMultiplication problems");
+//    #endif
+//    for (i = math_opts->iopts[MIN_MULTIPLIER]; i <= math_opts->iopts[MAX_MULTIPLIER]; i++)
+//    {
+//      for (j = math_opts->iopts[MIN_MULTIPLICAND]; j <= math_opts->iopts[MAX_MULTIPLICAND]; j++)
+//      {
+//        /* check if max_answer exceeded or if question */
+//        /* contains undesired negative values:         */
+//        if (validate_question(i, j, i * j))
+//        {  
+//          /* put in the desired number of copies: */
+//          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
+//          {
+//            /* put in questions in each selected format: */
+//
+//            /* questions like num1 x num2 = ? */
+//            if (math_opts->iopts[FORMAT_MULT_ANSWER_LAST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_LAST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like num1 x ? = num3 */
+//            /* (no questions like 0 x ? = 0) because answer indeterminate */
+//            if ((math_opts->iopts[FORMAT_MULT_ANSWER_MIDDLE])
+//             && (i != 0)) 
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_MIDDLE);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like ? x num2 = num3 */
+//            /* (no questions like ? X 0 = 0) because answer indeterminate */
+//            if ((math_opts->iopts[FORMAT_MULT_ANSWER_FIRST])
+//             && (j != 0))
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_FIRST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//          }
+//        }
+//      }
+//    }
+//  }
+//
+//  #ifdef MC_DEBUG
+//  printf("generating division questions\n");
+//  #endif
+//
+//  if (math_opts->iopts[DIVISION_ALLOWED])
+//  {
+//    #ifdef MC_DEBUG
+//    printf("\nDivision problems");
+//    #endif
+//    for (i = math_opts->iopts[MIN_QUOTIENT]; i <= math_opts->iopts[MAX_QUOTIENT]; i++)
+//    {
+//      for (j = math_opts->iopts[MIN_DIVISOR]; j <= math_opts->iopts[MAX_DIVISOR]; j++)
+//      {
+//        /* check if max_answer exceeded or if question */
+//        /* contains undesired negative values:         */
+//        if (j                                     /* must avoid division by zero: */      
+//            &&
+//            validate_question(i * j, j, i))       /* division problems are generated as multiplication */
+//        {  
+//          /* put in the desired number of copies: */
+//          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
+//          {
+//            /* put in questions in each selected format: */
+//
+//            /* questions like num1 / num2 = ? */
+//            if (math_opts->iopts[FORMAT_DIV_ANSWER_LAST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_LAST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like num1 / ? = num3 */
+//            if ((math_opts->iopts[FORMAT_DIV_ANSWER_MIDDLE])
+//               && (i))      /* This avoids creating indeterminate questions: 0/? = 0 */
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_MIDDLE);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//
+//            /* questions like ? / num2  = num3 */
+//            if (math_opts->iopts[FORMAT_DIV_ANSWER_FIRST])
+//            {
+//              /* make sure max_questions not exceeded, */
+//              /* also check if question being randomly kept or discarded: */
+//              if ((length < math_opts->iopts[MAX_QUESTIONS])
+//                 && randomly_keep())
+//              {
+//                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_FIRST);
+//                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//                end_of_list = tmp_ptr;
+//                length++; 
+//              } 
+//            }
+//          }
+//        }
+//      }
+//    }
+//  }
+//
+//  #ifdef MC_DEBUG
+//  printf("generating typing practice questions\n");
+//  #endif
+//
+//  if (math_opts->iopts[TYPING_PRACTICE_ALLOWED])
+//  {
+//    #ifdef MC_DEBUG
+//    printf("\nTyping problems");
+//    #endif
+//    for (i = math_opts->iopts[MIN_TYPING_NUM]; i <= math_opts->iopts[MAX_TYPING_NUM]; i++)
+//    {
+//      /* check if max_answer exceeded or if question */
+//      /* contains undesired negative values:         */
+//      if (validate_question(i, i, i))
+//      {  
+//        /* put in the desired number of copies: */
+//        for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
+//        {
+//          /* make sure max_questions not exceeded, */
+//          /* also check if question being randomly kept or discarded: */
+//          if ((length < math_opts->iopts[MAX_QUESTIONS])
+//               && randomly_keep())
+//          {
+//            tmp_ptr = create_node(i, i, MC_OPER_TYPING_PRACTICE, i, MC_FORMAT_ANS_LAST);
+//            top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+//            end_of_list = tmp_ptr;
+//            length++; 
+//          } 
+//        }
+//      }
+//    }
+//  }
+//  #ifdef MC_DEBUG
+//  length = list_length(top_of_list); 
+//  printf("\nlength before randomization:\t%d", length); 
+//  #endif
+//
+//  /*  now shuffle list if desired: */
+//  if (math_opts->iopts[RANDOMIZE])
+//  {
+//    if(!randomize_list(&top_of_list))
+//    { 
+//      fprintf(stderr, "Error during list randomization!\n");
+//      return NULL;
+//    }
+//  }
+//
+//  #ifdef MC_DEBUG
+//  length = list_length(top_of_list); 
+//  printf("\nlength after randomization:\t%d", length); 
+//  printf("\nLeaving generate_list()\n");
+//  #endif
+//
+//  return top_of_list;
+//}
+//#endif
 
-  int i, j, k;
-  int length = 0;
-
-  #ifdef MC_DEBUG
-  printf("\nEntering generate_list()");
-  MC_PrintMathOptions(stdout, 0);
-  #endif
- 
-  /* add nodes for each math operation allowed */
-
-  #ifdef MC_DEBUG
-  printf("\ngenerating addition questions\n");
-  #endif
-
-  if (math_opts->iopts[ADDITION_ALLOWED])
-  {
-    #ifdef MC_DEBUG
-    printf("\nAddition problems");
-    #endif
-    for (i = math_opts->iopts[MIN_AUGEND]; i <= math_opts->iopts[MAX_AUGEND]; i++)
-    {
-      for (j = math_opts->iopts[MIN_ADDEND]; j <= math_opts->iopts[MAX_ADDEND]; j++)
-      {
-        /* check if max_answer exceeded or if question */
-        /* contains undesired negative values:         */
-        if (validate_question(i, j, i + j))
-        {  
-          /* put in the desired number of copies: */
-          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
-          {
-            /* put in questions in each selected format: */
-
-            /* questions like num1 + num2 = ? */
-            if (math_opts->iopts[FORMAT_ADD_ANSWER_LAST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_LAST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like num1 + ? = num3 */
-            if (math_opts->iopts[FORMAT_ADD_ANSWER_MIDDLE])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_MIDDLE);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like ? + num2 = num3 */
-            if (math_opts->iopts[FORMAT_ADD_ANSWER_FIRST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_ADD, i + j, MC_FORMAT_ANS_FIRST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-          }
-        }
-      }
-    }
-  }
-
-  #ifdef MC_DEBUG
-  printf("generating subtraction questions\n");
-  #endif
-
-  if (math_opts->iopts[SUBTRACTION_ALLOWED])
-  {
-    #ifdef MC_DEBUG
-    printf("\nSubtraction problems");
-    #endif
-    for (i = math_opts->iopts[MIN_MINUEND]; i <= math_opts->iopts[MAX_MINUEND]; i++)
-    {
-      for (j = math_opts->iopts[MIN_SUBTRAHEND]; j <= math_opts->iopts[MAX_SUBTRAHEND]; j++)
-      {
-        /* check if max_answer exceeded or if question */
-        /* contains undesired negative values:         */
-        if (validate_question(i, j, i - j))
-        {  
-          /* put in the desired number of copies: */
-          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
-          {
-            /* put in questions in each selected format: */
-
-            /* questions like num1 - num2 = ? */
-            if (math_opts->iopts[FORMAT_SUB_ANSWER_LAST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_LAST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like num1 - ? = num3 */
-            if (math_opts->iopts[FORMAT_SUB_ANSWER_MIDDLE])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_MIDDLE);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like ? - num2 = num3 */
-            if (math_opts->iopts[FORMAT_SUB_ANSWER_FIRST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_SUB, i - j, MC_FORMAT_ANS_FIRST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-          }
-        }
-      }
-    }
-  }
-
-  #ifdef MC_DEBUG
-  printf("generating multiplication questions\n");
-  #endif
-
-  if (math_opts->iopts[MULTIPLICATION_ALLOWED])
-  {
-    #ifdef MC_DEBUG
-    printf("\nMultiplication problems");
-    #endif
-    for (i = math_opts->iopts[MIN_MULTIPLIER]; i <= math_opts->iopts[MAX_MULTIPLIER]; i++)
-    {
-      for (j = math_opts->iopts[MIN_MULTIPLICAND]; j <= math_opts->iopts[MAX_MULTIPLICAND]; j++)
-      {
-        /* check if max_answer exceeded or if question */
-        /* contains undesired negative values:         */
-        if (validate_question(i, j, i * j))
-        {  
-          /* put in the desired number of copies: */
-          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
-          {
-            /* put in questions in each selected format: */
-
-            /* questions like num1 x num2 = ? */
-            if (math_opts->iopts[FORMAT_MULT_ANSWER_LAST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_LAST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like num1 x ? = num3 */
-            /* (no questions like 0 x ? = 0) because answer indeterminate */
-            if ((math_opts->iopts[FORMAT_MULT_ANSWER_MIDDLE])
-             && (i != 0)) 
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_MIDDLE);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like ? x num2 = num3 */
-            /* (no questions like ? X 0 = 0) because answer indeterminate */
-            if ((math_opts->iopts[FORMAT_MULT_ANSWER_FIRST])
-             && (j != 0))
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i, j, MC_OPER_MULT, i * j, MC_FORMAT_ANS_FIRST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-          }
-        }
-      }
-    }
-  }
-
-  #ifdef MC_DEBUG
-  printf("generating division questions\n");
-  #endif
-
-  if (math_opts->iopts[DIVISION_ALLOWED])
-  {
-    #ifdef MC_DEBUG
-    printf("\nDivision problems");
-    #endif
-    for (i = math_opts->iopts[MIN_QUOTIENT]; i <= math_opts->iopts[MAX_QUOTIENT]; i++)
-    {
-      for (j = math_opts->iopts[MIN_DIVISOR]; j <= math_opts->iopts[MAX_DIVISOR]; j++)
-      {
-        /* check if max_answer exceeded or if question */
-        /* contains undesired negative values:         */
-        if (j                                     /* must avoid division by zero: */      
-            &&
-            validate_question(i * j, j, i))       /* division problems are generated as multiplication */
-        {  
-          /* put in the desired number of copies: */
-          for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
-          {
-            /* put in questions in each selected format: */
-
-            /* questions like num1 / num2 = ? */
-            if (math_opts->iopts[FORMAT_DIV_ANSWER_LAST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_LAST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like num1 / ? = num3 */
-            if ((math_opts->iopts[FORMAT_DIV_ANSWER_MIDDLE])
-               && (i))      /* This avoids creating indeterminate questions: 0/? = 0 */
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_MIDDLE);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-
-            /* questions like ? / num2  = num3 */
-            if (math_opts->iopts[FORMAT_DIV_ANSWER_FIRST])
-            {
-              /* make sure max_questions not exceeded, */
-              /* also check if question being randomly kept or discarded: */
-              if ((length < math_opts->iopts[MAX_QUESTIONS])
-                 && randomly_keep())
-              {
-                tmp_ptr = create_node(i * j, j, MC_OPER_DIV, i, MC_FORMAT_ANS_FIRST);
-                top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-                end_of_list = tmp_ptr;
-                length++; 
-              } 
-            }
-          }
-        }
-      }
-    }
-  }
-
-  #ifdef MC_DEBUG
-  printf("generating typing practice questions\n");
-  #endif
-
-  if (math_opts->iopts[TYPING_PRACTICE_ALLOWED])
-  {
-    #ifdef MC_DEBUG
-    printf("\nTyping problems");
-    #endif
-    for (i = math_opts->iopts[MIN_TYPING_NUM]; i <= math_opts->iopts[MAX_TYPING_NUM]; i++)
-    {
-      /* check if max_answer exceeded or if question */
-      /* contains undesired negative values:         */
-      if (validate_question(i, i, i))
-      {  
-        /* put in the desired number of copies: */
-        for (k = 0; k < math_opts->iopts[QUESTION_COPIES]; k++)
-        {
-          /* make sure max_questions not exceeded, */
-          /* also check if question being randomly kept or discarded: */
-          if ((length < math_opts->iopts[MAX_QUESTIONS])
-               && randomly_keep())
-          {
-            tmp_ptr = create_node(i, i, MC_OPER_TYPING_PRACTICE, i, MC_FORMAT_ANS_LAST);
-            top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
-            end_of_list = tmp_ptr;
-            length++; 
-          } 
-        }
-      }
-    }
-  }
-  #ifdef MC_DEBUG
-  length = list_length(top_of_list); 
-  printf("\nlength before randomization:\t%d", length); 
-  #endif
-
-  /*  now shuffle list if desired: */
-  if (math_opts->iopts[RANDOMIZE])
-  {
-    if(!randomize_list(&top_of_list))
-    { 
-      fprintf(stderr, "Error during list randomization!\n");
-      return NULL;
-    }
-  }
-
-  #ifdef MC_DEBUG
-  length = list_length(top_of_list); 
-  printf("\nlength after randomization:\t%d", length); 
-  printf("\nLeaving generate_list()\n");
-  #endif
-
-  return top_of_list;
-}
-#endif
-
 /* this is used by generate_list to see if a possible question */
 /* meets criteria to be added to the list or not:              */
 int validate_question(int n1, int n2, int n3)
@@ -2055,6 +1982,8 @@
   
   mcdprintf("Entering generate_random_flashcard()\n");
   
+  
+  
   do
     pt = rand() % MC_NUM_PTYPES;
   while ( (pt == MC_PT_TYPING && !MC_GetOpt(TYPING_PRACTICE_ALLOWED) ) ||
@@ -2062,7 +1991,7 @@
                                    !MC_GetOpt(SUBTRACTION_ALLOWED) && 
                                    !MC_GetOpt(MULTIPLICATION_ALLOWED) && 
                                    !MC_GetOpt(DIVISION_ALLOWED) ) ||
-         pt == MC_PT_COMPARISON //&& !MC_GetOpt(COMPARISION_ALLOWED) 
+         pt == MC_PT_COMPARISON && !MC_GetOpt(COMPARISON_ALLOWED) 
          );
   
   if (pt == MC_PT_TYPING) //typing practice
@@ -2078,10 +2007,11 @@
   }
   else //if (pt == MC_PT_ARITHMETIC)
   {
+    mcdprintf("Generating arithmetic question");
     length = rand() % (MC_GetOpt(MAX_FORMULA_NUMS) -
                        MC_GetOpt(MIN_FORMULA_NUMS) + 1) //avoid div by 0
                     +  MC_GetOpt(MIN_FORMULA_NUMS);
-    mcdprintf("Generating question of length %d", length);
+    mcdprintf(" of length %d", length);
     ret = generate_random_ooo_card_of_length(length);
     strncat(ret.formula_string, " = ?", max_formula_size - strlen(ret.formula_string) );
     #ifdef MC_DEBUG
@@ -2242,6 +2172,15 @@
   MC_MathQuestion* end_of_list = NULL;
   MC_MathQuestion* tnode = NULL;
   
+  MC_PrintMathOptions(stdout, 0);
+  if (!(MC_GetOpt(ADDITION_ALLOWED) || //at least one type should be allowed
+      MC_GetOpt(SUBTRACTION_ALLOWED) ||
+      MC_GetOpt(MULTIPLICATION_ALLOWED) ||
+      MC_GetOpt(DIVISION_ALLOWED) ||
+      MC_GetOpt(TYPING_PRACTICE_ALLOWED) ||
+      MC_GetOpt(COMPARISON_ALLOWED) ) )
+    return NULL;
+    
   //TODO handle AVG_LIST_LENGTH = 0, i.e. generate all valid questions
   //TODO randomize list length
   

Modified: tuxmath/branches/mathcards_newarch/src/mathcards.h
===================================================================
--- tuxmath/branches/mathcards_newarch/src/mathcards.h	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/mathcards.h	2008-07-10 03:20:04 UTC (rev 567)
@@ -55,70 +55,72 @@
 be necessary to add to this list, the list of text, and the list of 
 defaults. (Besides actually using the new options!)
 */
+enum {
+  NOT_VALID_OPTION = -1     ,
+  PLAY_THROUGH_LIST = 0     , /* play until all questions answered correctly */
+  QUESTION_COPIES           , /* # times each question is put in list */
+  REPEAT_WRONGS             , /* reuse incorrectly answered questions or not */
+  COPIES_REPEATED_WRONGS    , /* how many copies of an incorrectly answered question to re-insert*/
+  ALLOW_NEGATIVES           , 
+  MAX_ANSWER                ,                                           
+  MAX_QUESTIONS             ,                                           
+  MAX_FORMULA_NUMS          ,                                           
+  MIN_FORMULA_NUMS          ,                                           
 
-#define NOT_VALID_OPTION          -1
-#define PLAY_THROUGH_LIST         0  /* play until all questions answered correctly */
-#define REPEAT_WRONGS             1  /* reuse incorrectly answered questions or not */
-#define COPIES_REPEATED_WRONGS    2  /* how many copies of an incorrectly answered question to re-insert*/
-#define ALLOW_NEGATIVES           3  
-#define MAX_ANSWER                4                                            
-#define MAX_QUESTIONS             5                                            
-#define QUESTION_COPIES           6  /* # times each question is put in list */
-#define MAX_FORMULA_NUMS          7                                            
-#define MIN_FORMULA_NUMS          8                                            
-                                                                               
-#define FORMAT_ANSWER_LAST        9  /* question format is: a + b = ? */
-#define FORMAT_ANSWER_FIRST       10 /* question format is: ? + b = c */
-#define FORMAT_ANSWER_MIDDLE      11 /* question format is: a + ? = c */
-#define FORMAT_ADD_ANSWER_LAST    12 /* a + b = ?    */
-#define FORMAT_ADD_ANSWER_FIRST   13 /* ? + b = c    */                           
-#define FORMAT_ADD_ANSWER_MIDDLE  14 /* a + ? = c    */                        
-#define FORMAT_SUB_ANSWER_LAST    15 /* a - b = ?    */
-#define FORMAT_SUB_ANSWER_FIRST   16 /* ? - b = c    */
-#define FORMAT_SUB_ANSWER_MIDDLE  17 /* a - ? = c    */
-#define FORMAT_MULT_ANSWER_LAST   18 /* a * b = ?    */
-#define FORMAT_MULT_ANSWER_FIRST  19 /* ? * b = c    */
-#define FORMAT_MULT_ANSWER_MIDDLE 20 /* a * ? = c    */
-#define FORMAT_DIV_ANSWER_LAST    21 /* a / b = ?    */
-#define FORMAT_DIV_ANSWER_FIRST   22 /* ? / b = c    */                           
-#define FORMAT_DIV_ANSWER_MIDDLE  23 /* a / ? = c    */                        
-                                                                               
-#define ADDITION_ALLOWED          24                                           
-#define SUBTRACTION_ALLOWED       25                                           
-#define MULTIPLICATION_ALLOWED    26                                           
-#define DIVISION_ALLOWED          27                                           
-#define TYPING_PRACTICE_ALLOWED   28                                           
-                                                                               
-#define MIN_AUGEND                29 /* augend + addend = sum */
-#define MAX_AUGEND                30                                           
-#define MIN_ADDEND                31                                           
-#define MAX_ADDEND                32                                           
-                                                                               
-#define MIN_MINUEND               33 /* minuend - subtrahend = difference */
-#define MAX_MINUEND               34                                           
-#define MIN_SUBTRAHEND            35                                           
-#define MAX_SUBTRAHEND            36                                           
-                                                                               
-#define MIN_MULTIPLIER            37 /* multiplier * multiplicand = product */
-#define MAX_MULTIPLIER            38                                           
-#define MIN_MULTIPLICAND          39  
-#define MAX_MULTIPLICAND          40                                           
-                                                                               
-#define MIN_DIVISOR               41 /* dividend/divisor = quotient */
-#define MAX_DIVISOR               42 /* note - generate_list() will prevent */
-#define MIN_QUOTIENT              43 /* questions with division by zero.    */
-#define MAX_QUOTIENT              44                                           
-                                                                               
-#define MIN_TYPING_NUM            45 /* range for "typing tutor" mode, for  */
-#define MAX_TYPING_NUM            46 /* kids just learning to use keyboard. */
-                                                                               
-#define RANDOMIZE                 47 /* whether to shuffle cards */            
+  FORMAT_ANSWER_LAST        , /* question format is: a + b = ? */
+  FORMAT_ANSWER_FIRST       , /* question format is: ? + b = c */
+  FORMAT_ANSWER_MIDDLE      , /* question format is: a + ? = c */
+  FORMAT_ADD_ANSWER_LAST    , /* a + b = ?    */
+  FORMAT_ADD_ANSWER_FIRST   , /* ? + b = c    */                           
+  FORMAT_ADD_ANSWER_MIDDLE  , /* a + ? = c    */                        
+  FORMAT_SUB_ANSWER_LAST    , /* a - b = ?    */
+  FORMAT_SUB_ANSWER_FIRST   , /* ? - b = c    */
+  FORMAT_SUB_ANSWER_MIDDLE  , /* a - ? = c    */
+  FORMAT_MULT_ANSWER_LAST   , /* a * b = ?    */
+  FORMAT_MULT_ANSWER_FIRST  , /* ? * b = c    */
+  FORMAT_MULT_ANSWER_MIDDLE , /* a * ? = c    */
+  FORMAT_DIV_ANSWER_LAST    , /* a / b = ?    */
+  FORMAT_DIV_ANSWER_FIRST   , /* ? / b = c    */                           
+  FORMAT_DIV_ANSWER_MIDDLE  , /* a / ? = c    */                        
 
-#define AVG_LIST_LENGTH           48 
-#define VARY_LIST_LENGTH          49
+  ADDITION_ALLOWED          ,                                           
+  SUBTRACTION_ALLOWED       ,                                           
+  MULTIPLICATION_ALLOWED    ,                                           
+  DIVISION_ALLOWED          ,                                           
+  TYPING_PRACTICE_ALLOWED   ,                                           
+  COMPARISON_ALLOWED        ,
 
-#define NOPTS                     50 
+  MIN_AUGEND                , /* augend + addend = sum */
+  MAX_AUGEND                ,                                           
+  MIN_ADDEND                ,                                           
+  MAX_ADDEND                ,                                           
 
+  MIN_MINUEND               , /* minuend - subtrahend = difference */
+  MAX_MINUEND               ,                                           
+  MIN_SUBTRAHEND            ,                                           
+  MAX_SUBTRAHEND            ,                                           
+
+  MIN_MULTIPLIER            , /* multiplier * multiplicand = product */
+  MAX_MULTIPLIER            ,                                           
+  MIN_MULTIPLICAND          ,  
+  MAX_MULTIPLICAND          ,                                           
+
+  MIN_DIVISOR               , /* dividend/divisor = quotient */
+  MAX_DIVISOR               , /* note - generate_list() will prevent */
+  MIN_QUOTIENT              , /* questions with division by zero.    */
+  MAX_QUOTIENT              ,                                           
+
+  MIN_TYPING_NUM            , /* range for "typing tutor" mode, for  */
+  MAX_TYPING_NUM            , /* kids just learning to use keyboard. */
+
+  RANDOMIZE                 , /* whether to shuffle cards */            
+
+  AVG_LIST_LENGTH           , 
+  VARY_LIST_LENGTH          ,
+
+  NOPTS                     
+};
+
 extern const char* const MC_OPTION_TEXT[];
 extern const int MC_DEFAULTS[];  
 extern const char operchars[MC_NUM_OPERS];

Modified: tuxmath/branches/mathcards_newarch/src/titlescreen.c
===================================================================
--- tuxmath/branches/mathcards_newarch/src/titlescreen.c	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/titlescreen.c	2008-07-10 03:20:04 UTC (rev 567)
@@ -712,19 +712,24 @@
 
 int run_arcade_menu(void)
 {
-  const unsigned char* menu_text[6] =
+  const unsigned char* menu_text[7] =
     {(const unsigned char*)N_("Space Cadet"),
      (const unsigned char*)N_("Scout"),
      (const unsigned char*)N_("Ranger"),
      (const unsigned char*)N_("Ace"),
+     (const unsigned char*)N_("Commando"),
      (const unsigned char*)N_("Hall Of Fame"),
      (const unsigned char*)N_("Main menu")};
-  const char* arcade_config_files[4] =
-    {"arcade/space_cadet", "arcade/scout", "arcade/ranger", "arcade/ace"};
-  const int arcade_high_score_tables[4] =
-    {CADET_HIGH_SCORE,SCOUT_HIGH_SCORE,RANGER_HIGH_SCORE,ACE_HIGH_SCORE};
-  sprite* sprites[6] =
-    {NULL, NULL, NULL, NULL, NULL, NULL};
+  const char* arcade_config_files[5] =
+    {"arcade/space_cadet", "arcade/scout", "arcade/ranger", "arcade/ace", 
+     "arcade/commando"
+    };
+  const int arcade_high_score_tables[5] =
+    {CADET_HIGH_SCORE,SCOUT_HIGH_SCORE,RANGER_HIGH_SCORE,ACE_HIGH_SCORE,
+     COMMANDO_HIGH_SCORE
+    };
+  sprite* sprites[7] =
+    {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
   menu_options menu_opts;
   int choice,hs_table;
 
@@ -733,18 +738,19 @@
   sprites[1] = sprite_list[SPRITE_SCOUT];
   sprites[2] = sprite_list[SPRITE_RANGER];
   sprites[3] = sprite_list[SPRITE_ACE];
-  sprites[4] = sprite_list[SPRITE_TROPHY];
-  sprites[5] = sprite_list[SPRITE_MAIN];
+  //TODO commando sprite
+  sprites[5] = sprite_list[SPRITE_TROPHY];
+  sprites[6] = sprite_list[SPRITE_MAIN];
 
 //  set_default_menu_options(&menu_opts);
 //  menu_opts.ytop = 100;
 
   //This function takes care of all the drawing and receives
   //user input:
-  choice = choose_menu_item(menu_text,sprites,6,NULL,NULL);
+  choice = choose_menu_item(menu_text,sprites,7,NULL,NULL);
 
   while (choice >= 0) {
-    if (choice < 4) {
+    if (choice < NUM_HIGH_SCORE_LEVELS) {
       // Play arcade game
       if (read_named_config_file(arcade_config_files[choice]))
       {
@@ -780,7 +786,7 @@
         fprintf(stderr, "\nCould not find %s config file\n",arcade_config_files[choice]);
       }
 
-    } else if (choice == 4) {
+    } else if (choice == NUM_HIGH_SCORE_LEVELS) {
       // Display the Hall of Fame
       DisplayHighScores(CADET_HIGH_SCORE);
     }

Modified: tuxmath/branches/mathcards_newarch/src/tuxmath.h
===================================================================
--- tuxmath/branches/mathcards_newarch/src/tuxmath.h	2008-07-10 02:20:25 UTC (rev 566)
+++ tuxmath/branches/mathcards_newarch/src/tuxmath.h	2008-07-10 03:20:04 UTC (rev 567)
@@ -124,6 +124,7 @@
   SCOUT_HIGH_SCORE,
   RANGER_HIGH_SCORE,
   ACE_HIGH_SCORE,
+  COMMANDO_HIGH_SCORE,
   NUM_HIGH_SCORE_LEVELS
 };
 




More information about the Tux4kids-commits mailing list