bonk-challanges 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -64,7 +64,11 @@ function createMathProblem(difficulty = 'intermediate') {
64
64
  const kind = randomInt(0, 3);
65
65
  if (kind === 0) return { text: `${a}x ${b >= 0 ? '+' : '-'} ${Math.abs(b)} = ${a * x + b}`, answer: String(x), label: 'x' };
66
66
  if (kind === 1) return { text: `${a}(x ${b >= 0 ? '+' : '-'} ${Math.abs(b)}) = ${a * (x + b)}`, answer: String(x), label: 'x' };
67
- if (kind === 2) return { text: `(x / ${a}) ${b >= 0 ? '+' : '-'} ${Math.abs(b)} = ${x / a + b}`, answer: String(x), label: 'x' };
67
+ if (kind === 2) {
68
+ const quotient = randomInt(-12, 12);
69
+ const integerX = quotient * a;
70
+ return { text: `(x / ${a}) ${b >= 0 ? '+' : '-'} ${Math.abs(b)} = ${quotient + b}`, answer: String(integerX), label: 'x' };
71
+ }
68
72
  return { text: `${a}x - ${b} = ${a * x - b}`, answer: String(x), label: 'x' };
69
73
  }
70
74
 
@@ -205,7 +209,7 @@ function MathChallenge({ colors, stylesConfig, onSolved, difficulty = 'intermedi
205
209
  setInput('');
206
210
  }, [problem.text]);
207
211
 
208
- const pad = ['1', '2', '3', '-', '4', '5', '6', '+', '7', '8', '9', 'i', 'C', '0', 'OK'];
212
+ const pad = ['-', '+', 'i', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C', '0', 'OK'];
209
213
 
210
214
  return React.createElement(
211
215
  View,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bonk-challanges",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {