mathmaker  0.6(alpha)
mamk_misc/doc/mathmaker4doxygen/sheet/AlgebraExpressionReduction.py
00001 # -*- coding: utf-8 -*-
00002 
00003 # Mathmaker creates automatically maths exercises sheets
00004 # with their answers
00005 # Copyright 2006-2014 Nicolas Hainaux <nico_h@users.sourceforge.net>
00006 
00007 # This file is part of Mathmaker.
00008 
00009 # Mathmaker is free software; you can redistribute it and/or modify
00010 # it under the terms of the GNU General Public License as published by
00011 # the Free Software Foundation; either version 3 of the License, or
00012 # any later version.
00013 
00014 # Mathmaker is distributed in the hope that it will be useful,
00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 # GNU General Public License for more details.
00018 
00019 # You should have received a copy of the GNU General Public License
00020 # along with Mathmaker; if not, write to the Free Software
00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 
00024 import machine
00025 import exercise
00026 from S_Structure import S_Structure
00027 
00028 FONT_SIZE_OFFSET = -1
00029 SHEET_LAYOUT_TYPE = 'std'
00030 SHEET_LAYOUT_UNIT = "cm"
00031 # -----------------------  lines_nb    col_widths   exercises
00032 SHEET_LAYOUT = { 'exc' : [ None,                    'all'
00033                          ],
00034                  'ans' : [ [1,         9, 9],       (1, 1),
00035                            'jump',                  'next_page',
00036                            None,                    'all_left'
00037                          ]
00038                }
00039 
00040 # ------------------------------------------------------------------------------
00041 # --------------------------------------------------------------------------
00042 # ------------------------------------------------------------------------------
00043 ##
00044 # @class AlgebraExpressionReduction
00045 # @brief Reduce a Product, a Sum, a Sum of Products
00046 class AlgebraExpressionReduction(S_Structure):
00047 
00048 
00049 
00050 
00051 
00052     # --------------------------------------------------------------------------
00053     ##
00054     #   @brief Constructor
00055     #   @param embedded_machine The machine to be used
00056     #   @param **options Any options
00057     #   @return One instance of exercise.ExpressionReduction
00058     def __init__(self, embedded_machine, **options):
00059         self.derived = True
00060         S_Structure.__init__(self, embedded_machine, FONT_SIZE_OFFSET,
00061                              SHEET_LAYOUT_UNIT, SHEET_LAYOUT,
00062                              SHEET_LAYOUT_TYPE)
00063 
00064         # BEGINING REWRITTEN ZONE ---------------------------------------------
00065         self.header = ""
00066         self.title = _("Training exercises sheet :")
00067         self.subtitle = _("Reduce an algebraic expression")
00068         self.text = ""
00069         self.answers_title = _("Examples of answers")
00070 
00071         ex1 = exercise.X_AlgebraExpressionReduction(self.machine,
00072                                                     x_kind='preformatted',
00073                                                     x_subkind='product'
00074                                                     )
00075 
00076         ex2 = exercise.X_AlgebraExpressionReduction(self.machine,
00077                                                     x_kind='bypass',
00078                                                     x_subkind='sum',
00079                                                     number_of_questions=10
00080                                                     )
00081 
00082         ex3 = exercise.X_AlgebraExpressionReduction(self.machine,
00083                                                     x_kind='bypass',
00084                                                     x_subkind='sum_of_products',
00085                                                     number_of_questions=10
00086                                                     )
00087 
00088         self.exercises_list.append(ex1)
00089         self.exercises_list.append(ex2)
00090         self.exercises_list.append(ex3)
00091 
00092 
00093 
00094 
00095 
00096         # END -----------------------------------------------------------------
00097 
00098 
00099 
00100 
00101 
00102 
00103