ECE2810J — Data Structures and Algorithms

SpringBoot+Vue+MySQL 高校学科竞赛平台 完整可运行版(源码+文档) 本项目基于SpringBoot+Vue+MySQL构建高校学科竞赛管理平台,覆盖学生、教师、领队教师、管理员四大角色,实现竞赛发布、报名、刷题、评分、公示等全流程闭环管理。系统架构清晰,技术主流,配套完整源码、数据库脚本、万字论文、开题报告、答辩PPT及部署文档,支持一键运行,适用于毕业设计、课程设计及院系二次开发,真正实现“开箱即用”。 阅读详情

ECE2810J — Data Structures

and Algorithms

Programming Assignment 3

— UM-SJTU-JI (Fall 2024)

Notes

• Submission: on JOJ

• Due at Dec 1st, 2024, by 23:59

1 Introduction

In this assignment, you are tasked with implementing a C++ solution to a simpliffed version of the “sokoban” game,

where the objective is to push speciffc boxes to designated target positions on a grid. The challenge lies in devising an

efffcient strategy to navigate the grid, avoid obstacles, and ensure that all required boxes reach their target locations.

Your program should be able to handle various conffgurations of boxes, walls, and goals, ensuring the correct boxes are

pushed to their intended destinations. This project is C++ only, no other language is allowed.

2 Programming Assignment

2.1 Read Map

The map is designed as a grid where each cell is either a walkable path, a wall, or a point of interest (like the starting

point or a box). The ffrst line of the ffle deffnes the dimensions of the map in terms of columns and rows. The rest of

the ffle speciffes the content of each cell in the grid, using a series of symbols to represent different elements:

• . - Path: This represents a walkable path where the player can move freely. Boxes can also be pushed across

this type of cell.

• # - Wall: This represents an impassable barrier. Neither the player nor the boxes can pass through these cells.

• S - Starting Point: This is where the player begins. Each map should contain exactly one S character.

• B - Box’s Original Position: The initial position of a box.

• T - Target Position for Boxes: The destination cell for a box.

• R - Box at Target Position: This indicates that a box has been successfully pushed to its target position.

To ensure a valid and challenging map, the following constraints must be met:

