CS0502 Vibe Coding
Back to OpticAI Lab

CS0502

Vibe CodingIntroduction to AI
and Computer
Science

A project-based introduction to computer science where students learn through vibe coding: directing AI agents to build, test, and explain working computational systems.

A computational core connecting algorithms, logic, data structures, waves, sensors, and engineered systems

Course overview

The essentials for Fall 2026.

课程信息 · Course details

Introduction to Computer Science
计算机科学导论

Course code
CS0502
Term
Fall 2026
Class time
Mon 16:00–17:40
Thu 10:00–11:40 (odd weeks only / 仅单周)
Room
东中院 2-203
Instructor
袁肖赟 · Xiaoyun Yuan
yuanxiaoyun@sjtu.edu.cn
Teaching assistants
季飞宇 · Feiyu Ji
jownr25@sjtu.edu.cn
陈敏冲 · Minchong Chen
chenminchong@sjtu.edu.cn
Course platform
Canvas — course materials, references, submissions, group projects, and recordings. Please follow the course site for current deadlines and schedule updates.

评分构成 · Assessment

How the course is assessed.

30%Assignments
课后作业(3 次)
20%Group project
小组项目(3–5 人)
40%Final exam
期末考试
10%Participation
课堂表现

Topics · 课程主题

  • Programming, data structures & algorithms
  • Architecture, operating systems & software engineering
  • Networks, security, databases & visualization
  • AI, machine learning, computer vision & frontiers

Tentative schedule: Sep 14–Dec 28, 2026. 日程可能根据教学进度调整,请以课程网站为准。

Course tutorials

Learn the agent workflow before you build.

01 Before you begin OpenCode video tutorials Use this video series to learn the basic workflow of talking with, iterating with, and debugging through an AI coding agent before beginning the course projects.
02 Introduction to data structures Sequential List Visual Lab Explore contiguous memory, base, i, and n pointers while visualizing access, search, insertion, and deletion in a sequential list.

An interactive classroom demo for the introduction to data structures. Choose an operation or use step-by-step mode to inspect memory cells and pointer changes.

Course projects

Learn to program by talking to computers.

01 计算基础 图灵机 与 AI coding agent 一起构建可运行、可检查的图灵机,用测试用例验证,并记录从输入到停机的完整过程。

使用下方提示词与 coding agent 多轮迭代,并提交可运行 HTML、简短录屏和图文迭代报告。

提交内容

完成你的图灵机项目

  1. 01
    用 AI agent 完成图灵机。

    不要自己手写代码;通过与 AI coding agent 对话,做出一个能运行、能复现课堂指定算法的图灵机,并提交可直接运行的 HTML 文件。

  2. 02
    提交一段运行录屏。

    除 HTML 文件外,再提交一段简短录屏,展示输入、运行过程和最终结果。

  3. 03
    提交图文并茂的迭代报告。

    一次对话通常不够。请记录每一轮对话得到的结果、发现的问题、你再次输入的提示词,以及该轮解决了什么;尽量附上界面或运行截图。

  4. 04
    扩展功能可获得加分。

    完成基本功能即可获得基础分。在此基础上实现额外功能,例如扩展图灵机的能力、增加更丰富的交互或更多算法演示,可获得加分。

Agent 提示词

把这段提示词交给你的 coding agent

请生成一个可直接运行的图灵机模拟器网页,保存为一个单独的 HTML 文件。

## 最重要要求

这个 HTML 文件必须能直接双击打开使用,不需要安装任何软件,不需要运行任何命令,不需要本地服务器,不需要联网。
- 所有代码、样式、资源全部内联在这个 HTML 文件里
- 不许使用 <script type="module">
- 不许从网络加载任何内容(完全离线可用)
- 不许写任何需要用户额外操作的代码

## 技术方案

用 React 18 实现(它有 UMD 格式,可以直接内联到 HTML 中)。
React 和 ReactDOM 的 UMD 文件从 https://unpkg.com/react@18/umd/ 下载后内联。
用 esbuild 的 build() API 将源码打包成 IIFE 格式内联到 HTML。
jsx 用经典模式(React.createElement),不要用 automatic JSX runtime。
所有 CSS 内联在 <style> 标签中。
Lucide 图标用内联 SVG 替代,不要引入图标库。

## 功能要求

制作一个交互式图灵机模拟器,面向大学课堂投影教学,中文界面。

### 核心界面

页面打开后直接显示模拟器(不要宣传首页)。第一视觉重点是横向纸带。每个格子显示一个符号,当前格子高亮,读写头在格子上方。
纸带可以向左右无限扩展(内部用 Map<number, string> 实现,只渲染读写头周围 15 格的窗口)。
纸带上方显示状态寄存器,包括:当前状态、当前读取符号、执行步数、运行状态(就绪/运行中/已暂停/接受/拒绝/已停机/错误)。

