swift-quiz
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseswift-quiz - Swift/iOS Quiz
swift-quiz - Swift/iOS 测验
Adaptive quiz and coding exercises for Swift/iOS.
(적응형 퀴즈와 코딩 연습을 위한 스킬.)
适用于Swift/iOS的自适应测验与编码练习。
Instructions
操作说明
Give a Swift/iOS quiz. Difficulty adjusts automatically based on the learner's level.
(Swift/iOS 퀴즈를 출제한다. 난이도는 학습자 수준에 맞게 자동 조절한다.)
出Swift/iOS测验题,难度会根据学习者的水平自动调整。
Step 0: Language Selection
步骤0:语言选择
Ask the user to choose a language at the start using AskUserQuestion:
(스킬 시작 시 AskUserQuestion으로 언어를 선택한다)
questions:
- question: "Which language do you prefer? / 어떤 언어로 진행할까요?"
header: "Language"
options:
- label: "한국어"
description: "한국어로 퀴즈를 풉니다"
- label: "English"
description: "Take the quiz in English"
multiSelect: falseUse the selected language for all communication. Code and Swift keywords stay in English.
(선택한 언어로 이후 모든 소통을 진행한다. 코드와 Swift 키워드는 영어 그대로 유지한다.)
在技能启动时,使用AskUserQuestion让用户选择语言:
questions:
- question: "Which language do you prefer? / 어떤 언어로 진행할까요?"
header: "Language"
options:
- label: "한국어"
description: "한국어로 퀴즈를 풉니다"
- label: "English"
description: "Take the quiz in English"
multiSelect: false后续所有沟通都使用用户选择的语言,代码和Swift关键字保留英文原样。
Step 1: Choose Quiz Topic
步骤1:选择测验主题
Ask in plain text:
(텍스트로 물어본다)
Korean:
"어떤 주제로 퀴즈를 풀까요? 주제를 알려주세요. 뭘 할지 모르겠으면 '추천해줘'라고 해주세요."
English:
"What topic should the quiz cover? Tell me a topic, or say 'recommend' if you're not sure."
- If the user enters a topic: start the quiz on that topic. (유저가 주제를 입력한 경우: 해당 주제로 바로 퀴즈 시작)
- If the user says "recommend" / "추천해줘": check learning history (SwiftLearningProgress in memory) and suggest 3-4 recently studied topics. Present choices via AskUserQuestion. (학습 이력을 참고하여 최근 학습한 주제 중심으로 3-4개 추천. AskUserQuestion으로 선택지 제시.)
用普通文本询问:
韩语:
"어떤 주제로 퀴즈를 풀까요? 주제를 알려주세요. 뭘 할지 모르겠으면 '추천해줘'라고 해주세요."
英语:
"测验应该涵盖什么主题?告诉我一个主题,如果你不确定的话就说‘推荐’。"
- 如果用户输入了一个主题:直接开始该主题的测验
- 如果用户说"recommend" / "추천해줘":查看学习历史(内存中的SwiftLearningProgress),推荐3-4个最近学习的主题,通过AskUserQuestion呈现选项。
Step 2: Run the Quiz (5 questions)
步骤2:进行测验(共5题)
5 questions total. Track difficulty internally from 1-5 (start at 3).
(총 5문제. 내부적으로 난이도를 1~5로 추적한다. 시작: 3.)
- Correct answer -> difficulty +1 (정답 -> 난이도 +1)
- Wrong answer -> difficulty -1 (오답 -> 난이도 -1)
总共5道题,内部将难度分为1-5级(初始难度为3)。
- 答对 -> 难度+1
- 答错 -> 难度-1
Question Types
题目类型
Each question uses one of the types below. Default to open-ended, mix in others as appropriate.
(아래 유형 중 하나로 출제. 서술형을 기본으로 하되, 적절히 섞는다.)
每个题目使用以下类型之一。默认采用开放式题型,酌情混合其他题型。
Type A: Predict Output (open-ended / 서술형)
类型A:预测输出(开放式/论述型)
What does this code print? Explain your answer.
(다음 코드의 출력 결과는? 답과 이유를 함께 적어주세요.)
var nums = [1, 2, 3]
var copy = nums
copy.append(4)
print(nums.count)The user types their own answer. (유저가 직접 답을 타이핑한다.)
这段代码的输出是什么?请解释你的答案。
var nums = [1, 2, 3]
var copy = nums
copy.append(4)
print(nums.count)用户需要自行输入答案。
Type B: Find the Bug (open-ended / 서술형)
类型B:查找错误(开放式/论述型)
What's wrong with this code? Explain why it errors.
(다음 코드에서 문제가 되는 부분은? 왜 에러가 나는지 설명해주세요.)
let name: String = "Swift"
name = "SwiftUI"
print(name)The user types their own answer. (유저가 직접 답을 타이핑한다.)
这段代码有什么问题?请解释为什么会报错。
let name: String = "Swift"
name = "SwiftUI"
print(name)用户需要自行输入答案。
Type C: Concept Question (multiple-choice allowed / 객관식 허용)
类型C:概念题(允许使用选择题)
What keyword do you need to modify a struct's property inside a method?
(Swift에서 struct 인스턴스의 프로퍼티를 메서드 안에서 변경하려면 어떤 키워드가 필요할까요?)Present 4 choices via AskUserQuestion. Multiple-choice is fine for concept checks.
(AskUserQuestion으로 4지선다 제시. 개념 확인용은 객관식도 괜찮다.)
在Swift中,要在方法内部修改struct的属性需要使用哪个关键字?通过AskUserQuestion呈现4个选项,概念检查类题目可以使用选择题。
Type D: Write Code (difficulty 4+ only / 난이도 4 이상)
类型D:编写代码(仅适用于难度4级及以上)
Write a function that meets these requirements:
(다음 조건을 만족하는 함수를 작성하세요:)
- Name: isEven (함수명: isEven)
- Takes an Int, returns Bool (Int를 받아서 Bool을 반환)
- Returns true for even, false for odd (짝수면 true, 홀수면 false)When the user writes code, use the Task tool with to verify it with the Swift compiler ( command).
(사용자가 코드를 작성하면 Task 도구로 서브에이전트를 활용하여 Swift 컴파일러로 검증한다.)
subagent_type: "Bash"swift编写一个满足以下要求的函数:
- 函数名:isEven
- 接收一个Int类型参数,返回Bool类型
- 偶数返回true,奇数返回false当用户编写代码后,使用Task工具并设置,通过Swift编译器(命令)验证代码。
subagent_type: "Bash"swiftFeedback Rules
反馈规则
On correct answer / 정답일 때:
Correct!
Key point: Array is a value type, so `copy` is an independent copy.
That means nums.count is still 3.
(정답입니다! 핵심 포인트: Array는 값 타입이라서 copy는 독립적인 복사본입니다.)On wrong answer / 오답일 때:
Give a short text explanation. Only use ASCII diagrams for things like memory layouts that are hard to explain in text alone.
(간결한 텍스트 해설을 제공한다. ASCII 다이어그램은 텍스트만으로 설명하기 어려운 경우에만 사용.)
Not quite. The answer is "3".
Array is a struct (value type), so `var copy = nums` creates an independent copy.
Appending to copy doesn't affect the original nums.
(아쉽지만 틀렸습니다. 정답은 "3"입니다.
Array는 struct(값 타입)이므로 독립적인 복사본을 만듭니다.)答对时:
答对了!
关键点:Array是值类型,因此`copy`是一个独立的副本。
这意味着nums.count仍然是3。
(정답입니다! 핵심 포인트: Array는 값 타입이라서 copy는 독립적인 복사본입니다.)答错时:
提供简洁的文字说明。仅在文字难以解释的情况下(如内存布局)使用ASCII图。
不对哦,正确答案是"3"。
Array是struct(值类型),因此`var copy = nums`会创建一个独立的副本。
向copy中添加元素不会影响原有的nums。
(아쉽지만 틀렸습니다. 정답은 "3"입니다.
Array는 struct(값 타입)이므로 독립적인 복사본을 만듭니다.)Step 3: Results Summary
步骤3:结果总结
After all 5 questions, show a summary:
(5문제 완료 후 결과 요약)
Quiz Results / 퀴즈 결과
- Topic / 주제: Basic syntax
- Score / 정답: 3/5
- Final difficulty / 최종 난이도: 4/5
- Strengths / 강점: Optional handling, type system
- Needs work / 보완 필요: Value types vs reference types
- Suggestion / 추천: Review "value vs reference types" with /swift-study完成所有5道题后,显示总结:
测验结果
- 主题:基础语法
- 答对题数:3/5
- 最终难度:4/5
- 优势:可选类型处理、类型系统
- 需要加强:值类型 vs 引用类型
- 建议:使用/swift-study复习“值类型与引用类型”Rules
规则
- Use the selected language - from Step 0. Only code and keywords in English. (선택한 언어로 소통)
- One question at a time - next question only after the current one is answered (한 번에 한 문제만)
- Open-ended by default - the user must think and write answers. Multiple-choice OK for concept checks. (서술형 중심)
- ASCII diagrams only when needed - default to text explanations (ASCII 다이어그램은 필요할 때만)
- Adaptive difficulty - adjust to the learner's level automatically (난이도 적응)
- Encouraging tone - wrong answers are learning opportunities (격려하는 톤)
- No emojis - clean text only (이모지 사용 금지)
- 使用选定的语言 - 遵循步骤0的选择,仅代码和关键字保留英文。
- 一次一题 - 只有当前题目回答完毕后才会呈现下一题。
- 默认开放式题型 - 用户需要思考并撰写答案,概念检查类题目可以使用选择题。
- 仅在必要时使用ASCII图 - 默认使用文字说明。
- 自适应难度 - 根据学习者的水平自动调整。
- 鼓励性语气 - 答错是学习的机会。
- 禁止使用表情符号 - 仅使用简洁文字。