"Not greedy" level

This commit is contained in:
Egor Guslyancev 2024-05-02 09:05:31 -03:00
parent f8088142c0
commit 279c07ea41
GPG Key ID: D7E709AA465A55F9
2 changed files with 8 additions and 10 deletions

View File

@ -17,7 +17,7 @@ import timeout as tmo
# Simple config
GET_ONLY_FOR_VIP = True
POST_ONLY_FOR_VIP = True
VERSION = "20240502.1"
VERSION = "20240502.2"
CHARSET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

16
user.js
View File

@ -2,7 +2,7 @@
// @name Sorryops
// @name:ru Сориупс
// @namespace https://git.disroot.org/electromagneticcyclone/sorryops
// @version 20240502.1
// @version 20240502.2
// @description Collect and reuse ORIOKS test answers
// @description:ru Скрипт для сбора и переиспользования ответов на тесты ОРИОКС
// @icon https://orioks.miet.ru/favicon.ico
@ -25,7 +25,7 @@
// ==/UserScript==
/* Version */
const VERSION = "20240502.1";
const VERSION = "20240502.2";
/* End Version */
/* Charset */
@ -47,7 +47,7 @@ const all_labels = {
auto_answer_no: "No",
auto_answer_first: "First",
auto_answer_random: "Random",
auto_answer_not_greedy: "Pick known answers until all of them will be found",
auto_answer_not_greedy: "Choose a known answer if there are more wrong answers than that number",
display_values: "Answers variant",
display_values_ori: "ORIOKS",
display_values_sorry: "Sorry",
@ -73,7 +73,7 @@ const all_labels = {
auto_answer_no: "Нет",
auto_answer_first: "Первый",
auto_answer_random: "Случайный",
auto_answer_not_greedy: "Выбирать известные ответы пока все не будут найдены",
auto_answer_not_greedy: "Выбирать известный ответ, если неправильных больше этого числа",
display_values: "Вариант отображения ответов",
display_values_ori: "ОРИОКС",
display_values_sorry: "Сори",
@ -159,8 +159,8 @@ var config = new GM_config({
},
auto_answer_not_greedy: {
label: labels.auto_answer_not_greedy,
type: 'checkbox',
default: false,
type: 'number',
default: -1,
},
display_values: {
label: labels.display_values,
@ -650,7 +650,7 @@ function auto_answer() {
}
if (correct != undefined) {
pick_answer(correct);
} else if ((incorrect.length != 0) && config.get('auto_answer_not_greedy')) {
} else if ((incorrect.length >= config.get('auto_answer_not_greedy')) && (config.get('auto_answer_not_greedy') > 0)) {
chosen_answer = Math.floor(Math.random() * incorrect.length);
pick_answer(incorrect[chosen_answer]);
} else if (auto_answer == labels.auto_answer_random) {
@ -892,8 +892,6 @@ function result_page_handler() {
correct: correct_num,
all: all_num,
});
} else {
config.set('auto_answer_not_greedy', false);
}
GM_setValue('fetched_data', {});
GM_setValue('new_answer_f', false);