### 控制功能

- Demo 选择菜单(三个内置示例)
- 输入字符串 + 应用输入按钮
- 重置按钮
- 单步执行按钮
- 连续运行 / 暂停按钮
- 后退一步按钮
- 执行速度滑块
- 转移规则表(支持添加、删除、编辑规则,检查重复规则)
- 执行日志(显示中文步骤说明和形式化 δ 规则)
- 自定义图灵机编辑器(编辑状态集、字母表、规则等)
- 导入 / 导出 JSON 文件

### 特殊符号约定

- ⊢ 输入左边界;⊣ 输入右边界;□ 空白符
- 初始状态 q0;接受状态 q_accept;拒绝状态 q_reject
- 支持 L(左移)、R(右移)、S(不动)三种移动
- 如果当前状态+读取符号没有对应规则,显示“未定义转移”并停机(不许报错)
- 设置最大执行步数(如 1000 步)防止无限循环

### 三个内置示例

1. 一进制加法:输入 11101111(表示 3+4),运行后得到 1111111。动画展示扫描第一个操作数、删除分隔符、扫描第二个操作数、停机。
2. 二进制加一:输入 1011 输出 1100,111 输出 1000。正确处理进位和全 1 的情况。
3. 二进制回文识别:1001 进入接受状态,1010 进入拒绝状态。展示标记首尾字符、来回扫描的过程。

### 动画效果

每一步的动画按顺序播放:读取高亮→规则高亮→写入淡入淡出→读写头移动→状态更新。
连续运行时也必须按阶段播放,不能直接跳到最终结果。速度滑块能明显控制动画快慢。后退一步能恢复纸带、读写头和位置。

### 教学反馈

执行日志显示可读的中文步骤,同时显示形式化规则,例如:
δ(q0, 1) = (q1, 0, R)

停机后显示结果摘要:是否接受、总步数、最终状态、最终纸带内容、停机原因。

### 自定义模式

用户可以编辑:状态集合、输入字母表、纸带字母表、空白符、左右边界符、初始状态、接受状态、拒绝状态、初始纸带内容、读写头初始位置、转移规则。
支持用表格编辑规则,也支持粘贴文本格式的规则(如 q0,1 -> q1,0,R)。修改配置后可以立即重置并运行。

## 工程质量

- 不要把所有代码写在一个组件里,保持代码结构清晰
- 图灵机执行引擎要写成独立的模块,与界面分离
- 页面不能有文字重叠、按钮溢出或纸带格子变形
- 按钮用图标+文字,适配电脑和平板屏幕
- 为图灵机引擎写单元测试,覆盖三个示例的预期结果、负坐标移动、空白格读写、未定义规则、后退恢复和最大步数停止
- 不要留下 TODO、占位按钮或不可用功能
- 运行测试确认全部通过

使用完整提示词作为起点,与 coding agent 多轮对话、测试并解释你最终完成的实现。

02 数据结构与算法 校园寻路项目 使用校园地图项目资料,与 AI coding agent 对话,把它逐步改造成你自己的数据结构与寻路项目。

本项目提供项目网页、任务说明和建议提示词;请自行设计并迭代与 AI coding agent 的对话策略。没有参考实现。

项目任务

完成校园寻路项目

  1. 01
    完成核心数据结构。

    为校园地点实现数组、链表、二分查找和二叉搜索树。

  2. 02
    完成图搜索与最短路。

    从提供的图数据建立邻接表,并完成 BFS 与 Dijkstra;可由 AI agent 自行实现或选用合适的图算法库。

  3. 03
    在项目资料上迭代。

    保持地图数据不变,用自己的 AI agent 对话完成和改进项目。完整顺序见任务说明。

  4. +1
    扩展更高级算法。

    可实现哈希表、A* 等扩展算法;如实现 A*,在报告中与 Dijkstra 比较理论差异和实验结果。

  5. +2
    优化 Web app。

    对可视化、交互或整体使用体验做出实质改进,可获得额外加分。

提交内容

需要提交什么

  1. 01
    基础任务:可运行项目。

    提交完成后的完整网页文件夹或压缩包;无需提交代码仓库。它应能直接打开,并展示所有基础数据结构与 BFS、Dijkstra 功能。

  2. 02
    基础任务:运行录屏。

    提交简短录屏,展示地点查找、起终点选择、寻路过程与结果。

  3. 03
    基础任务:图文迭代报告。

    记录每轮与 AI agent 的对话结果、发现的问题、后续提示词、解决方案和关键截图;说明算法原理、各数据结构的优势、不同算法的比较,并用实验结果支撑结论。

  4. +1 / +2
    加分内容。

    可扩展哈希表、A* 等更高级算法;Web app 优化也可加分。所有加分内容都需在录屏和报告中清楚展示。

