Gooboo辅助

循环学习、参加考试、使用装备、循环播种

< 腳本Gooboo辅助的回應

提問/評論

§
發表於:2024-09-22
編輯:2024-09-22

修复下数学答题到100层左右后只能拿个位数分数的问题, 修改后能140~150分
(评论可点击展开查看代码, 手动修改替换脚本中同名函数即可)

测试发现有少部分题目生成的时候就有不可逆的舍入误差, 无法保证回答正确, 但数量较少, 不影响答题 修复了下科学计数法的题目不支持乘除法的问题, 修复了输出可能是科学计数法的问题(游戏用的parseInt)

    // 数学,自动计算
    async function auto_calc() {
        let id
        let question = null
        id = setInterval(function() {
            let answer = ""
            let next_question = document.querySelector(".question-text")
            if (next_question == null) {
                clearInterval(id);
                return
            }
            if (question === next_question.innerText) {
                return
            }
            question = next_question.innerText

            let input = document.querySelector("#answer-input-math")
            input.value = ""
            input.dispatchEvent(new Event("input"))
            if(question.indexOf("^") > 0){
                const nums = question.split("^")
                answer = Math.pow(nums[0], nums[1])
            } else if (question.startsWith("√")) {
                answer = eval(question.replace("√", ""))
                answer = Math.sqrt((answer))
            } else if (question.indexOf("e") > 0) {
                let qs = question.split(" ");
                let x = BigNumber(qs[0]);
                let y = BigNumber(qs[2]);
                if (qs[1] == '+') {
                    answer = x.plus(y)
                } if (qs[1] == '-') {
                    answer = x.minus(y)
                } if (qs[1] == '*') {
                    answer = x.multipliedBy(y)
                } if (qs[1] == '/') {
                    answer = x.dividedBy(y)
                }
                answer = answer.toFixed(0)
            } else {
                answer = eval(question)
            }
            answer = answer.toString()
            if (answer.indexOf("e") > 0) {
                answer = (answer * 1).toLocaleString(undefined, {useGrouping:false})
            }
            input.value = answer
            input.dispatchEvent(new Event("input"))
            let btn = [...document.querySelectorAll(".v-btn__content")].find(item=>item.innerText === "答题")
            btn.click()
            //console.log(question, answer, !!document.querySelector(".score-add-light"))
        }, 200)
    }

發表回覆

登入以回復

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址