Created
November 17, 2020 16:50
-
-
Save anthonyk1225/d9dc3dca969086bd1c61ca398897e415 to your computer and use it in GitHub Desktop.
COVID-19 rapid test algorithm
This file contains hidden or 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
| // leaked code for COVID-19 rapid test algorithm | |
| const RapidTest = function(name, age, swabbed, fliched) { | |
| this.name = name; | |
| this.age = age; | |
| this.wasSwabbed = swabbed; | |
| this.flinched = fliched; | |
| } | |
| RapidTest.prototype.isPositive = function() { | |
| const hasCorona = Math.random() <= 0.5; | |
| return hasCorona; | |
| } | |
| RapidTest.prototype.wasABitch = function() { | |
| if (this.wasSwabbed && !this.flinched) return false; | |
| return true; | |
| } | |
| RapidTest.prototype.hasCovid = function() { | |
| const wasABitch = this.wasABitch(); | |
| const isPositive = this.isPositive(); | |
| if (!wasABitch && !isPositive) return false; | |
| return true; | |
| } | |
| const elonDidntFlinch = new RapidTest("Elon Musk", 49, true, false); | |
| const elonFlinched = new RapidTest("Elon Musk", 49, true, true); | |
| console.log("sample1", elonDidntFlinch.hasCovid()); | |
| console.log("sample2", elonDidntFlinch.hasCovid()); | |
| console.log("sample3", elonDidntFlinch.hasCovid()); | |
| console.log("sample4", elonFlinched.hasCovid()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment