Main Page | Class Hierarchy | Compound List | File List | Compound Members

questiongenerator.h

00001 /***************************************************************************
00002                            questiongenerator.h
00003                            -------------------
00004     copyright            : (C) 2004 by Jos van den Oever
00005     email                : jos@vandenoever.info
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef QUESTIONGENERATOR_H
00017 #define QUESTIONGENERATOR_H
00018 #include "question.h"
00019 
00020 /* 
00021    This class can generate questions for the cubetest program.
00022    It is possible to set restrictions on the types and amounts of sidedeco-
00023    rations used.
00024    The parameters and their order of importance are given below.
00025     - smC1, smC2, smC4 These parameter determine the capabilities of the
00026       current style. It is useless to make questions that cannot be used,
00027       so these values are never overridden.
00028     - uniqueSides  This parameter determines that of each type of decoration,
00029       only one may be present in each question. This value is only overridden
00030       if the current style cannot draw 6 different side decorations.
00031     - nb This parameter gives the number of blanks that are shown.
00032     - nC1, nC2, nC4
00033 */
00034 typedef unsigned short ushort;
00035 class QuestionGenerator {
00036 private:
00037         ushort smC1, smC2, smC4;
00038         bool uniqueSides;
00039         short nb; // number of blanks
00040         short nC1, nC2, nC4;
00041         short ndC1, ndC2, ndC4;
00042         Question makeOriginal() const;
00043         void makeAnswers(Question &q) const;
00044         void shuffleCube(Question &q) const;
00045         void mutate(CubeDecoration &) const;
00046         void getTypeAmounts(short &tnC1, short &tnC2, short &tnC4) const;
00047         void shuffleSides(Question &q) const;
00048 public:
00049         QuestionGenerator();
00050         Question makeQuestion() const;
00051         bool makeQuestion(Question &) const;
00052         void setStyleRestrictions(ushort mC1, ushort mC2, ushort mC3);
00053         void setUniqueSides(bool);
00054         void setBlanks(short);
00055         void setNumSyms(short mC1, short mC1, short mC1);
00056         void setDiffSyms(short mC1, short mC1, short mC1);
00057         static void makemap(short *map, short n, short min, short max);
00058 };
00059 
00060 #endif

Generated on Thu Jan 15 23:13:57 2004 for CubeTest by doxygen 1.3.2