Merge branch 'master' into master

This commit is contained in:
Luke Weiler
2020-10-15 10:26:03 -04:00
committed by GitHub
2 changed files with 36 additions and 29 deletions

View File

@@ -21,11 +21,11 @@ problem, solution = mathgen.addition()
| Id | Skill | Example problem | Example Solution | Function Name | Status | | Id | Skill | Example problem | Example Solution | Function Name | Status |
|------|----------------------------|-----------------|-------------------|--------------------------|-------------| |------|----------------------------|-----------------|-------------------|--------------------------|-------------|
| 2 | Addition | 1+5= | 6 | addition | Complete | | 0 | Addition | 1+5= | 6 | addition | Complete |
| 3 | Subtraction | 9-4= | 5 | subtraction | Complete | | 1 | Subtraction | 9-4= | 5 | subtraction | Complete |
| 4 | Multiplication | 4*6= | 24 | multiplication | Complete | | 2 | Multiplication | 4*6= | 24 | multiplication | Complete |
| 5 | Division | 4/2= | 2 | division | Complete | | 3 | Division | 4/2= | 2 | division | Complete |
| 6 | Binary Complement 1s | 1010= | 0101 | binaryComplement1s | Complete | | 4 | Binary Complement 1s | 1010= | 0101 | binaryComplement1s | Complete |
| 7 | Modulo Division | 10%3= | 1 | moduloDivision | Complete | | 5 | Modulo Division | 10%3= | 1 | moduloDivision | Complete |
| 8 | Square Root | sqrt(a)= | b | squareRootFunction | Complete | | 6 | Square Root | sqrt(a)= | b | squareRootFunction | Complete |
| 9 | Power Rule Differentiation | nx^m | (n*m)x^(m-1) | powerRuleDifferentiation | Complete | | 7 | Power Rule Differentiation | nx^m | (n*m)x^(m-1) | powerRuleDifferentiation | Complete |

View File

@@ -1,5 +1,6 @@
import random import random
genList = []
# || Generator class # || Generator class
class Generator: class Generator:
@@ -9,6 +10,7 @@ class Generator:
self.generalProb = generalProb self.generalProb = generalProb
self.generalSol = generalSol self.generalSol = generalSol
self.func = func self.func = func
genList.append(self)
def __str__(self): def __str__(self):
return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol
@@ -16,6 +18,10 @@ class Generator:
def __call__(self): def __call__(self):
return self.func() return self.func()
# || CallbyId
def genById(id):
generator = genList[id]
return(generator())
# || Functions # || Functions
@@ -201,20 +207,21 @@ def divideFractionsFunc(maxVal=10):
#Format is: #Format is:
#<title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>) #<title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
addition = Generator("Addition", 2, "a+b=", "c", additionFunc) addition = Generator("Addition", 0, "a+b=", "c", additionFunc)
subtraction = Generator("Subtraction", 3, "a-b=", "c", subtractionFunc) subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc)
multiplication = Generator("Multiplication", 4, "a*b=", "c", multiplicationFunc) multiplication = Generator("Multiplication", 2, "a*b=", "c", multiplicationFunc)
division = Generator("Division", 5, "a/b=", "c", divisionFunc) division = Generator("Division", 3, "a/b=", "c", divisionFunc)
binaryComplement1s = Generator("binary_complement_1s", 6, "1010=", "0101", binaryComplement1sFunc) binaryComplement1s = Generator("binary_complement_1s", 4, "1010=", "0101", binaryComplement1sFunc)
moduloDivision = Generator("Modulo_Division", 7, "a%b=", "c", moduloFunc) moduloDivision = Generator("Modulo_Division", 5, "a%b=", "c", moduloFunc)
squareRoot = Generator("Square_Root", 8, "sqrt(a)=", "b", squareRootFunction) squareRoot = Generator("Square_Root", 6, "sqrt(a)=", "b", squareRootFunction)
powerRuleDifferentiation = Generator("Power_Rule_Differentiation", 9, "nx^m=", "(n*m)x^(m-1)", powerRuleDifferentiationFunc) powerRuleDifferentiation = Generator("Power_Rule_Differentiation", 7, "nx^m=", "(n*m)x^(m-1)", powerRuleDifferentiationFunc)
square = Generator("Square", 10,"a^2", "b", squareFunc) square = Generator("Square", 8,"a^2", "b", squareFunc)
lcm = Generator("Lcm_generator", 11, "LCM of a and b = ", "c", lcmFunc) lcm = Generator("Lcm_generator", 9, "LCM of a and b = ", "c", lcmFunc)
gcd = Generator("Gcd_generator", 12, "GCD of a and b = ", "c", gcdFunc) gcd = Generator("Gcd_generator", 10, "GCD of a and b = ", "c", gcdFunc)
basicAlgebra = Generator("Basic_Algebra", 13, "ax + b = c", "d", basicAlgebraFunc) basicAlgebra = Generator("Basic_Algebra", 11, "ax + b = c", "d", basicAlgebraFunc)
log = Generator("Logarithm", 13, "log2(8)", "3", logFunc) log = Generator("Logarithm", 12, "log2(8)", "3", logFunc)
intdivision = Generator("Easy Divisio",14,"a/b=","c",divisionToIntFunc) intdivision = Generator("Easy Divisio", 13,"a/b=","c",divisionToIntFunc)
decimaltobinary = Generator("Decimal to Binary",15,"Binary of a=","b",DecimalToBinary) decimaltobinary = Generator("Decimal to Binary",15,"Binary of a=","b",DecimalToBinary)
binarytodecimal = Generator("Binary to Decimal",16,"Decimal of a=","b",BinaryToDecimal) binarytodecimal = Generator("Binary to Decimal",16,"Decimal of a=","b",BinaryToDecimal)
fractionDivision = Generator("Fraction Division", 17, "(a/b)/(c/d)=", "x/y", divideFractionsFunc) fractionDivision = Generator("Fraction Division", 17, "(a/b)/(c/d)=", "x/y", divideFractionsFunc)