-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed commit & merge of the following:
*note* See changelog.md for more information (v1.1.1) commit b891e7d Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 18:04:12 2021 +1000 Release commit 396d91e Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 18:02:31 2021 +1000 Questions are now in columns instead of rows Updated changelogs accordingly Questions are now generated in columns and rows to fit more in. Questions per sheet buffed from 25 -> 50 Due to this experimental problem solving is broken :( commit 880a97f Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:38:20 2021 +1000 CHANGELOG update commit 131483e Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:35:45 2021 +1000 Problem solving engine update Added warnings to indicate it's experimental Added more questions to each sheet (10 -> 25) No two characters will be the same Updated changelog accordingly commit c90f002 Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:25:37 2021 +1000 *experimental* problem solving engine commit 00d6645 Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:13:53 2021 +1000 bump ver commit a871288 Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:11:19 2021 +1000 Prettified errors commit 250f2b9 Author: Jim Ke <jimke2000@gmail.com> Date: Fri Jul 30 14:08:01 2021 +1000 CONTRIBUTING commit ff96002 Author: Jim Ke <jimke2000@gmail.com> Date: Thu Jul 29 15:31:32 2021 +1000 Expermiental problem solving
- Loading branch information
Showing
6 changed files
with
148 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
We are currently not looking for committers. If you still want to contribute, open a PR. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** @format */ | ||
|
||
"use strict"; | ||
/** Problem solving worksheet handler/generator */ | ||
/** | ||
* This file handles math problem generation and handles other math-y stuff. | ||
*/ | ||
|
||
/** | ||
* @class | ||
* Mathamatical Expression object class | ||
*/ | ||
class Expression { | ||
/** | ||
* Generate a new Expression | ||
* @param {String} expr An expression | ||
* @param {Number} answer Answer to the expression | ||
* @param {Number} first First number | ||
* @param {Number} last Last number | ||
* @param {String} type Type of question | ||
*/ | ||
constructor(expr, answer, first, last, type) { | ||
this.expr = expr; | ||
this.answer = answer; | ||
this.first = first; | ||
this.last = last; | ||
this.type = type; | ||
} | ||
evalutate() { | ||
return eval(expr); | ||
} | ||
} | ||
|
||
function rnd(min, max) { | ||
return Math.floor(Math.random() * (max - min + 1)) + min; | ||
} | ||
function err(e) { | ||
return console.log(chalk` | ||
{red Whoops! An error occured. Please refer to the message below for more information} | ||
${e} | ||
`); | ||
} | ||
|
||
const characters = [ | ||
"Billy", | ||
"Noel", | ||
"Harry", | ||
"Issac", | ||
"Sasha", | ||
"Dominic", | ||
"Bella", | ||
"Simon", | ||
"Mary", | ||
"Max", | ||
]; | ||
const objects = [ | ||
"pencils", | ||
"pens", | ||
"scissors", | ||
"cups", | ||
"caps", | ||
"phones", | ||
"dollars", | ||
"apples", | ||
"oranges", | ||
"bananas", | ||
]; | ||
module.exports = () => { | ||
const questions = []; | ||
for (let i = 0; i < 25; i++) { | ||
let person1 = characters[rnd(0, characters.length - 1)]; | ||
let person2 = characters[rnd(0, characters.length - 1)]; | ||
while(person1 === person2) { | ||
person1 = characters[rnd(0, characters.length - 1)]; | ||
person2 = characters[rnd(0, characters.length - 1)]; | ||
} | ||
const object = objects[rnd(0, objects.length - 1)]; | ||
const first = rnd(2, 20); | ||
const last = rnd(2, 20); | ||
const answer = first + last; | ||
questions.push({ | ||
q: `${person2} has ${first} ${object}. ${person1} gave ${person2} ${last} ${object}. How many ${object} does ${person2} have now?`, | ||
a: answer, | ||
}); | ||
} | ||
return questions; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.