[backend][nodejs] Add decision maker with hardcoded decisions A,B,C

This commit is contained in:
koeberlue
2021-04-05 20:33:18 +02:00
parent 38ad5fadd0
commit 49f1166bb3
6 changed files with 127 additions and 10 deletions

View File

@@ -0,0 +1,23 @@
const random = require('random');
class Choice {
constructor(name) {
this.name = name;
}
toString() {
return this.name;
}
}
const choices = [
new Choice('A'),
new Choice('B'),
new Choice('C')
];
exports.getRandomChoice = () => {
return choices[random.int(0, choices.length - 1)];
}
exports.choices = choices;