diff --git a/src/game/assets/audio/bgm.mpeg b/src/game2/assets/audio/bgm.mpeg similarity index 100% rename from src/game/assets/audio/bgm.mpeg rename to src/game2/assets/audio/bgm.mpeg diff --git a/src/game/assets/audio/end_bgm.mp3 b/src/game2/assets/audio/end_bgm.mp3 similarity index 100% rename from src/game/assets/audio/end_bgm.mp3 rename to src/game2/assets/audio/end_bgm.mp3 diff --git a/src/game/assets/images/1.jpeg b/src/game2/assets/images/1.jpeg similarity index 100% rename from src/game/assets/images/1.jpeg rename to src/game2/assets/images/1.jpeg diff --git a/src/game/assets/images/2.jpeg b/src/game2/assets/images/2.jpeg similarity index 100% rename from src/game/assets/images/2.jpeg rename to src/game2/assets/images/2.jpeg diff --git a/src/game/assets/images/3.jpeg b/src/game2/assets/images/3.jpeg similarity index 100% rename from src/game/assets/images/3.jpeg rename to src/game2/assets/images/3.jpeg diff --git a/src/game/assets/images/4.jpeg b/src/game2/assets/images/4.jpeg similarity index 100% rename from src/game/assets/images/4.jpeg rename to src/game2/assets/images/4.jpeg diff --git a/src/game/game.js b/src/game2/game.js similarity index 100% rename from src/game/game.js rename to src/game2/game.js diff --git a/src/game/main.css b/src/game2/main.css similarity index 100% rename from src/game/main.css rename to src/game2/main.css diff --git a/src/game/main.html b/src/game2/main.html similarity index 100% rename from src/game/main.html rename to src/game2/main.html diff --git a/src/game/questions.js b/src/game2/questions.js similarity index 50% rename from src/game/questions.js rename to src/game2/questions.js index bdfc9f5..43f40df 100644 --- a/src/game/questions.js +++ b/src/game2/questions.js @@ -12,9 +12,9 @@ function shuffleOptions(options) { // Generating question bank function lightColor() { - let wavelengths = [415, 473, 533, 585, 605, 685]; - let possibleColors = ['Violet', 'Blue', 'Green', 'Yellow', 'Orange', 'Red'] - let randNum = getRandomInt(0, 5); + let wavelengths = [405, 473, 532, 585, 685]; + let possibleColors = ['Violet', 'Blue', 'Green', 'Yellow', 'Red'] + let randNum = getRandomInt(0, 4); const wavelength = wavelengths[randNum] const correctColor = possibleColors[randNum] @@ -34,7 +34,9 @@ function lightColor() { }; } -function pathDiffConst() { + +// TWO SOURCE INTERFERENCE +function pathDiffConst_inPhase() { const p1 = getRandomInt(2, 10) const p2 = p1 + 1 * getRandomInt(1, 5) @@ -49,7 +51,7 @@ function pathDiffConst() { const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) return { - question: `If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, + question: `Two sources emit coherent Sound waves in phase. If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, options: options, correctAnswer: correctOpt, explanation: @@ -58,7 +60,31 @@ function pathDiffConst() { }; } -function pathDiffDest() { +function pathDiffConst_inAntiphase() { + const p1 = getRandomInt(2, 10) + const p2 = p1 + 1 * getRandomInt(1, 5) + + const pathDiff = p2 - p1 + const phaseDiff = pathDiff * 2 + + const wrongOpt1 = `Constructive Interference, Phase Difference Δϕ = ${phaseDiff}π` + const correctOpt = `Destructive Interference, Phase Difference Δϕ = ${phaseDiff}π` + const wrongOpt2 = `Destructive Interference, Phase Difference Δϕ = ${pathDiff}π` + const wrongOpt3 = `Constructive Interference, Phase Difference Δϕ = ${pathDiff}π` + + const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) + + return { + question: `Two sources emit coherent sound waves in antiphase. If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, + options: options, + correctAnswer: correctOpt, + explanation: + `The correct answer is ${correctOpt} because path difference = ${pathDiff}λ and phase difference = ${phaseDiff}π`, + ShowImage: false + }; +} + +function pathDiffDest_inPhase() { const p1 = getRandomInt(2, 10) const p2 = p1 + 0.5 + getRandomInt(1, 5) @@ -73,7 +99,7 @@ function pathDiffDest() { const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) return { - question: `If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, + question: `Two sources emit coherent sound waves in phase. If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, options: options, correctAnswer: correctOpt, explanation: @@ -83,16 +109,40 @@ function pathDiffDest() { } -function possDestPhaseDiff() { +function pathDiffDest_inAntiphase() { + const p1 = getRandomInt(2, 10) + const p2 = p1 + 1 * getRandomInt(1, 5) + + const pathDiff = p2 - p1 + const phaseDiff = pathDiff * 2 + + const correctOpt = `Constructive Interference, Phase Difference Δϕ = ${phaseDiff}π` + const wrongOpt1 = `Destructive Interference, Phase Difference Δϕ = ${phaseDiff}π` + const wrongOpt2 = `Destructive Interference, Phase Difference Δϕ = ${pathDiff}π` + const wrongOpt3 = `Constructive Interference, Phase Difference Δϕ = ${pathDiff}π` + + const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) + + return { + question: `Two sources emit coherent Sound waves in antiphase. If path 1 is ${p1}λ and path 2 is ${p2}λ from screen, What is their phase difference and interference type?`, + options: options, + correctAnswer: correctOpt, + explanation: + `The correct answer is ${correctOpt} because path difference = ${pathDiff}λ and phase difference = ${phaseDiff}π`, + ShowImage: false + }; +} + +function possDestPhaseDiff_inPhase() { const correctOpt = `π, 3π, 5π, ...` const wrongOpt1 = `2π, 4π, 6π, ...` - const wrongOpt2 = `0, 2π, 4π, ...` - const wrongOpt3 = `±π, ±3π, ±5π, ...` + const wrongOpt2 = `0, π, 2π, ...` + const wrongOpt3 = `π/2, 3π/2, 5π/2, ...` const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) return { - question: `Which of the below lists the possible phase difference for destructive interference?`, + question: `Which of the below lists the possible phase difference for destructive interference of two sound waves in phase?`, options: options, correctAnswer: correctOpt, explanation: @@ -101,11 +151,29 @@ function possDestPhaseDiff() { }; } -function possConstPhaseDiff() { +function possDestPhaseDiff_inAntiphase() { const correctOpt = `0, 2π, 4π, ...` - const wrongOpt1 = `2π, 4π, 6π, ...` - const wrongOpt2 = `π, 3π, 5π, ...` - const wrongOpt3 = `±π, ±3π, ±5π, ...` + const wrongOpt1 = `π, 3π, 5π, ...` + const wrongOpt2 = `0, π, 2π, ...` + const wrongOpt3 = `π/2, 3π/2, 5π/2, ...` + + const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) + + return { + question: `Which of the below lists the possible phase difference for destructive interference of two sound waves in antiphase?`, + options: options, + correctAnswer: correctOpt, + explanation: + `For desctructive interference, phase difference is always a positive odd number!`, + ShowImage: false + }; +} + +function possConstPhaseDiff_inPhase() { + const correctOpt = `0, 2π, 4π, ...` + const wrongOpt1 = `π, 3π, 5π, ...` + const wrongOpt2 = `0, π, 2π, ...` + const wrongOpt3 = `π/2, 3π/2, 5π/2, ...` const options = [correctOpt, wrongOpt1, wrongOpt2, wrongOpt3] for (let i = options.length - 1; i > 0; i--) { @@ -114,7 +182,7 @@ function possConstPhaseDiff() { } return { - question: `Which of the below lists the possible phase difference for constructive interference?`, + question: `Which of the below lists the possible phase difference for constructive interference of two sound waves in phase?`, options: options, correctAnswer: correctOpt, explanation: @@ -123,8 +191,28 @@ function possConstPhaseDiff() { }; } -function increaseSlitWidth() { - const correctOpt = `The intensity increases while the spacing between maxima points decreases` +function possConstPhaseDiff_inAntiphase() { + const correctOpt = `π, 3π, 5π, ...` + const wrongOpt1 = `2π, 4π, 6π, ...` + const wrongOpt2 = `0, π, 2π, ...` + const wrongOpt3 = `π/2, 3π/2, 5π/2, ...` + + const options = shuffleOptions([correctOpt, wrongOpt1, wrongOpt2, wrongOpt3]) + + return { + question: `Which of the below lists the possible phase difference for constructive interference of two sound waves in antiphase?`, + options: options, + correctAnswer: correctOpt, + explanation: + `For desctructive interference, phase difference is always a positive odd number!`, + ShowImage: false + }; +} + + +//SINGLE SLIT EXPERIMENTS +function SS_increaseSlitWidth() { + const correctOpt = `The intensity increases while the spacing between maxima points doesn't change` const wrongOpt1 = `Only the spacing between maxima points increases` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` const wrongOpt3 = `Both the intensity and the spacing between maxima points decreases` @@ -139,7 +227,7 @@ function increaseSlitWidth() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you increase the slit width, what happens to the intensity profile? ?`, + question: `For a single slit experiment, if you increase the slit width, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -148,9 +236,9 @@ function increaseSlitWidth() { }; } -function decreaseSlitWidth() { +function SS_decreaseSlitWidth() { const correctOpt = `The intensity decreases while the spacing between maxima points increases` - const wrongOpt1 = `Only the spacing between maxima points decreases` + const wrongOpt1 = `Only the spacing between maxima points decreases doens't change` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` const wrongOpt3 = `Both the intensity and the spacing between maxima points decreases` const wrongOpt4 = `The intensity increases while the spacing between maxima points decreases` @@ -164,7 +252,7 @@ function decreaseSlitWidth() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you decrease the slit width, what happens to the intensity profile?`, + question: `For a double slit, if you decrease the slit width, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -173,7 +261,64 @@ function decreaseSlitWidth() { }; } -function increaseWaveLength() { +function SS_increaseWaveLength() { + const correctOpt = `Angle θ increases while the width of the width of Central Maxima decreases` + const wrongOpt1 = `Angle θ decreases while the width of the width of Central Maxima increases` + const wrongOpt2 = `Angle θ increases while the width of the width of Central Maxima remains the same` + const wrongOpt3 = `Angle θ decreases while the width of the width of Central Maxima remains the same` + const wrongOpt4 = `Angle θ remains the same while the width of the width of Central Maxima increases` + const wrongOpt5 = `Angle θ remains the smae while the width of the width of Central Maxima decreases` + + + const wrongOpts = [wrongOpt1, wrongOpt2, wrongOpt3, wrongOpt4, wrongOpt5] + const shuffledWrongOpts = wrongOpts.sort(() => 0.5 - Math.random()).slice(0, 3); + + + const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) + + return { + question: `For a single slit, if you increase the wavelength, what happens to the intensity profile?`, + options: options, + correctAnswer: correctOpt, + explanation: + `${correctOpt} because wavelength is directly proportional to θ and directly unproportional to width of central maxima!`, + ShowImage: false + }; + +} + +function SS_decreaseWaveLength() { + const wrongOpt1 = `Angle θ increases while the width of the width of Central Maxima decreases` + const correctOpt = `Angle θ decreases while the width of the width of Central Maxima increases` + const wrongOpt2 = `Angle θ increases while the width of the width of Central Maxima remains the same` + const wrongOpt3 = `Angle θ decreases while the width of the width of Central Maxima remains the same` + const wrongOpt4 = `Angle θ remains the same while the width of the width of Central Maxima increases` + const wrongOpt5 = `Angle θ remains the smae while the width of the width of Central Maxima decreases` + + + const wrongOpts = [wrongOpt1, wrongOpt2, wrongOpt3, wrongOpt4, wrongOpt5] + const shuffledWrongOpts = wrongOpts.sort(() => 0.5 - Math.random()).slice(0, 3); + + + const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) + + return { + question: `For a single slit, if you increase the wavelength, what happens to the intensity profile?`, + options: options, + correctAnswer: correctOpt, + explanation: + `${correctOpt} because wavelength is directly proportional to θ and directly unproportional to width of central maxima!`, + ShowImage: false + }; + +} + + + + + +//DOUBLE SLIT EXPERIMENTS +function DS_increaseWaveLength() { const correctOpt = `Only the spacing between maxima points increases` const wrongOpt1 = `Only the spacing between maxima points decreases` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` @@ -189,7 +334,7 @@ function increaseWaveLength() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you increase the wavelength, what happens to the intensity profile?`, + question: `For a double slit, if you increase the wavelength, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -199,7 +344,7 @@ function increaseWaveLength() { } -function decreaseWaveLength() { +function DS_decreaseWaveLength() { const correctOpt = `Only the spacing between maxima points decreases` const wrongOpt1 = `Only the spacing between maxima points increases` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` @@ -215,7 +360,7 @@ function decreaseWaveLength() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you decrease the wavelength, what happens to the intensity profile? ?`, + question: `For a double slit, if you decrease the wavelength, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -225,7 +370,7 @@ function decreaseWaveLength() { } -function increaseSlitSeparation() { +function DS_increaseSlitSeparation() { const correctOpt = `Only the spacing between maxima points decreases` const wrongOpt1 = `Only the spacing between maxima points increases` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` @@ -241,7 +386,7 @@ function increaseSlitSeparation() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you increase the slit separation, what happens to the intensity profile?`, + question: `For a double slit, if you increase the slit separation, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -251,7 +396,7 @@ function increaseSlitSeparation() { } -function decreaseSlitSeparation() { +function DS_decreaseSlitSeparation() { const correctOpt = `Only the spacing between maxima points increases` const wrongOpt1 = `Only the spacing between maxima points decreases` const wrongOpt2 = `Both the intensity and the spacing between maxima points increases` @@ -267,7 +412,7 @@ function decreaseSlitSeparation() { const options = shuffleOptions([correctOpt, ...shuffledWrongOpts]) return { - question: `If you decrease the slit separation, what happens to the intensity profile?`, + question: `For a double slit, if you decrease the slit separation, what happens to the intensity profile?`, options: options, correctAnswer: correctOpt, explanation: @@ -277,48 +422,128 @@ function decreaseSlitSeparation() { } -function changeSlitSeparation(){ + +//MULTIPLE SLIT (DIFFRACTION GRATING) +function MS_increaseGrating(){} + +function MS_decreaseGrating(){} + +function MS_increaseWavelength(){} + +function MS_decreaseWavelength(){} + +function MS_SSEnvelope(){} + + + + +//RANDOMISING THE QUESTIONS +function pathDiff_Questions(){ + rand = getRandomInt(0, 3) + if (rand === 0) { + return pathDiffConst_inAntiphase(); + } else if (rand === 1) { + return pathDiffConst_inPhase(); + } else if (rand === 2) { + return pathDiffDest_inAntiphase(); + } else { + return pathDiffDest_inPhase(); + } +} + +function possPhaseDiff_Questions(){ + rand = getRandomInt(0, 3) + if (rand === 0) { + return possConstPhaseDiff_inPhase(); + } else if (rand === 1) { + return possDestPhaseDiff_inAntiphase(); + } else if (rand === 2) { + return possDestPhaseDiff_inPhase(); + } else { + return possConstPhaseDiff_inAntiphase(); + } + +} + +function DS_changeSlitSeparation_Questons(){ + if (getRandomInt(0, 1) === 1) { + return DS_increaseSlitSeparation(); + } else { + return DS_decreaseSlitSeparation(); + } +} + +function DS_changeWavelength_Questions(){ if (getRandomInt(0, 1) === 1) { - return increaseSlitSeparation() + return DS_decreaseWaveLength(); } else { - return decreaseSlitSeparation() + return DS_increaseWaveLength(); } } -function changeWaveLength(){ +function SS_changeSlitWidth_Questions(){ if (getRandomInt(0, 1) === 1) { - return decreaseWaveLength() + return SS_increaseSlitWidth(); } else { - return increaseWaveLength() + return SS_decreaseSlitWidth(); } } -function changeSlitWidth(){ +function SS_changeWavelength_Questions(){ if (getRandomInt(0, 1) === 1) { - return increaseSlitWidth() + return SS_decreaseWaveLength(); } else { - return decreaseSlitWidth() + return SS_increaseWaveLength(); } } +function MS_changeGrating_Questions(){ + if (getRandomInt(0, 1) === 1) { + return MS_decreaseGrating(); + } else { + return MS_increaseGrating(); + } +} + +function MS_changeWavelength_Questions(){ + if (getRandomInt(0, 1) === 1) { + return MS_decreaseWavelength(); + } else { + return MS_increaseWavelength(); + } +} + +//GENERATING QUESTIONS function GenQuestion() { - randomQuestion = getRandomInt(0, 7) + randomQuestion = getRandomInt(0, 9) if (randomQuestion === 0) { return lightColor(); + } else if (randomQuestion === 1) { - return pathDiffConst() + return pathDiff_Questions(); + } else if (randomQuestion === 2) { - return pathDiffDest() + return possPhaseDiff_Questions(); + } else if (randomQuestion === 3) { - return possConstPhaseDiff() + return DS_changeSlitSeparation_Questons(); + } else if (randomQuestion === 4){ - return possDestPhaseDiff() + return DS_changeWavelength_Questions(); + } else if (randomQuestion === 5) { - return changeSlitSeparation() + return SS_changeSlitWidth_Questions(); + } else if (randomQuestion === 6) { - return changeSlitWidth() + return SS_changeWavelength_Questions(); + } else if (randomQuestion === 7) { - return changeWaveLength() + return MS_changeGrating_Questions(); + + } else if (randomQuestion === 8) { + return SS_changeWavelength_Questions(); + } else { + return MS_SSEnvelope(); } diff --git a/src/game/todo.txt b/src/game2/todo.txt similarity index 100% rename from src/game/todo.txt rename to src/game2/todo.txt diff --git a/src/text/game/main.md b/src/text/game/main.md index ff5b211..0ca5565 100644 --- a/src/text/game/main.md +++ b/src/text/game/main.md @@ -3,4 +3,8 @@ If your answer is yes, Click onto the link below and you will be redirected to a If you are stuck, feel free to use our simulations for help! -Link to quiz \ No newline at end of file +### Normal Test +Link to quiz + +### Are you UP for a challenge? +Link to quiz