项目网页中的查找与寻路算法尚未实现。选择起终点后点击“运行寻路”,页面会明确提示“算法尚未实现”;这正是你需要完成的部分。

03 Networks, security & operating systems PeerDrop Build a real file-transfer system between two devices on a trusted local network, with encryption, authentication, and integrity verification.

This project provides no complete prompt or reference implementation. Design your own AI-agent collaboration, technical approach, and testing strategy.

Project task

Build secure local-network file transfer

  1. 01
    Transfer one real file across two devices.

    Use two independent devices on one trusted local network. Enter the receiver’s IP address and port manually, then send and save a real file.

  2. 02
    Protect the file with hybrid encryption.

    Use mature cryptographic libraries: a random file key encrypts the file, while the receiver’s RSA public key encrypts that file key; the receiver restores it with the private key before decrypting.

  3. 03
    Authenticate and verify the transfer.

    The sender signs a SHA-256 digest with RSA; the receiver verifies the signature before decryption, then compares SHA-256 for the original and received files.

What to submit

Runnable project, real demo, and iteration report

  1. 01
    Core: runnable project and complete source code.

    Submit the full project folder or a ZIP containing all HTML, Python, and other source code, plus a README. The code must reproduce the demonstrated result.

  2. 02
    Core: two-device recording.

    In 60–120 seconds, show a real transfer, signature verification, decryption, SHA-256 comparison, and the saved result.

  3. 03
    Core: illustrated iteration report.

    Record AI-agent rounds, issues, follow-up prompts, resolutions, and screenshots. Explain RSA public/private keys, the file key, SHA-256, signatures, and the difference between confidentiality, authentication, and integrity.

  4. +1 / +2
    Bonus: reliability and experience.

    Pairing and accept/reject, transfer status and progress, error handling, automatic discovery, history, and multi-file queues can earn bonus credit.

The project web page is an interface reference only; it contains no real transfer or cryptographic implementation. Try LocalSend first to observe a mature local-network transfer product’s interactions and boundaries. Test only on devices and trusted local networks you control; never expose it to the public internet or transfer sensitive files.

04 Foundations of Artificial Intelligence Foundations of Artificial Intelligence Choose exactly one of three fixed projects—data mining, neural networks and deep learning, or small language models—then build your own AI application.

This is an individual choose-one-of-three project. Select exactly one fixed project—A, B, or C. The instructor provides the task, data, or model notes; no complete AI prompt or reference implementation is provided.

Choose exactly one of three projects

Build your AI project with an AI agent

  1. A
    Retail customer segmentation and insights.

    Construct RFM features from transaction data and cluster with K-Means; show segment profiles, business suggestions, and one changed-setting comparison.

  2. B
    Smartphone activity recognition: MLP vs. 1D CNN.

    Train both an MLP and 1D CNN with UCI HAR; compare accuracy, confusion matrices, and one easily confused activity pair.

  3. C
    MiniMind: deployment, multimodality, and news LoRA.

    Complete any two of three MiniMind tasks: run base MiniMind-3, deploy the MiniMind-O multimodal WebUI, or fine-tune a finance/sports/gaming news-topic LoRA. Every task needs run evidence and a short analysis.

What to submit

Runnable app, complete code, and illustrated report

  1. 01
    Complete project and code.

    Submit the full project folder or ZIP containing HTML, Python, and other source code, plus a runnable app and README.

  2. 02
    Project recording.

    Show the app running, its main results, and the model or setting comparison required by your selected project.

  3. 03
    Illustrated project report.

    Explain data, method, results, AI-agent iteration, problems, and a limitation or failure case; complete the project-specific analysis.

  4. +1
    Extended experiments or interaction.

    Complete a listed bonus experiment, error analysis, visualization, or web-interaction improvement from your selected project.

Complete prompts are kept only for staff feasibility checks; they are neither provided to nor expected from students. Design your own prompts and record your dialogue and iteration in the report.

05+

More projects are coming.

Future project briefs will be added here as the course develops.

Course feedback

Help improve the next iteration.

Share course feedback

Share feedback on the tutorials, project briefs, course pacing, or an issue you encountered. Sign in to Feishu to complete this short questionnaire and help us improve the course over time.

Do not include passwords, API keys, access tokens, or other sensitive content.

Give feedback