mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Addition, subtraction and initial setup
This commit is contained in:
40
CONTRIBUTING.md
Normal file
40
CONTRIBUTING.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
This project was created with contributions at it's core. We need your help to expand the reach of this project and open-source the generation of math problems.
|
||||||
|
|
||||||
|
## How You Can Help
|
||||||
|
|
||||||
|
### Coding Generators
|
||||||
|
As of right now, all of our generators are being coded in python. Each generator should be contained in a function. Your function should look something like the following:
|
||||||
|
```
|
||||||
|
def addition(maxSum, maxAddend):
|
||||||
|
"""
|
||||||
|
DESCRIPTION:
|
||||||
|
Generates addition problems with positive addends less than maxAddend and sum less than maxSum
|
||||||
|
SKILLID:
|
||||||
|
2
|
||||||
|
PROBLEM:
|
||||||
|
"a+b="
|
||||||
|
SOLUTION:
|
||||||
|
"c"
|
||||||
|
"""
|
||||||
|
a = random.randint(0, maxAddend)
|
||||||
|
b = random.randint(0, min((maxSum-a), maxAddend)) #The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
||||||
|
c = a+b
|
||||||
|
problem = str(a) + "+" + str(b) + "="
|
||||||
|
solution = str(c)
|
||||||
|
return problem, solution
|
||||||
|
```
|
||||||
|
Before coding, please check README.md to see if someone has already created the generator you plan to make.
|
||||||
|
Skillid is determined by the next available id as can be determined in the table.
|
||||||
|
|
||||||
|
### Provide Ideas
|
||||||
|
If you have an idea for a generator but don't have the time or know-how to create it, you can add it as an issue. If you have a lot of ideas, I would suggest adding them to the table in README.md so that they are easier for our team to manage.
|
||||||
|
|
||||||
|
## First Time Contributors
|
||||||
|
If you have never contributed to open source before here is a quick explanation of how to contribute.
|
||||||
|
|
||||||
|
* Fork this repository on Github. This creates a copy of the current code that you can edit and make changes to.
|
||||||
|
* Navigate to your fork and make your changes. This could be done by cloning and making changes locally on your computer. You can find many tutorials on this online. You could also edit directly on github if you don't have access to a text editor but doing this, you will not be able to test your function.
|
||||||
|
* Create a pull request. Navigate to (the math generator repository pull request tab)[https://github.com/Todarith/mathGenerator/pulls] and click New Pull Request. Then click compare accross forks. Select your fork and branch as the head branch and leave a description. Then click Create Pull Request.
|
||||||
|
* If all goes well, your request will be approved and your generator added. Congratulations!
|
||||||
14
README.md
14
README.md
@@ -1,2 +1,16 @@
|
|||||||
# mathGenerator
|
# mathGenerator
|
||||||
A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to random math problems to suit their needs.
|
A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to random math problems to suit their needs.
|
||||||
|
|
||||||
|
To try out generators, go to todarith.ml/generate
|
||||||
|
|
||||||
|
## List of Generators
|
||||||
|
|
||||||
|
| Skill | Id | Difficulty | Current Status | Contributors | Example problem | Example Solution |
|
||||||
|
|----------------------------|------|---------------|----------------|--------------|-----------------|-------------------|
|
||||||
|
| Addition | 2 | Low | Complete | @lukew3 | 1+5= | 6 |
|
||||||
|
| Subtraction | 3 | Low | Complete | @lukew3 | 9-4= | 5 |
|
||||||
|
| Multiplication | 4 | Low | In Progress | @lukew3 | 4*6= | 24 |
|
||||||
|
| Division | 5 | Low | In Progress | @lukew3 | 4/2= | 2 |
|
||||||
|
|
||||||
|
| Factoring | - | Medium | Not Started | - | x^2+x-6 | (x-2)(x+3) |
|
||||||
|
| Power Rule Differentiation | - | Medium | Not Started | - | x^5 | 5x^4 |
|
||||||
|
|||||||
0
mathGenerator/__init__.py
Normal file
0
mathGenerator/__init__.py
Normal file
37
mathGenerator/generator.py
Normal file
37
mathGenerator/generator.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
|
def addition(maxSum, maxAddend):
|
||||||
|
"""
|
||||||
|
DESCRIPTION:
|
||||||
|
Generates addition problems with positive addends less than maxAddend and sum less than maxSum
|
||||||
|
SKILLID:
|
||||||
|
2
|
||||||
|
PROBLEM:
|
||||||
|
"a+b="
|
||||||
|
SOLUTION:
|
||||||
|
"c"
|
||||||
|
"""
|
||||||
|
a = random.randint(0, maxAddend)
|
||||||
|
b = random.randint(0, min((maxSum-a), maxAddend)) #The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
||||||
|
c = a+b
|
||||||
|
problem = str(a) + "+" + str(b) + "="
|
||||||
|
solution = str(c)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
def subtraction(maxDiff, maxMinuend):
|
||||||
|
"""
|
||||||
|
DESCRIPTION:
|
||||||
|
Generates subtraction problems with difference between 0 and maxDiff. Minuend and subtrahend are between 0 and maxMinuend.
|
||||||
|
SKILLID:
|
||||||
|
3
|
||||||
|
PROBLEM:
|
||||||
|
"a-b="
|
||||||
|
SOLUTION:
|
||||||
|
"c"
|
||||||
|
"""
|
||||||
|
a = random.randint(0, maxMinuend)
|
||||||
|
b = random.randint(max(0, (a-maxDiff)), a)
|
||||||
|
c = a-b
|
||||||
|
problem = str(a) + "-" + str(b) + "="
|
||||||
|
solution = str(c)
|
||||||
|
return problem, solution
|
||||||
3
setup.cfg
Normal file
3
setup.cfg
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Inside of setup.cfg
|
||||||
|
[metadata]
|
||||||
|
description-file = README.md
|
||||||
20
setup.py
Normal file
20
setup.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='mathGenerator',
|
||||||
|
version='1.0.0',
|
||||||
|
description='An open source solution for generating math problems',
|
||||||
|
url='https://github.com/todarith/mathGenerator',
|
||||||
|
author='Luke Weiler',
|
||||||
|
author_email='lukew25073@gmail.com',
|
||||||
|
license='MIT',
|
||||||
|
packages=find_packages(),
|
||||||
|
install_requires=[
|
||||||
|
|
||||||
|
],
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'mathGenerator=mathGenerator.mainGen:main'
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user