Skip to main content

031 · UCSC CSE140 p0 — CS188 风格 Pacman warmup

项目 内容
学校 UC Santa Cruz
课程 CSE 140 Artificial Intelligence(作业改编自 Berkeley CS188 Pacman 项目)
方向 Python / 基础建模与最优化
语言 Python
难度 入门 / Introductory
上游仓库 https://github.com/ucsc-cse-140/cse140-assignments-public(课程官方仓库)

为什么收录

课程官方公开作业仓库,p0 是 Berkeley CS188 classic search 项目的 warmup:buyLotsOfFruit(价格表查表计算)与 shopSmart(遍历商店选最优价)。starter 标准的 *** Your Code Here *** 风格,期望输出写在 docstring 里,可机器验证。仓库还有 p1/p2(DFS 搜索等更深入的 Pacman 项目)留作后续。

The official public assignment repo; p0 is the CS188-style warmup (buyLotsOfFruit + shopSmart) with a standard “Your Code Here” starter and docstring-verified expected output.

实测结果

  • 7/7 通过:12.25 总价、缺货水果返回 None、两商店择优、两个 main 的 docstring 期望输出
  • 发现一处真实不一致:docstring 写 “best shop is shop1.”,而 shop.py 的 main 实际打印 “the best shop is shop1.”——测试断言以实际代码为准并注释说明

七章解析

题目解读 · 设计思路 · 逐步实现 · 正确性与复杂度 · 调试与测试 · 踩坑清单 · 延伸练习

源码与测试

题目目录 · 参考实现 · 测试