Refactor levels to YAML, remove icons, add vite-plugin-yaml
This commit is contained in:
48
frontend/src/lib/levels/01.yaml
Normal file
48
frontend/src/lib/levels/01.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
id: 1
|
||||
title: 认识寄存器
|
||||
subtitle: 小机器人的记忆槽
|
||||
description: 学习 MOV 指令给寄存器赋值
|
||||
|
||||
tutorial:
|
||||
- title: 什么是寄存器?
|
||||
text: >
|
||||
CPU 是计算机的大脑,而**寄存器**是它手边的小抽屉 ——
|
||||
速度最快的存储空间!我们的机器有 8 个寄存器:**R0** 到 **R7**。
|
||||
- title: MOV 指令
|
||||
text: >
|
||||
`MOV` 把一个数字放进寄存器。注意数字前面要加 **#** 号,表示"这是一个数值":
|
||||
code: |
|
||||
MOV R0, #42 ; 把 42 放进 R0
|
||||
MOV R1, #100 ; 把 100 放进 R1
|
||||
- title: HLT 指令
|
||||
text: >
|
||||
程序最后要写 `HLT`(halt = 停止),告诉机器"运行结束!"
|
||||
code: |
|
||||
MOV R0, #42
|
||||
HLT
|
||||
|
||||
goal: 把数字 **42** 放进 **R0** 寄存器
|
||||
|
||||
initialState: {}
|
||||
|
||||
testCases:
|
||||
- init: {}
|
||||
expected:
|
||||
registers:
|
||||
R0: 42
|
||||
|
||||
hints:
|
||||
- "MOV 的格式:MOV 寄存器, #数字"
|
||||
- "试试:MOV R0, #???"
|
||||
- "答案:MOV R0, #42 然后 HLT"
|
||||
|
||||
starThresholds: [2, 3, 5]
|
||||
|
||||
starterCode: |
|
||||
; 把 42 放进 R0 寄存器
|
||||
; 提示:数字前面要加 # 号
|
||||
|
||||
|
||||
HLT
|
||||
|
||||
showMemory: false
|
||||
Reference in New Issue
Block a user