[Tux4kids-commits] r803 - tuxmath/trunk/src
dbruce-guest at alioth.debian.org
dbruce-guest at alioth.debian.org
Mon Dec 15 14:54:05 UTC 2008
Author: dbruce-guest
Date: 2008-12-15 14:54:05 +0000 (Mon, 15 Dec 2008)
New Revision: 803
Modified:
tuxmath/trunk/src/globals.h
tuxmath/trunk/src/mathcards.c
tuxmath/trunk/src/mathcards.h
tuxmath/trunk/src/titlescreen.c
Log:
mathcards stuff
Modified: tuxmath/trunk/src/globals.h
===================================================================
--- tuxmath/trunk/src/globals.h 2008-12-12 12:58:19 UTC (rev 802)
+++ tuxmath/trunk/src/globals.h 2008-12-15 14:54:05 UTC (rev 803)
@@ -27,7 +27,7 @@
#include "config.h"
/* for conditional compilation of debugging output */
-#define TUXMATH_DEBUG
+//#define TUXMATH_DEBUG
/* for Tim's feedback speed control code */
//#define FEEDBACK_DEBUG
/* nice inline debugging macro */
Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c 2008-12-12 12:58:19 UTC (rev 802)
+++ tuxmath/trunk/src/mathcards.c 2008-12-15 14:54:05 UTC (rev 803)
@@ -1601,9 +1601,9 @@
);
- mcdprintf("Constructing answer_string\n");
+// mcdprintf("Constructing answer_string\n");
snprintf(ret.answer_string, max_answer_size + 1, "%d", ans);
- mcdprintf("Constructing formula_string\n");
+// mcdprintf("Constructing formula_string\n");
snprintf(ret.formula_string, max_formula_size, "%d %c %d",
r1, operchars[op], r2);
ret.answer = ans;
@@ -1736,9 +1736,11 @@
if (MC_GetOpt(COMPREHENSIVE) ) //generate all
{
+ mcdprintf("In generate_list() - COMPREHENSIVE method requested\n");
+
for (i = MC_PT_TYPING; i < MC_NUM_PTYPES; ++i)
{
- if (!MC_GetOpt(i + TYPING_PRACTICE_ALLOWED) )
+ if (!MC_GetOpt(i + TYPING_PRACTICE_ALLOWED))
continue;
list = add_all_valid(i, list, end_of_list);
@@ -1787,6 +1789,8 @@
/* time until we have enough */
else
{
+ mcdprintf("In generate_list() - COMPREHENSIVE method NOT requested\n");
+
for (i = 0; i < length; ++i)
{
tnode = malloc(sizeof(MC_MathQuestion) );
@@ -1841,18 +1845,18 @@
{
if (!fc)
return;
- mcdprintf("Freeing formula_string\n");
+// mcdprintf("Freeing formula_string\n");
if (fc->formula_string)
- {
+ {
free(fc->formula_string);
fc->formula_string = NULL;
- }
- mcdprintf("Freeing answer_string\n");
+ }
+// mcdprintf("Freeing answer_string\n");
if (fc->answer_string)
- {
+ {
free(fc->answer_string);
fc->answer_string = NULL;
- }
+ }
}
unsigned int MC_MapTextToIndex(const char* text)
@@ -1866,10 +1870,8 @@
mcdprintf("'%s' isn't a math option\n", text);
return NOT_VALID_OPTION;
}
-//FIXME Yikes!! Now we can put insane values into our math_opts struct
-//without any error checking. We should either go back to the old
-//system of a simple Set() function for each setting, or institute
-//some safety checks - DSB
+
+
//TODO more intuitive function names for access by index vs. by text
void MC_SetOpt(unsigned int index, int val)
{
@@ -2150,6 +2152,7 @@
}
case MC_OPER_MULT:
{
+ mcdprintf("MC_OPER_MULT\n");
ans = i * j;
break;
}
@@ -2240,7 +2243,7 @@
// e.g. "0 x ? = 0"
if (k == MC_OPER_MULT && i == 0)
continue;
-
+
// e.g. "0 / ? = 0"
if (k == MC_OPER_DIV && i == 0)
{
Modified: tuxmath/trunk/src/mathcards.h
===================================================================
--- tuxmath/trunk/src/mathcards.h 2008-12-12 12:58:19 UTC (rev 802)
+++ tuxmath/trunk/src/mathcards.h 2008-12-15 14:54:05 UTC (rev 803)
@@ -15,7 +15,7 @@
#ifndef MATHCARDS_H
#define MATHCARDS_H
-//#define MC_DEBUG
+#define MC_DEBUG
#ifdef MC_DEBUG
#define mcdprintf(...) printf(__VA_ARGS__)
#else
@@ -69,6 +69,9 @@
MAX_FORMULA_NUMS ,
MIN_FORMULA_NUMS ,
+ //NOTE: Do _not_ rearrange the FORMAT values because the functions
+ //rely on index arithmetic to iterate through these, and will be
+ //broken if the relative position changes!
FORMAT_ANSWER_LAST , /* question format is: a + b = ? */
FORMAT_ANSWER_FIRST , /* question format is: ? + b = c */
FORMAT_ANSWER_MIDDLE , /* question format is: a + ? = c */
@@ -89,7 +92,7 @@
SUBTRACTION_ALLOWED ,
MULTIPLICATION_ALLOWED ,
DIVISION_ALLOWED ,
- TYPING_PRACTICE_ALLOWED ,
+ TYPING_PRACTICE_ALLOWED ,
ARITHMETIC_ALLOWED ,
COMPARISON_ALLOWED ,
@@ -114,15 +117,15 @@
MAX_QUOTIENT ,
MIN_TYPING_NUM , /* range for "typing tutor" mode, for */
- MAX_TYPING_NUM , /* kids just learning to use keyboard. */
-
- MIN_COMPARATOR , /* left comparison operand */
+ MAX_TYPING_NUM , /* kids just learning to use keyboard. */
+
+ MIN_COMPARATOR , /* left comparison operand */
MAX_COMPARATOR ,
- MIN_COMPARISAND , /* right comparison operannd */
- MAX_COMPARISAND ,
+ MIN_COMPARISAND , /* right comparison operannd */
+ MAX_COMPARISAND ,
RANDOMIZE , /* whether to shuffle cards */
-
+
COMPREHENSIVE , /* whether to generate all questions 'in order' */
AVG_LIST_LENGTH , /* the average number of questions in a list */
VARY_LIST_LENGTH , /* whether to randomly adjust list length */
Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c 2008-12-12 12:58:19 UTC (rev 802)
+++ tuxmath/trunk/src/titlescreen.c 2008-12-15 14:54:05 UTC (rev 803)
@@ -88,6 +88,7 @@
SPRITE_CREDITS,
SPRITE_ALONE,
SPRITE_FRIENDS,
+ SPRITE_FACTOROIDS,
SPRITE_CAMPAIGN,
SPRITE_SSWEEP,
SPRITE_ELIMINATION,
@@ -112,8 +113,9 @@
"trophy",
"credits",
"alone",
- "friends", //TODO give these two their own sprites
- "tux_helmet_red",
+ "friends",
+ "factoroids",
+ "fleet",
"nums",
"exclamation"
};
@@ -673,7 +675,7 @@
// Set up the sprites
sprites[0] = sprite_list[SPRITE_ALONE];
sprites[1] = sprite_list[SPRITE_FRIENDS];
- sprites[2] = sprite_list[SPRITE_CADET];
+ sprites[2] = sprite_list[SPRITE_FACTOROIDS];
sprites[3] = sprite_list[SPRITE_HELP];
sprites[4] = sprite_list[SPRITE_OPTIONS];
sprites[5] = sprite_list[SPRITE_QUIT];
More information about the Tux4kids-commits
mailing list