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.

常见的电容有哪些 电容在电路板中非常常见,类别纷繁复杂,本文化繁为简,主要介绍下常见电容。 阅读详情

相关推荐

动力锂电池-二阶RC模型等效电路-RLS参数辨识-Simulink

1.锂电池二阶RC等效电路模型

QQ1978009424的博客 1万+

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

LwIP在国产MCU的落地实践:从协议栈优化到网络稳定性实战

本文详细介绍了LwIP协议栈在国产GD32F407 MCU上的移植与优化实践,涵盖硬件平台选择、驱动适配、协议栈调优和网络稳定性提升策略。通过内存管理优化、实时操作系统集成和性能测试,为工业物联网应用提供高可靠性网络通信解决方案,显著提升数据传输效率和系统稳定性。

m2n3b4v5c6的博客 270

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

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

zi_wu_xian的专栏 336

librealsense2 camera.so: undefined symbol:ZN2cV3MatC1EV解决笔记记录

先参考的这个兄弟的办法虽然没解决但是提供了大方向感谢; realsenseD400系列相机报错:undefined symbol: _ZN2cv3MatC1EiiiRKNS_7Scalar_IdEE解决方案 后解决办法参考 No GPU usage on jetson xavier NX · Issue #2326 · IntelRealSense/realsense-ros · GitHubOpenCV_DIR" to a directory containing one of the above f

梁俊星的博客 3518

使用mne包来对脑电数据进行预处理(一)

MNE(MNE-Python)是一个用于处理脑电(EEG)、磁图(MEG)和其他神经科学数据的Python库。它提供了丰富的功能,包括数据加载、预处理、分析和可视化,旨在帮助研究人员和神经科学家更轻松地进行脑电数据的处理和分析。在本文中,我们使用mne来对不同的格式的脑电数据集进行数据读取。

m0_71596228的博客 4306

第三篇 第 6 课

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

weixin_41618057的博客 557

模电专题-MOS管的放大电路分析

在实际应用中,我们经常会使用到功率MOS,这时通常不会将它当成一个开关使用,而是当成一个放大器来使用,那这就需要让其工作在放大状态。参考下图中的mos管的特性曲线,右图中的输出特性曲线中有一根红色的分界线,这个线就是区分mos管工作状态的分界线,在红线的左边,mos管工作在可变电阻区,也就是线性区;在红线的右边mos管工作在恒流区,也就是饱和区。当然,还有一个截止区。本文分析主要运用模电课本中的理论计算验证。

Anitawen的博客 2万+

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

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

nice_lcj520的博客 614

在 Windows 上使用 Anaconda 创建 配置 YOLOv8虚拟环境,并更改 pip 源以及以 可编辑模式 安装ultralytics

前往 NVIDIA cuDNN 下载页面,下载与您安装的 CUDA 版本匹配的 cuDNN 版本。:根据您的系统和 CUDA 版本,选择适当的 whl 文件。如下12.7,表示最高可装12.7版本CUDA,与上图中的支持的最高cuda版本一致。,无需重新安装,从而大幅提升开发效率,适用于项目开发、调试或依赖本地未发布的版本时使用,但需确保当前目录包含。:访问 NVIDIA 官方网站,下载与您的显卡和操作系统兼容的 CUDA 版本。首先,确保NVIDIA 显卡支持 CUDA,并安装相应版本的驱动程序。

weixin_44115575的博客 1894

基于Simulink雷达系统建模仿真(附源码)

此示例显示如何设置由发射器、带目标的信道和接收器组成的雷达系统仿真。一、系统架构该系统包括:雷达脉冲发生器,以 2% 占空比(导通时间 = 2 ms,周期 = 100 ms)输出功率为 1 mW 的啁啾声。RF发射器部分由滤波器和组成,使用RF模块集电路包络库模块实现。由于滤波器是线性器件,放大器是非线性器件,因此它们被分成两个独立的子系统。这种分离允许在每个子系统中使用不同的仿真频率集。这种分离还允许在更快的仿真速度和级联链中可用的级间负载效应损失之间进行权衡。

珞瑜的博客 4584

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

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

2611_96675819的博客 226

安川机器人外部轴添加

本文详细介绍了如何在安川机器人本体上添加第7轴以及如何设置动作,本文以添加点焊枪为例进行讲解。

haier123888的博客 7895

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

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

weixin_41463944的博客 231

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

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

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

蒙眼过河 427

Devexpress16.2.6破解工具

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

spdlog 同步日志库使用详解

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

zengjiajun2006的博客 1124

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

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、付费专栏及课程。

余额充值