diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..35163b2 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VUE_APP_API_URL=http://localhost:5000 diff --git a/.gitignore b/.gitignore index e69de29..403adbc 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules +/dist + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..e955840 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..f754539 --- /dev/null +++ b/public/index.html @@ -0,0 +1,19 @@ + + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+ + + diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..06b590b --- /dev/null +++ b/src/App.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/src/arithmetic.js b/src/arithmetic.js new file mode 100644 index 0000000..d5e780e --- /dev/null +++ b/src/arithmetic.js @@ -0,0 +1,51 @@ +import utils from './utils.js'; + +export default { + methods: { + // Generate a addition problem + addition(mult = 1) { + let a = utils.methods.getRandomInt(5 * mult, 100 * mult); + let b = utils.methods.getRandomInt(5 * mult, 100 * mult); + return { + text: `${a} + ${b}`, + answer: a + b + } + }, + subtraction(mult = 1) { + let a = utils.methods.getRandomInt(5 * mult, 100 * mult); + let b = utils.methods.getRandomInt(5 * mult, 100 * mult); + if (Math.random() > 0.5) { + return { + text: `${a} - ${b}`, + answer: a - b, + } + } + else { + return { + text: `-${a} + ${b}`, + answer: -a + b + } + } + }, + multiplication(mult = 1) { + let a = utils.methods.getRandomInt(3 * mult, 30 * mult); + let b = utils.methods.getRandomInt(3 * mult, 15 * mult); + return { + text: `${a} \\times ${b}`, + answer: a * b + } + }, + square_root(mult = 1) { + let a = utils.methods.getRandomInt(2 * mult, 20 * mult); + return { + text: `\\sqrt{${a * a}}`, + answer: a + } + }, + getProblem: function () { + let possible = [this.multiplication, this.square_root]; + let index = utils.methods.getRandomInt(0, possible.length); + return possible[index](); + } + } +} diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..f3d2503 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..e8da950 --- /dev/null +++ b/src/main.js @@ -0,0 +1,15 @@ +import Vue from 'vue' +import VueKatex from 'vue-katex'; +import Buefy from 'buefy'; +import App from './App.vue' +import 'katex/dist/katex.min.css'; +import 'buefy/dist/buefy.css'; + + +Vue.config.productionTip = false +Vue.use(Buefy) +Vue.use(VueKatex) + +new Vue({ + render: h => h(App), +}).$mount('#app') diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..af954b5 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,9 @@ +export default { + methods: { + getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive + } + } +} diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..4f801f6 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,3 @@ +module.exports = { + outputDir: './docs/', +}