|
|
@ -58,10 +58,8 @@ module.exports = async () => { |
|
|
|
const isCorrect = await randomBool(127); |
|
|
|
const isCorrect = await randomBool(127); |
|
|
|
if (col < correctCol) { |
|
|
|
if (col < correctCol) { |
|
|
|
arrows = isCorrect ? eArrows : [...sArrows, ...nArrows, ...wArrows]; |
|
|
|
arrows = isCorrect ? eArrows : [...sArrows, ...nArrows, ...wArrows]; |
|
|
|
charMatrix[correctRow][col] = await randomOf(arrows); |
|
|
|
|
|
|
|
} else if (col > correctCol) { |
|
|
|
} else if (col > correctCol) { |
|
|
|
arrows = isCorrect ? wArrows : [...sArrows, ...nArrows, ...eArrows]; |
|
|
|
arrows = isCorrect ? wArrows : [...sArrows, ...nArrows, ...eArrows]; |
|
|
|
charMatrix[correctRow][col] = await randomOf(arrows); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
charMatrix[correctRow][col] = await randomOf(arrows); |
|
|
|
charMatrix[correctRow][col] = await randomOf(arrows); |
|
|
|
answerMatrix[correctRow][col] = isCorrect; |
|
|
|
answerMatrix[correctRow][col] = isCorrect; |
|
|
@ -112,8 +110,6 @@ module.exports = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//console.log(charMatrix, answerMatrix);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//insert the captcha to db and get id
|
|
|
|
//insert the captcha to db and get id
|
|
|
|
const captchaId = await Captchas.insertOne(answerMatrix.flat()).then(r => r.insertedId); |
|
|
|
const captchaId = await Captchas.insertOne(answerMatrix.flat()).then(r => r.insertedId); |
|
|
|
|
|
|
|
|
|
|
|