作者 Author:Justin( j_q_king@foxmail.com

起笔 Created: 2024-08-06 Tue 22:47 | 凝墨 Modified: 2025-02-10 Mon 13:29

interact

关于 interact 板块主介绍:这里最大的特征是所有 HTML 都是从 0 写的。

一些富有创造力的趣味内容,将过往知道的知识用一用,比如 html css js ——用好了就可以放在博客里了。

由于是手搓网站,所以大部分内容没有美化,我也认识到开发中有一个设计师的重要,一个同时考虑功能架构,就能难再把设计色彩的事情放脑子里(也可能我并没有自以为那么审美能力唉)

一个没有小游戏互动的网站该多没意思


1. fitQuest 拟合小游戏

<2025-02-10 Mon 13:27>

看你能不能拟合上嘿,挑战数感!

fitQuest/fitQ2.html

目前简单模式可玩,预备图像化选项。

下面这个结构流程图是利用 plantuml (AI辅助)代码渲染

@startuml

start

:Load MathJax;
:Get DOM elements;
:Set canvas parameters;
:Initialize global variables;
:Draw axes and grid;
:Add event listeners;

fork
        partition "Generate New Function" {
        :Click "Generate New Function" button;
        :Select difficulty level;
        if ("Difficulty level check") then (Beginner)
            :Generate a random function for beginner level;
        elseif (Intermediate) then
            :Generate a random function for intermediate level;
        elseif (Advanced) then
            :Generate a random function for advanced level;
        endif
        :Draw the target function curve;
        :Start the timer;
    }
fork again
        partition "Add/Edit Function" {
        :Select function type and parameters;
        :Click "Add" / "Confirm" button;
        if ("Is in edit state?") then (Yes)
            :Update the corresponding function information in the functions array;
        else (No)
            :Add a new function to the functions array;
        endif
        :Render LaTeX expression;
        :Update plot and error;
    }
fork again
        partition "Delete Function" {
        if ("Operation mode check") then (Double - click LaTeX expression)
            :Delete the corresponding function information;
        else (Click "Clear" / "Delete" button)
            if ("Is in edit state?") then (Yes)
                :Remove the currently edited function from the functions array;
            else (No)
                :Clear the functions array;
            endif
        endif
        :Render LaTeX expression;
        :Update plot and error;
    }
fork again
        partition "Save State" {
        :Click "Save" button;
        if ("Are there target and user functions?") then (Yes)
            :Calculate the error;
            :Save state information to the savedStates array;
            :Generate a thumbnail;
            :Display saved information;
        else (No)
            :Prompt that functions are not generated;
        endif
    }
fork again
        partition "Advanced Input Panel" {
        if ("Operation type check") then (Click insert button)
            :Insert symbol into the input box;
        else (Input expression)
            :Convert to LaTeX format;
        endif
        :Preview LaTeX in real - time;
    }
fork again
        partition "Load Saved State" {
        :Click the saved thumbnail;
        :Find the corresponding state information from the savedStates array;
        :Update the target function and user - input function;
        :Redraw the function curves;
        :Update error display;
    }

stop

@enduml

2. mg 数字小交互尝试

这是一趟数学之旅,你和主人公一起思考探索

我用它练手 html 知道一些选择方块小知识。于是在我了解到基本内容之后,暂时放下,未来会考虑加入丰富内容,并且拓展到我一直想要做的抽象代数部分。

快去玩 -> mg/tapnum.html

一直希望让网页发挥互动的价值,碰巧发现很好的素材,于是尝试实现一下。

快去玩 -> mg/21mg_choose.html

这是之前的 demo ,现在做了第一部分完整版了。不过很快发现后面的实现很有挑战性…

话说之后想用 org 直接导出,不过又感到也许 vscode 有些功能实在不忍割舍。

做到了:

  • 选择判断改变;
  • 触发下一显示;
  • 中英切换显示;
  • 保存重置进度:这个最有意思,是在之前语言切换学的(可以发现语言即使刷新重启依然会记得上次选择的是什么),本来想用 json 等等
  • 阻止刷新页面。

美观度 0,仅仅给剧情对话换了楷体,本来想用方正兰亭宋,但还要授权,不敢不敢。

可以进一步完善: 文字出现动画、统一显示语言


3. pg 反复囚徒困境

囚徒困境小游戏

这是一个(还在施工 <2024-08-09 Fri> )较为完整的内容

希望做成可拓展自定义美观的

启发是看到《合作的进化》这本书,里面研究了重复囚徒困境的情况,给出了博弈模型。

我想要实现的核心是后面提到的领土变化,这个听上去很有意思

3.1. 开发笔记

<2024-08-25 Sun 10:44> 现在实现了单轮和多轮游戏,自定义策略输入代码并执行还没想好,暂且先进一步做一些美化吧