示例#1
0
    def prepare_equation_multiply_simple_config(game_config):
        number_1 = game_config.element_1_value
        number_1_condition = game_config.element_1_condition
        number_2 = game_config.element_2_value
        number_2_condition = game_config.element_2_condition
        number_range_dict = game_config.range_dict  # range
        number_range_min = number_range_dict["from"]
        number_range_max = number_range_dict["to"]

        condition_end = False
        while not condition_end:
            # condition_minuend_ge_subtrahend = True
            condition_multiply_result_met = True
            condition_without_zero = True
            condition_without_one = True
            # print("n1")
            n1 = LM_Utils.random_int_w_condition(number_range_min,
                                                 number_range_max,
                                                 number_1_condition,
                                                 number_1)
            # print("n2")
            n2 = LM_Utils.random_int_w_condition(number_range_min,
                                                 number_range_max,
                                                 number_2_condition,
                                                 number_2)
            # if game_config.minuend_ge_subtrahend:
            #     # gdy odjemna ma być większa bądź równa niż odjemnik
            #     if not (n1 >= n2):
            #         condition_minuend_ge_subtrahend = False

            if (game_config.result_condition is not None) \
                    and (game_config.result_value is not None):
                # gdy podano warunek na wynik
                if not Equation.is_multiply_result_met(n1, n2,
                                                game_config.result_condition,
                                                game_config.result_value):
                    condition_multiply_result_met = False

            if game_config.without_zero:
                if n1 == 0 or n2 == 0:
                    condition_without_zero = False

            if game_config.without_one:
                if n1 == 1 or n2 == 1:
                    condition_without_one = False

            condition_end = condition_multiply_result_met \
                            and condition_without_zero \
                            and condition_without_one

        # print("n1 = ", n1, "   and n2 = ", n2)

        # print(game_config.__str__())
        p_equation = Equation(n1, OPERATION_MULTIPLY, n2)

        return p_equation
示例#2
0
    def prepare_equation_multiply_simple_config(game_config):
        number_1 = game_config.element_1_value
        number_1_condition = game_config.element_1_condition
        number_2 = game_config.element_2_value
        number_2_condition = game_config.element_2_condition
        number_range_dict = game_config.range_dict  # range
        number_range_min = number_range_dict["from"]
        number_range_max = number_range_dict["to"]

        condition_end = False
        while not condition_end:
            # condition_minuend_ge_subtrahend = True
            condition_multiply_result_met = True
            condition_without_zero = True
            condition_without_one = True
            # print("n1")
            n1 = LM_Utils.random_int_w_condition(number_range_min,
                                                 number_range_max,
                                                 number_1_condition, number_1)
            # print("n2")
            n2 = LM_Utils.random_int_w_condition(number_range_min,
                                                 number_range_max,
                                                 number_2_condition, number_2)
            # if game_config.minuend_ge_subtrahend:
            #     # gdy odjemna ma być większa bądź równa niż odjemnik
            #     if not (n1 >= n2):
            #         condition_minuend_ge_subtrahend = False

            if (game_config.result_condition is not None) \
                    and (game_config.result_value is not None):
                # gdy podano warunek na wynik
                if not Equation.is_multiply_result_met(
                        n1, n2, game_config.result_condition,
                        game_config.result_value):
                    condition_multiply_result_met = False

            if game_config.without_zero:
                if n1 == 0 or n2 == 0:
                    condition_without_zero = False

            if game_config.without_one:
                if n1 == 1 or n2 == 1:
                    condition_without_one = False

            condition_end = condition_multiply_result_met \
                            and condition_without_zero \
                            and condition_without_one

        # print("n1 = ", n1, "   and n2 = ", n2)

        # print(game_config.__str__())
        p_equation = Equation(n1, OPERATION_MULTIPLY, n2)

        return p_equation
示例#3
0
# -*- coding: utf-8 -*-

"""Main module for LearnMath applications."""

import ctypes
import sys

import PyQt5.QtWidgets

import LM_Utils
from LearnMathGui import LearnMathGui

logger = LM_Utils.create_logger_for_screen_and_file("learn_math_log.txt")


if __name__ == "__main__":

    try:
        app = PyQt5.QtWidgets.QApplication(sys.argv)
        myapp = LearnMathGui()

        my_app_id = "mj.learn_math.lm.1"  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(my_app_id)
        app.setQuitOnLastWindowClosed(False)

        myapp.show()
        sys.exit(app.exec_())
    except Exception as ex:
        print(ex)
        raise
示例#4
0
# -*- coding: utf-8 -*-
"""Main module for LearnMath applications."""

import ctypes
import sys

import PyQt5.QtWidgets

import LM_Utils
from LearnMathGui import LearnMathGui

logger = LM_Utils.create_logger_for_screen_and_file("learn_math_log.txt")

if __name__ == "__main__":

    try:
        app = PyQt5.QtWidgets.QApplication(sys.argv)
        myapp = LearnMathGui()

        my_app_id = "mj.learn_math.lm.1"  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
            my_app_id)
        app.setQuitOnLastWindowClosed(False)

        myapp.show()
        sys.exit(app.exec_())
    except Exception as ex:
        print(ex)
        raise