mathmaker  0.4(alpha)
mathmaker_dev/sheet/ConverseAndContrapositiveOfPythagoreanTheoremShortTest.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 import machine
00024 import exercise
00025 from lib import randomly
00026 
00027 from S_Structure import S_Structure
00028 
00029 FONT_SIZE_OFFSET = 0
00030 SHEET_LAYOUT_TYPE = 'short_test'
00031 SHEET_LAYOUT_UNIT = "cm"
00032 #EXAMPLE OF A SHEET NOT USING ANY LAYOUT
00033 # -----------------------  lines_nb    col_widths   exercises
00034 SHEET_LAYOUT = { 'exc' : [ None,                    'all'
00035                          ],
00036                  'ans' : [ None,                    'all'
00037                          ]
00038                }
00039 
00040 
00041 # ------------------------------------------------------------------------------
00042 # CLASS: sheet.ConverseAndContrapositiveOfPythagoreanTheoremShortTest ---------
00043 # ------------------------------------------------------------------------------
00044 ##
00045 # @class ConverseAndContrapositiveOfPythagoreanTheoremShortTest
00046 # @brief The short test about the converse and contrapositive of the
00047 # @brief pythagorean theorem
00048 class ConverseAndContrapositiveOfPythagoreanTheoremShortTest(S_Structure):
00049 
00050 
00051 
00052 
00053 
00054     # --------------------------------------------------------------------------
00055     ##
00056     #   @brief Constructor
00057     #   @param embedded_machine The machine to be used
00058     #   @param **options Any options
00059     #   @return One instance of
00060     #   @return sheet.ConverseAndContrapositiveOfPythagoreanTheoremShortTest
00061     def __init__(self, embedded_machine, **options):
00062         self.derived = True
00063         S_Structure.__init__(self, embedded_machine, FONT_SIZE_OFFSET,
00064                              SHEET_LAYOUT_UNIT, SHEET_LAYOUT,
00065                              SHEET_LAYOUT_TYPE)
00066 
00067         # BEGINING OF THE ZONE TO REWRITE (see explanations below) ------------
00068         self.header = _("Name : .......................................")
00069         self.title = \
00070             _("Short Test : converse and contrapositive of pythagorean theorem")
00071         self.subtitle = ""
00072         self.text = ""
00073         self.answers_title = _("Examples of answers")
00074 
00075         boolean_list = [True, False]
00076 
00077         ex1 = exercise.X_RightTriangle(self.machine,
00078                                        x_kind='short_test',
00079                         x_subkind='contrapositive_of_pythagorean_theorem',
00080                         use_decimals=randomly.pop(boolean_list))
00081 
00082         ex2 = exercise.X_RightTriangle(self.machine,
00083                                        x_kind='short_test',
00084                         x_subkind='converse_of_pythagorean_theorem',
00085                         use_decimals=randomly.pop(boolean_list))
00086 
00087         boolean_list = [True, False]
00088 
00089         ex3 = exercise.X_RightTriangle(self.machine,
00090                                        x_kind='short_test',
00091                         x_subkind='converse_of_pythagorean_theorem',
00092                         use_decimals=randomly.pop(boolean_list))
00093 
00094         ex4 = exercise.X_RightTriangle(self.machine,
00095                                        x_kind='short_test',
00096                         x_subkind='contrapositive_of_pythagorean_theorem',
00097                         use_decimals=randomly.pop(boolean_list))
00098 
00099         if randomly.heads_or_tails():
00100             x_list = [ex1, ex2, ex3, ex4]
00101         else:
00102             x_list = [ex3, ex4, ex1, ex2]
00103 
00104         self.exercises_list = x_list
00105 
00106 
00107 
00108 
00109 
00110         # END -----------------------------------------------------------------