forked from csarkar373/python-games
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringnegnc.js
More file actions
30 lines (27 loc) · 987 Bytes
/
stringnegnc.js
File metadata and controls
30 lines (27 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import QuestionBaseClass from "../components/questionbaseclass";
//import * as StringConstants from "./stringconstants";
function stringQuestionNegNC(props) {
const currentWord = "ABCDEFGH";
// question will have 1 row and 8 columns
const sq = new QuestionBaseClass(props, 1, currentWord.length);
// adjust the button display values
for (let i = 0; i < currentWord.length; ++i) {
sq.displayValues[0][i] = currentWord.substring(i, i + 1);
}
//console.log("array question base class", sq);
sq.pointValue = 3;
sq.rows = 1;
let lowerBound = Math.floor(Math.random() * currentWord.length);
let upperBound = currentWord.length;
for (let i = lowerBound; i < upperBound; i += 1) {
sq.buttonStates[0][i] = 1;
}
lowerBound = lowerBound - currentWord.length;
upperBound = upperBound - currentWord.length;
sq.text = [
'string = "' + currentWord + '"',
"print(string[ " + lowerBound + ": ])",
];
return sq;
}
export default stringQuestionNegNC;