/***************************************************************************
                           questiongenerator.h
                           -------------------
    copyright            : (C) 2004 by Jos van den Oever
    email                : jos@vandenoever.info
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef QUESTIONGENERATOR_H
#define QUESTIONGENERATOR_H
#include "question.h"

/* 
   This class can generate questions for the cubetest program.
   It is possible to set restrictions on the types and amounts of sidedeco-
   rations used.
   The parameters and their order of importance are given below.
    - smC1, smC2, smC4 These parameter determine the capabilities of the
      current style. smC1 is the number of different drawing with symmetry C1
      the current style has. It is useless to make questions that cannot be
      used, so these values are never overridden.
    - uniqueSides  This parameter determines that of each type of decoration,
      only one may be present in each question. This value is only overridden
      if the current style cannot draw 6 different side decorations.
    - nb This parameter gives the number of blanks that are shown.
    - nC1, nC2, nC4
*/
typedef unsigned short ushort;
class QuestionGenerator {
public:
	QuestionGenerator();
	Question makeQuestion() const;
	bool makeQuestion(Question &) const;
	void setStyleRestrictions(ushort mC1, ushort mC2, ushort mC3);
	void setUniqueSides(bool);
	void setBlanks(short);
	void setNumSyms(short mC1, short mC2, short mC4);
	void setDiffSyms(short mC1, short mC2, short mC4);
	static void makemap(short *map, short n, short min, short max);
private:
	ushort smC1, smC2, smC4;
	bool uniqueSides;
	short nb; // number of blanks
	short nC1, nC2, nC4;
	short ndC1, ndC2, ndC4;
	Question makeOriginal() const;
	void makeAnswers(Question &q) const;
	void shuffleCube(Question &q) const;
	void mutate(CubeDecoration &) const;
	void getTypeAmounts(short &tnC1, short &tnC2, short &tnC4) const;
	void shuffleSides(Question &q) const;
};

#endif