(1) The outermost boundary of the map must be composed entirely of walls (#) to prevent the player or boxes from

exiting the map area.

(2) Each map must contain exactly one starting point (S).

(3) For test cases of the ffrst part on JOJ, the number of boxes (B) will be less or equal to 8 and the result of rows

times columns should be less or equal to 800.

(4) For test cases released on Canvas, it can be very complicated.

The player can move in four cardinal directions:

• Up

1• Down

• Left

• Right

The player can push a box if it is adjacent in one of these directions, and if the cell behind the box in that direction is

a path (.). Boxes can only be pushed. In other words, they cannot be pulled. Only one box can be pushed at a time,

and the player must move to the former box’s position after pushing it.

Below is an example of a map conffguration ffle. In this example, the map size is speciffed on the ffrst line as 11 10,

indicating 10 rows and 11 columns. The outer boundary is composed of walls (#), while inner cells deffne paths, the

starting point, box positions, and target positions.

11 10

###########

#..#..#...#

#..B....#.#

#..##.#...#

##.#...B###

##.#.....##

#SBBTT#..##

#..#.TT.###

####..#####

###########

2.2 Search routes

Help the player to ffnd the shortest route to push all the boxes to the expected place. Please notice that it is possible

that there are multiple boxes and multiple target positions. The player should push all the boxes to the target positions.

2.3 Show the route

The task requires the program to display the player’s route on the map, detailing each movement step-by-step. Each

step should be represented by a character indicating the direction moved:

• U for up

• R for right

• L for left

• W for down

For instance, given the map conffguration shown, the route may look like:

DRURRUURUURRDDDLLLDDRRRURULLLDLDRULLLUUULUURDRRURDDDDDLLLUUULURRRURDDDDULD

This format will be used as the return value of the solve function provided in the template code.

Bonus Requirements

(1) Display the map, player, boxes, and other elements at each step using the same format as the input map. Store

all the map state in a ffle, ensuring it is clear and easy to read.

2(2) Use a graphical interface to visually represent each step, showing the map, player, boxes, and other elements in

their updated positions. The output should be displayed as an animation, with each step shown for a brief period

before transitioning to the next step.

2.4 Unsolvable Maps

In some cases, a map conffguration may be unsolvable due to the positioning of walls or boxes, creating an impasse

that prevents the player from reaching all targets. Such conffgurations are referred to as “invalid maps.” This occurs

when one or more boxes are placed in positions from which they cannot be moved to their designated target cells.

A map is considered invalid if:

• There is more than one starting point or no starting point.

• There are more boxes than target positions.

• A box is surrounded by walls or other boxes in a way that makes it immovable.

• Any box is placed in a corner or against a wall where it has no path to the target position.

The following example demonstrates a typical invalid map layout:

11 10

###########

#..#..#...#

#.#B....#.#

#..##.#...#

##.#....###

##.#.....##

#S..TT#..##

#..#.TT.###

####..#####

###########

In this map: The box (B) is located next to walls on two sides, which prevents it from being moved toward the target

position (P).

When the program encounters such a conffguration, it should recognize the situation as unsolvable and output a

message as “No solution!” The program should then terminate without attempting to ffnd a solution or display a route.

3 Input / Output

As mentioned above, the input map is stored in a ffle. To test your program, you can use the following command to

read the map from a ffle:

1 ./main < inputMap.txt

For submission on JOJ, the output (i.e. the return value of the function) should either be “No solution!” or the route

to push all the boxes to the target positions.

If you have implemented the ffrst bonus requirements, you should ffrst display the steps in the format mentioned above,

and then display the map at each step. We highly recommend you to store the map at all steps in a ffle. For example,

if the output is stored in a ffle named output.txt, you can use the following command:

31 ./main < inputMap.txt > output.txt

If you have implemented the second bonus requirements, you should display the map in a graphical interface.

4 Submission

(1) For part 1 on JOJ, submit your source code in one ffle named sokoban.hpp. Your source code should include a

function named solve and a function named read_map.

(2) For part 2 on JOJ, put the detailed route output in the answers part in sokoban.hpp. The test cases will be

released on canvas, which may take a long time for your program to run. Please notice that part 2 and bonus

will be graded if and only if you can pass 80 percent of the test cases in part 1.

(3) Submit the source code on Canvas along with a corresponding Makefile to compile the source code. A sample

Makefile is provided on Canvas, which you may modify as needed. Your code submitted on Canvas should be

able to compile successfully and output the detailed route with the corresponding input ffle.

(4) (Optional) If you have implemented the ffrst bonus requirement, you also need to submit the output ffles on

Canvas. The naming format should match the original ffle name. For example, if the input ffle is named big_1.in,

the output ffle should be named big_1_detail.out. Failure to follow the correct naming format will result in

an invalid submission.

(5) (Optional) If you have implemented the second bonus requirement. You may come to the TA’s offfce hours

to demonstrate your program. The due date will be the same. The TA will give you a score based on the

demonstration.

5 Implementation Requirements and Restrictions

5.1 Requirements

• You must make sure that your code compiles successfully on a Linux operating system with g++ and the options

-std=c++1z -Wall -Wextra -Werror -pedantic -Wno-unused-result -Wconversion -Wvla.

• You can use any header ffle deffned in the C++17 standard. You can use cppreference as a reference.

5.2 Memory Leak

You may not leak memory in any way. To help you see if you are leaking memory, you may wish to call valgrind, which

can tell whether you have any memory leaks. (You need to install valgrind ffrst if your system does not have this

program.) The command to check memory leak is:

valgrind --leak-check=full <COMMAND>

You should replace <COMMAND> with the actual command you use to issue the program under testing. For example, if

you want to check whether running program

./main < input.txt

causes memory leak, then <COMMAND> should be “./main < input.txt”. Thus, the command will be

valgrind --leak-check=full ./main < input.txt

45.3 Code Quality

We will use cpplint, cppcheck to check your code quality. If your code does not pass these checks, you will lose some

points.

For cpplint, you can use the following command to check your code quality:

1 cpplint --linelength=120

,→ --filter=-legal,-readability/casting,-whitespace,-runtime/printf,

2 -runtime/threadsafe_fn,-readability/todo,-build/include_subdir,-build/header_guard

,→ *.h *.cpp

For cppcheck, only things related to error will lead to deduction. You can use the following command to check your

code quality:

1 cppcheck --enable=all *.cpp

6 Grading

6.1 Correctness

We will use the test cases on JOJ and Canvas to verify the correctness of your code. This section will have a total

score of 100 points.

6.2 Code Quality

Bad code quality will lead to a deduction of up to 20 points.

6.3 Bonus

For the ffrst bonus requirement, you can get up to 10 points. For the second bonus requirement, you can get up to

30 points. Please notice that bonus will be graded if and only if all the small test cases are passed. What’s more, the

total score will not exceed 130 points.

7 Late Policy

Same as the course policy.

8 Honor Code

Please DO NOT violate honor code.

Some behaviors that are considered as cheating:

• Reading another student’s answer/code, including keeping a copy of another student’s answer/code

• Copying another student’s answer/code, in whole or in part

• Having someone else write part of your assignment

• Using test cases of another student

5• Testing your code with another one’s account (Testing chances are limited)

• Post your code to github

9 Acknowledgement

This programming assignment is designed based on ENGR1510J Lab 3.

车载导航GPS欺骗 因此,如果我们能够模拟卫星信号,将模拟的信号通过信号发射装置发送给GPS传感器,那么就有可能实现欺骗GPS传感器获取虚假的位置信息,这种技术即SDR(软件无线电,Software Defined Radio)[2]。究其原因,在不使用时钟模块的条件下,HackRF发送信号的频率可能不十分精准,因此GPS传感器接收到信号之后可能无法正常解析GPS信号,因此时钟信号可能是HackRF进行GPS欺骗的关键。2)HackRF是否使用了时钟模块,时钟模块决定了信号发送频率的精准程度,对实验的成败也是至关重要的。 阅读详情

相关推荐

Labview及NI-USRP驱动安装教程

软件下载 安装使用的LabVIEW2018及NI-USRP驱动程序已上传,下载地址: 天翼云盘链接 (访问码:oc33) 百度网盘链接 (提取码:88mi) (注:天翼云盘下载不限速) LabVIEW2018安装步骤 右键软件压缩包选择解压至LabVIEW2018 选中文件,鼠标右击选择以管理员身份打开2018LV-WinChn.exe文件。 点击确定。 点击Unzip解压。 点击确定。 点击下一步。 填写任意信息后,点击下一步。 点击下一步。 点击浏览更改安装路径建议安装到除C盘以

dadapongi6的博客 2万+

InnoDB 内存结构总览:Change Buffer、AHI 与 Log Buffer

本文系统梳理InnoDB内存结构中的ChangeBuffer、Adaptive Hash Index(AHI)与LogBuffer。ChangeBuffer缓存二级索引页不在内存时的变更,减少随机IO,仅在页加载时合并;聚簇索引修改立即执行,因数据本身不可延后。AHI基于高频等值查询自动构建哈希索引,加速定位,仅支持等值操作。LogBuffer为redo log内存缓冲,配合磁盘日志实现崩溃恢复。三者均服务于性能优化,其中ChangeBuffer与AHI共享BufferPool空间,而LogBuffer独立

bksczm的博客 309

树莓派CM4 PCIe扩展方案与ASM1184e芯片应用

PCIe(Peripheral Component Interconnect Express)是计算机硬件中重要的高速串行总线标准,广泛应用于存储、网络等设备连接。其核心原理是通过差分信号实现高带宽传输,PCIe Gen2 x1的理论带宽可达5Gbps。在嵌入式开发中,PCIe扩展技术能有效解决单板计算机接口不足的问题,特别适合树莓派等微型平台。ASMedia ASM1184e作为PCIe交换芯片,可将单个接口扩展为多个,支持热插拔且免驱动,极大提升了工程灵活性。通过PCIe交换机方案,开发者能在树莓派CM

weixin_42602368的博客 424

信创环境下PageOffice文档控件适配与实践

信创适配做到文档控件这一层,拼的已经不是"有没有国产版本",而是同一个功能在两类终端上是否真的等价。等价的标准很具体:同一次点击能得到同样的结果,同一份公文能得到同样的版式,同一个项目不需要维护两套代码。这背后是三件并不轻松的工作:服务端用一套接口同时支撑两类终端,客户端把两种系统与四种芯片的安装包分发清楚,文档内核层由产品侧跟着 WPS 的版本走。浏览器这一层的压力,则被收进了产品自己的窗口里——升级节奏由产品掌握,不再交给运气。

zi_wu_xian的专栏 336

基于qiime2的16S数据分析全流程:从导入数据到下游分析一条龙

基于qiime2的16s测序数据分析分析激活qiime环境我已经把上面这句代码放在了.bashrc里面,因此激活qiime2环境只需要运行activate_qiime即可/bin/bash# 设置目录路径# 输出表头 echo -e "sample-id\tforward-absolute-filepath\treverse-absolute-filepath"# 遍历_R1和_R2文件do # 检查R1文件是否存在then# 获取样本ID(去掉_R1.fastq.gz)

2301_76771985的博客 5528

谷歌浏览器崩溃排查:闪退、卡死、网页打不开的修复指南

浏览器多进程架构通过进程隔离、GPU加速和扩展沙箱提升网页渲染效率,但配置损坏、扩展冲突、显卡驱动异常或系统资源不足时,常会以闪退、卡死、白屏、内存占用飙升和能上微信却打不开网页等形式暴露。排查价值在于先分层定位系统、进程、配置扩展与网页内容,再用无痕模式、chrome://crashes、chrome://gpu和浏览器任务管理器收集证据,避免盲目重装。对办公、开发运维和日常维护场景,禁用扩展、关闭硬件加速、刷新DNS缓存、重置配置文件乃至干净重装,都是可复用的工程化处置手段。围绕谷歌浏览器崩溃的典型症状

weixin_34138056的博客 426

第三篇 第 6 课

前置:第三篇第 1 课(stdx 引入),第二篇第 1 课(std.regex)。环境:仓颉 SDK 1.2.0。本文所有代码与输出均逐行实测。

weixin_41618057的博客 557

UG NX二次开发(Python)-API函数介绍与应用实例(三)-UFLayer类操作

采用Python语言进行UG NX二次开发的帮助材料很少,采用录制的方法是一种比较容易实现的方式,但是使用UFun函数更容易上手,我们以后将逐渐的将Python-UFun的功能写进博客中,以便于有需要的人采纳和研究。本博客是为了入门需要,采用简单的创建长方体的功能来讲一下怎么使用Python语言开发。我们今天以移动长方体到某一个图层为例,讲一下UFLayer类中部分函数的使用。另外,我们长期提供UG NX二次开发的功能开发和咨询服务,有疑问可以私信博主或者在评论区讨论。

GimiGimmy 711

【从零理解 Spring AI · 12】MCP 的两种角色:做客户端还是做服务端

上一篇讲了 MCP 的概念:标准协议、三大角色、M+N 替代 M×N。

nice_lcj520的博客 614

车载以太网:PHY(物理层)介绍

本文以TJA1101芯片为实例介绍了车载以太网PHY(物理层)组成。

kevin1499的博客 6231

2025华为od机试真题B卷【版本管理】JavaScript实现

在 软件版本管理中,版本号由点分割的数字组成,例如 1.2.3 和 2.8。现在,你需要编写一个函数,计算两个版本号之间的可用版本号个数。这里的可用版本号指的是所有满足 version1<x<version2的版本号x的个数。若 version1 >=version2 返回0.,

MISAYAONE的博客 255

pcl2启动器下载(Minecraft PCL2 启动器 最新版 安装与使用说明)

摘要:PCL2(Plain Craft Launcher 2)是一款面向 Minecraft 的第三方启动器,支持正式版与快照版本管理、模组与整合包安装、Java 运行时自动匹配,绿色免安装、双击即可运行。适合在 Windows 上玩单机整合包、需要多版本共存或离线启动的用户使用

2611_96675819的博客 226

34、Text2KGBench与GeoQuestions1089:知识图谱生成与地理空间问答的新进展

本文介绍了Text2KGBench和GeoQuestions1089在知识图谱生成与地理空间问答领域的最新进展。Text2KGBench提供了一个开放且可复现的基准,用于从文本生成知识图谱,并结合多个LLM模型和评估工具推动研究。GeoQuestions1089是目前最大的地理空间问答数据集,与GeoQA2系统结合,推动了地理空间问答系统的发展。文章还探讨了技术挑战和未来研究方向,包括多模态知识图谱生成和深度学习优化的地理空间问答系统。

css33的专栏 116

spring boot 4集成SQLLite,及其SQLLite的建库

spring boot 4集成SQLLite,及其SQLLite的建库

weixin_41463944的博客 231

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Java 集合容器高频面试题全解:HashMap 树化阈值、1.7 死循环与 ConcurrentHashMap 演进(2026 招聘 JD 真题复盘)

HashMap 树化阈值 8 的泊松分布依据、退化阈值 6 的防抖设计、JDK 1.7 头插成环死循环的排查与修复、1.8 尾插后为何仍线程不安全、ConcurrentHashMap 放弃分段锁的原因与 ForwardingNode 协作扩容、computeIfAbsent 死锁陷阱、大集合找重复的场景题选型,附三层追问链自测。题目来源为 38 期公开招聘 JD 样本与字节、拼多多、建行、美团、快手公开面经。

蒙眼过河 427

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

spdlog 同步日志库使用详解

spdlog是一个轻量级 C++ 日志库,支持同步日志、异步日志、多线程日志、日志文件轮转和自定义日志格式。对于嵌入式 Linux 应用开发,我建议先使用。它可以帮我们完成:日志级别过滤。时间戳和线程 ID 输出。日志格式化。终端和文件输出。多线程安全写入。日志文件按大小或时间轮转。我们不需要自己实现互斥锁、文件写入、日志格式化和轮转等底层功能。

zengjiajun2006的博客 1124

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

JavaSE通关手册:数据类型与变量

代码无需额外处理,编译时编译器自动完成转换。

xys_678的博客 236

IDEA 简介:从零认识 IntelliJ IDEA

IDEA 全称,是由 JetBrains 公司开发的一款主流 Java 集成开发环境(IDE)。它集代码编辑、编译、调试、测试、版本控制、构建管理等功能于一体,被大量 Java 开发者视为日常开发的首选工具。所谓 IDE(Integrated Development Environment,集成开发环境),就是把写代码所需的各类工具整合到同一个界面中。相比只用文本编辑器加命令行编译,IDE 能显著减少重复操作,让开发者把精力集中在业务逻辑上。

ztI10的博客 184

Docker部署linkding:HTTPS与数据备份

部署私人书签库,除了让页面能够打开,还需要考虑几个实际问题:重建容器后数据是否保留、登录和保存是否正常、升级前怎样备份,以及出现 502 或 CSRF 错误时从哪里检查。本文使用 Docker Compose 部署 linkding,采用默认 SQLite 数据库,通过 Caddy 提供 HTTPS,并完成账户创建、数据持久化验证和备份。如果重建后账户或书签消失,应先检查是否换了项目目录、改了挂载路径,或者启动了另一套实例,不要急着重新初始化。遇到权限问题,应根据日志确认具体目录和运行用户,再调整权限。

tedcloud123的博客 193

C++20协程怎么运行?原理与三大核心组件深度剖析

C++20协程是轻量级的无栈状态机,通过co_await、co_yield、co_return实现挂起与恢复,由Promise、协程句柄和Awaitable三大组件协同工作。协程与线程互补,适用于高效管理大量并发I/O任务,显著降低上下文切换开销。其核心在于编译器生成的状态机机制,需配合库(如cppcoro)使用。掌握Promise控制逻辑、句柄生命周期管理及Awaitable语义,是构建高性能异步程序的基础。

Lucis__的博客 335

动态代理两大流派:JDK 代理与子类代理

业务类想加日志,最直白的写法是侵入式修改: 问题很明显:每个方法都要改一遍,改一个业务要动十处。代理模式的解法是:调用方不直接依赖 ,而是依赖一个代理对象。代理对象长得跟目标一模一样,调用它 → 代理先执行增强逻辑 → 再转调真实对象。 关键在于:代理对象的类型是哪来的?这就是"动态"二字的含义:代理类在运行时才诞生。两个角色: 承载增强逻辑, 负责生成代理类。 组装代理并调用: 输出: 业务代码 一行没动,增强逻辑全在 里。这就是 AOP 的味道。 内部四步: 第 2 步 内部:先查 (同一个接口

Android的专栏 661

c++ explicit关键字详解

explicit。

拒绝AI文,努力在AI时代写出感动人心的好文章 169

Java 项目实战:交友项目后台系统——网关统一鉴权与 B 端管理后台

本次改造通过引入SpringCloud Gateway实现网关统一鉴权与路由,新建mf-admin管理端复用C端域服务(Dubbo调用),实现管理员登录与用户管理四件查询。核心套路:网关白名单+双体系JWT(同工具不同payload)、管理端零直连业务库、分页形态区分(MySQL自动count/Mongo手动count)、浏览器端独立聚合。踩坑12条,附自检清单与后续改造方向,可复用于多角色后台系统。

Wang的专栏 63

Teamcenter Java SOA 开发:连接、查询与保存

本文介绍如何通过 Java 调用 Teamcenter SOA 接口实现外部系统对接,涵盖连接登录、查询保存等核心操作。以最小闭环示例展示 Connection、Service、ModelObject 等关键组件的使用,强调错误处理与事务管理要点。梳理了 DataManagement、Query、File Management 等 API 模块分工,并结合“工作移交WebService”案例,说明幂等性设计与流程状态返回的重要性。适用于 Web 门户、ERP 集成等场景,建议批量操作用 bulk 接口优化性

软件工程师文艺 277

TRingBuffer两端都能增删(快递站版)

TRingBuffer 是一个支持两端增删、下标访问且容量动态增长的环形双端队列。它通过无符号索引的永不归零设计,利用减法自动模运算实现空满判断与元素计数,避免了传统环形缓冲浪费格子的问题。内部以票号(索引)标记首尾,扩容时重排元素为连续存储,保证 O(1) 操作与高缓存效率。虽不线程安全,但其高效性使其成为游戏开发中事件队列、命令缓冲等场景的理想选择。

u013768914的博客 315

Mac上装了最新版本的Android Studio,但是没找到jdk的设置选项也没找到jbr的目录

新版Android Studio(2025.3.1+)因三项变更导致常见问题:一、JDK设置移至“DaemonJVM criteria”,新项目默认自动探测或下载JDK;二、JBR目录改名为带版本号的jbr-21等,需进入.app/Contents/查看,或通过About窗口确认运行时;三、命令行缺adb因platform-tools未加入PATH,需在SDK Manager中勾选并配置~/.zshrc中的ANDROID_HOME及PATH。重装或清理残留可解决缺失问题,切勿手动设JAVA_HOME或安装冲

Programming is a highly artistic endeavor 399
上一篇: CS211 Programming Extra Credit
下一篇: CS1026A YouTube Emotions
wx____codinghelp
博客等级 码龄2年 771粉丝 115原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值