ENGG1110 Project
Changelog
Rev. Date Description
v1.1 2024/11/06 P.5 [4] Fixed the wrong coloring of matching
candies in first round.
P.14 [5.5.2] Added the checking of empty cells for
Target cell at swap.
P.14 [5.5.4] Added clarification on how
findAndRemoveMatch() checking order.
P.22 [6.3.2] Added clarification on how the cascade
matching checking order.
P.25 [8] Elaborated the grading specification.
ENGG1110 Project
1 of 26
ENGG1110 Problem Solving by Programming
The Chinese University of Hong Kong
2024-2025 Term 1
Project
Due Date: 2024/12/04 (Wed) 23:59
1. Introduction
Candy Crush is a popular match-three puzzle game in the world, originally released in
2012 for Facebook and later adapted for mobile platforms.
In the basic gameplay, the gameboard consists of a grid filled with various types of
candies, each represented by different shapes and colors. The player’s goal is to create
matches of three or more identical candies by swapping adjacent one. When a match is
made, the matched candies are cleared from the gameboard, and new candies will fall
down to fill the empty spaces. This sometimes leads to “chain reactions”, where new
matches are automatically created as the board refills.
Figure 1. Sample Gameplay. Snapshots from
https://www.flickr.com/photos/alper/10330168576
In this project, you will develop a Candy Crush game using the C programming
language. The project is structured in two phases: Part I focuses on implementing the
basic version of the game, while Part II builds upon the first part by adding advanced
features and additional gameplay mechanics.
You are required to complete the given source code main.c without modifying any
existing code (except otherwise specified) or introducing new libraries. Marks will be
deducted from every modification.
ENGG1110 Project
2 of 26
2. Program Flow
Part I
ENGG1110 Project
3 of 26
Part II
ENGG1110 Project
4 of 26
3. Suggested Project Schedule
Part I (60%)
Week 10 InitGameBoard(), printGameBoard()
Week 11 AskForSwap()- Input/Validation, swap()
Week 12 FindAndRemoveMatch(), isGameOver()
Part II (40%)
Week 13/14 File I/O, applyGravity, fillEmpty(),Cascade
Week 14 Cascade
ENGG1110 Project
5 of 26
4. Sample Runs for Part I
The following shows several examples of inputs and the resulting candy clearings. User
inputs are indicated by bold, highlighted underlined text. The matches found by the
function are in red font.
=====
New Round:
Enter the coordinate (row, column) of the candy:5 2
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):L
Vertical Match found at column 2!
Enter the coordinate (row, column) of the candy:0 2
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):D
Horizontal Match found at row 1!
=====
New Round:
=====
Enter the coordinate (row, column) of the candy:0 0
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):L
Move Out of Bound.
Please try again.
=====
New Round:
Enter the coordinate (row, column) of the candy:1 2
Empty Cell Selected.
Please try again.
=====
New Round:
Enter the coordinate (row, column) of the candy:4 5
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):D
Horizontal Match found at row 4!
Enter the coordinate (row, column) of the candy:2 3
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):R
Horizontal Match found at row 2!
Enter the coordinate (row, column) of the candy:0 4
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):R
Horizontal Match found at row 0!
Enter the coordinate (row, column) of the candy:1 5
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):U
Horizontal Match found at row 1!
Game Over! No more possible moves.
ENGG1110 Project
9 of 26
5. Detailed Program Design Flow – Part I
In this project, you are required to follow exactly the output format specified. Using
other output formats will jeopardize your mark.
This program will
1. Read and initialize the game board from source
2. Display the game board
3. Allow the player to select a candy to swap
a. The player can only swap two candies at a time
b. The player will choose a candy by entering the coordinates (row, column)
c. The player will also input a direction (U for Up, D for Down, L for Left, R for
Right) to specify where to swap the selected candy.
4. Find and remove matches
a. After each swap, check for matches of three or more identical candies in
a row or column.
b. If a match is found, display a message indicating the match’s location,
remove the matched candies, and update the game board.
5. Check for a game-over condition
a. Check if no further matches are possible on the gameboard.
b. If the board has no possible moves left, display the message and end the
game.
5.1. Header files, Functions, and Variable Declarations
At the beginning of the main.c file, we include two headers, <stdio.h> and
<stdlib.h>.
No other header files or library are allowed in the project.
We define several macros after the header line. Macros are identifiers defined by
#define, which are replaced by their value before compilation. The first two are H and W.
#define H 6 // height
#define W 6 // width
H is the height of the game board, while W is its width. Therefore, our Candy Crush game
board is a 6x6 square. In our test cases, we do not have any test cases with varying board
size. You may try it if you are interested.
Each cell on the game board stores a candy, with different types of candies represented
by numbers. To assist in converting these numbers into their corresponding candy
representations, the following global variable is provided.
char candies[] = {'*', '#', '@', '%'};
ENGG1110 Project
10 of 26
No other global variables are permitted. All variables you define must be declared
within functions and passed as parameters or return values as necessary. Violations of
this rule will result in a deduction of marks.
Also, there are a number of helper functions declared in the project. You can add new
functions to aid your work, but you CANNOT modify (function signatures – function
names, return type, parameters), or delete the given functions.
5.2. Main Function
The main function is given to control the game flow.
There are some local variables already declared for you. You can declare your own local
variables for your use.
Variables Usages
int board[H][W] Stores the candies on the game board.
The main function controls the gameplay as follows:
1. Call initGameBoard() to load the initial game board.
2. Enter the main game loop. The loop should continue until the game is over. Here
are the tasks in the loop.
a. The loop should start by printing five equal signs (=====) as a separator
for each round, as follows:
=====
New Round:
b. Then, call printGameBoard() to display the current game board.
c. Call askForSwap() to execute the swapping logic. If the askForSwap()
returns zero (0), indicating the swapping is unsuccessful. In this case,
print the following error message:
Please try again.\n
ENGG1110 Project
11 of 26
d. Call isGameOver() to check if any moves are possible. If no valid moves
remain, display a game over message and exit the game loop. In this case,
print the following error message:
Game Over! No more possible moves.\n
ENGG1110 Project
12 of 26
5.3. Initializing Game Board
The main() function will first call the initGameBoard() function, which initializes the
board[] array for the later gameplay. In Part I, the content of the array should be read
from another hard-coded arrays – board_samples[].
5.4. Print Game Board
The given printGameBoard() is useful throughout the program to show the current
game board status to the user. You are required to implement this function and print the
game board on the screen based on the following format, where ␣ represents a space
character that should appear as an actual space in the program output.
First, print a line of five equal signs (=====) as a separator. Then, display the game board
with row and column numbers labeled. Each cell should be separated by spaces and
vertical bars to clearly distinguish rows and columns.
=====
␣␣|␣0␣|␣1␣|␣2␣|␣3␣|␣4␣|␣5␣|
␣0|␣#␣|␣%␣|␣@␣|␣*␣|␣#␣|␣*␣|
␣1|␣@␣|␣@␣|␣*␣|␣#␣|␣#␣|␣%␣|
␣2|␣#␣|␣%␣|␣%␣|␣@␣|␣%␣|␣*␣|
␣3|␣%␣|␣*␣|␣@␣|␣#␣|␣*␣|␣@␣|
␣4|␣#␣|␣*␣|␣@␣|␣%␣|␣%␣|␣@␣|
␣5|␣%␣|␣@␣|␣#␣|␣*␣|␣%␣|␣%␣|
There are two types of elements displayed on the grid:
• Candies: Use the candies[] character array to convert the numerical
values stored in board[][] into the corresponding candy symbols.
• Empty Space: Display the space character (' '), which is stored in
board[][] as ASCII 32 (space).
It is crucial that your output format follows the example exactly, including the number
of spaces and any other formatting details, as the program will be graded using an
autograder. Any deviation in the format could result in a loss of marks.
5.5. Ask for input for swapping
The main function will call askForSwap() to handle the game action. The swapping
logic will be implemented inside this function. This function will return an integer to
indicate whether the swapping is successful or not. (Details of return value)
ENGG1110 Project
13 of 26
5.5.1. User Input
5.5.1.1. Coordinates
The function should first ask the users for input two integers for the coordinates first:
Enter the coordinate (row, column) of the candy:\n
After receiving the user input, validate the input based on numerical correctness. You
can assume the user will only input integers. Ensure that the coordinates are within the
valid game board range. If the coordinates input is out of bounds, output the following
error message and return zero (0).
Coordinates Out of Bound.\n
5.5.1.2. Empty Cells
Then, the function should check whether the selected cell is empty or not. If the cell is
empty, output the following error message and return zero (0).
Empty Cell Selected.\n
5.5.1.3. Direction to Swap
After the coordinates are valid, the game should ask for the direction:
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):\n
You can assume that the user will input one character only. This input should be
validated to ensure it is correct – i.e. Upper case and should be one of the four
possibilities (U,D,L,R).If the direction is incorrect, output the following error message
and return zero (0).
Wrong Direction Input.\n
5.5.2. Valid Swapping Check
When attempting to move a candy, the program should validate that the move stays
within the boundaries of the game board, For example, the candy at position (0, 0)
cannot be swapped to the left, as it is already at the left boundary of the board
If the move is out of bounds, output the following error message and return zero (0).
Move Out of Bound.\n
ENGG1110 Project
14 of 26
In addition, the program should also check the Target cell (e.g. if swapping (1,3) to the
left, Target cell is (1,2)) is empty. In this case, output the following error message and
return zero (0).
Empty Cell Selected.\n
5.5.3. Execute Swap
If the input validations pass, the swap action is performed by calling the swap()
function. You should implement the swap() to take the board, the starting coordinate,
the target coordinate, and the direction as arguments. The function will then swap the
selected candies in the specified direction. For example, if the direction is U (up), the
candy at (row,col) will be swapped with the candy directly above it at (row-1, col).
Similarly, if the direction is L (Left), the candy at (row, col) will be swapped with the
candy to the left (row,col-1). After the swap, you may use printGameBoard() to
inspect the result, but remember to remove this call after completing your inspection.
5.5.4. Find and Remove Matches
After the swapping, the findAndRemoveMatch() function is called to locate any
matches involving the candy at both the target position and the original position, as a
match may form in either direction. The function checks the neighboring cells around
each of these positions to detect any sequence of three or more identical candies
horizontally or vertically.
To facilitate auto-grading and maintain consistency, you should check the matches in
the following order.
1. Order of Checks: When checking for matches, start with the Target Position
(where swap has just placed a new candy). After completing all the checks and
removal at the Target Position, move to the Start Position (the original cell where
the candy was swapped from) and perform the same operations.
For example, swapping (1,2) downwards: Target Position is (2,2); and the Start
Position is (1,2).
2. Horizontal Matches: Starting for the given cell, if it is not empty (‘ ’), check to
the left (if any) to see if there are three or more consecutive identical candies in
the same row. Then check the right direction (if any).
ENGG1110 Project
15 of 26
3. Vertical Matches: From the given cell, if it is not empty (‘ ’), check upwards (if
any) to see if there are three or more consecutive identical candies in the same
column. Then check the bottom direction (if any).
If a match is found in the horizontal/vertical direction, output the corresponding
message on the screen and indicate the row and column where the match occurred.
Horizontal Match found at row <Row Index>!\n
e.g. Horizontal Match found at row 1!
Vertical Match found at col <Column Index>!\n
e.g. Vertical Match found at column 1!
After finding the match, the game should remove the matching candies from the game
board. This is the intermediate status of the board after the removal.
Enter the coordinate of the candy you want to swap:5 1
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):R
Vertical Match found at col 2!
If the swap yields no matches, you should restore the game board to the previous status
(before the swap), print the message “No Match Found”, and return zero (0). Here is the
example:
Enter the coordinate of the candy you want to swap:0 0
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):R
No Match found!
In this function, you should return one (1) to the caller – i.e. AskForSwap() function.
5.6. Game Over Checking
As the game progresses, there will be eventually no more matches in the game board.
you should implement isGameOver() to check the whole board to see if there is at
least one potential match or not.
You can try swapping each candy with its right neighbour (if any) and its bottom
neighbour (if any). After the swap, matches may be formed in any four directions (Up,
Down, Left, Right). Therefore, you will implement a helper function isMatching() to
do the checking. This function will do a simple checking to see if there is at least one
match-three that can be formed by the given cell in any of the directions. It shall return
one (1) if there is at least one match; If there is no match found, return zero (0).
You may need to call it twice to check both the original position and swapped position
for any potential matches.
After each check, immediately undo the swap to restore the board to its original state.
If a match is found during any swap, return one (1); If no matches are possible after all
check, return zero (0). The main function will check this status and
The following input can be used to check the game over status:
Enter the coordinate (row, column) of the candy:0 5
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):D
Horizontal Match found at row 1!
Game Over! No more possible moves
The main() function will handle this, print out the error message,
Game Over! No more possible moves.\n
and will eventually terminate the game loop.
** End of Part I **
ENGG1110 Project
18 of 26
6. Detailed Program Design Flow – Part II
In the part, we will extend the work of Part I to enhance the program functionality. Make
a copy of your source code of Part I. You will need to submit another source code for
Part II.
6.1. Main Function
In the main function, three more variables are introduced for the next section.
int stacks[100] stores the extra candies, which are used
to fill empty spaces after matched
candies are removed. Maximum 100
candies can be stored.
numCandies Represents the total number of candies
available in the stacks[] array for
refilling the board.
current Acts as a pointer or counter that keeps
track of the current candy being used
from stacks[] to refill the board during
gameplay. The current variable will be
initialized to 0 and will be incremented as
each candy is used during gameplay.
6.2. Read board and stacks from file
Previously in Part I the game board and stacks are read from hard-coded arrays for
easier debugging. Now let’s extend the function to file I/O and give us flexibility to
replace the game board to a different initial status.
The main() function will first call the initGameBoardFromFile() function, which
initializes these arrays. The contents of the arrays should be read from a file named
“board.txt”. Finally the function should return the number of candies in the stack,
which will be stored in the numCandies variable in the main function.
ENGG1110 Project
19 of 26
Below is an example of the expected format for “board.txt”:
• First Line: Contains two integers representing the game board dimensions – the
number of rows r and columns c.
• Next r Lines: A grid of r x c integers representing the initial game board. Each
integer corresponds to a candy type.
• Following Line: Contains a single integer n, which corresponds to numCandies
and represents the total number of extra candies in the stacks[].
• Final Line: A list of n integers, each representing an extra candy that will be used
to fill the board when matches are removed.
Please ensure that the file is read correctly, and handle file operations properly. If an
error occurs (e.g., the file cannot be opened), output the following message and
terminate the program with an exit code of -1.
Failed to open board.txt!\n
6.3. Applying Gravity
There will be empty cells after the candy’s removal.
You should implement the gravity algorithm in the applyGravity() function for
simulating “gravity”. The main() function will call this function if the swapping is
successful – i.e. the return value of askForSwap() is non-zero.
In this function, implement the gravity feature to shift candies downwards into empty
spaces.
Starting from the bottom of the each column, the function should upward to find empty
spaces (represented by ASCII 32 ‘ ’). When such empty space is detected, shift any
ENGG1110 Project
20 of 26
candies above it down by one row . Repeat this process until each column has no empty
space remaining below any candies.
At the end of the applyGravity(), call printGameBoard() to output the game board.
In this example, the candies at the top of column 2 should fall down to fill the empty
spaces below. and the result should look like this:
At this point, you do not have to do the match checking.
6.3.1. Fill Empty Spaces
After candies are removed from the board, empty spaces will be left behind, which need
to be refilled after applying the gravity. The main function will call fillEmpty() to fill
these spaces using the candies stored in the stacks[] array after applying the gravity.
You can track the current position in the array using the current variable, which
indicates where the next candy should be retrieved from.
As you retrieve candies from the array, fill the empty spaces from bottom-to-top, left-to -
-right manner to simulate the real candy crush.
At last, call printGameBoard() to show the board status.
Here is the status after the candy removal, just before the gravity application and candy
refill.
ENGG1110 Project
21 of 26
After calling fillEmpty() in the main() function, you should see the following:
Once the original candies have fallen to the bottom (highlighted in yellow above), any
remaining empty spaces are refilled sequentially using candies from the stacks[] array.
The current variable in the parameter keeps track of the position in stacks[] from where
the next candy should be drawn. Each time after the candies is drawn, current is
incremented to point to next candies.
Here is the example of how current variable works with the stacks[]. After the
beginning of the game, the current variable is set to zero (0) to indicate the candy drawn
next is the first item in the stack.
current = 0
1 2 3 3 2 1 1 0
After one candy is drawn for refill, the current variable is incremented to one (1) such
that next candy drawn is the second item in the stacks[].
current = 1
1 2 3 3 2 1 1 0
In the game, this is the array that helps you to convert the number to the candy
representation.
char candies[] = {'*', '#', '@', '%'};
With this array, you can observe that the empty cells are filled with “#”, “@” and “%”
from bottom to top, which is 1,2,3 in the stacks array respectively.
The process will continue until all the candies in the stack are exhausted. When filling
the candy, if the number of candies remaining in the stacks[] is less than the number of
empty spaces on the board, the game will be unable to fill all spaces. In this case, the
game should display an error message and terminate the program with an exit code of -
1.
No more candies available.
ENGG1110 Project
22 of 26
This check will naturally handle both cases: if stacks[] is exhausted during normal game
play, or if stack[] is empty from the very beginning, as both conditions would trigger the
same error and exit the program at this point.
If multiple columns contain empty spaces, fill these spaces in a bottom-to-top order
within each column, moving from the leftmost column to the rightmost column. Here is
the example of the case of filling in multiple column spaces. The number in red italic
and brackets indicates the filling sequence.
6.3.2. Cascade Matching
When the candies are refilled, new matches may form on the board. To mimic real
gameplay, the game should continuously check for new matches as the board refills,
repeating the process until the board is stable with no further matches.
The main function will call cascade() function right after the matching process. Within
the function, you should call both the applyGravity() and fillEmpty() for the
cascade process. As a result, any previous calls to these functions in the main function
should be removed, as they are now called within cascade().
In the cascade function, you are required to check if there are any matches for each
cell. For this, you will call findMatchAndRemove() function (developed in part I) to find
all matches on each non-empty cell. You can make use of the return value of
findMatchAndRemove() to determine whether a match is found.
In the cascade function, repeat the process until no further matches can be found in the
board. In each checking round:
1. Apply the gravity.
2. Fill in all the empty cells on the board and get the updated value of current
3. Print the Gameboard to show the current status
4. Remove all matches found on the board. Starting from the top-left corner (0,0),
check each cell for matches in the following order:
a. Row by Row, Column by Column: For each cell, proceed across each row
from left to right, then move down to the next row.
b. Check Directions: For each cell, check for matches in the order of Left,
Right, Top, and Bottom
ENGG1110 Project
23 of 26
c. Clear Matches: If a match is found, clear the matching candies
immediately before proceeding to the next cell.
5. If there is any removal, output the following at the end of checking:
Cascade Matches found!\n
6. After the cascade checking completes with no further matches, return the
updated value of current to the main() function.
Repeat these steps until no matches are left, ensuring that all cascading actions are
completed before returning to the main function.
Below is the sample of a cascade matching, the matches found by the cascade function
are in red font.
=====
New Round:
=====
Enter the coordinate (row, column) of the candy:1 2
Enter the direction to swap (U for Up, D for Down, L for Left, R
for Right):U
Horizontal Match found at row 1!
=====
Vertical Match found at column 0!
Cascade Matches found!
Horizontal Match found at row 2!
Cascade Matches found!
25 of 26
7. Academic Honesty and Declaration Statement
Attention is drawn to University policy and regulations on honesty in academic work,
and to the disciplinary guidelines and procedures applicable to breaches of such policy
and regulations. Details may be found at
https://www.erg.cuhk.edu.hk/erg/AcademicHonesty .
You are required to fill in the following declaration statement as the comment at the
beginning of the main.c source code with your information. Assignments without the
properly signed declaration will not be graded.
Tools such as software similarity measurement, AI-tool fingerprint detection, etc., might
be used to inspect all submissions.
/**
* ENGG1110 24R1 Problem Solving by Programming
*
* Course Project
*
* I declare that the project here submitted is original
* except for source material explicitly acknowledged,
* and that the same or closely related material has not been
* previously submitted for another course.
* I also acknowledge that I am aware of University policy a nd
* regulations on honesty in academic work, and of the disciplinary
* guidelines and procedures applicable to breaches of such
* policy and regulations, as contained in the website.
*
* University Guideline on Academic Honesty:
* https://www.cuhk.edu.hk/policy/academichonesty/
*
* Student Name :
* Student ID :
* Class/Section :
* Date :
*/
8. Grading Platform and Submission
We will grade your work in Gradescope autograder. Please note that while passing the
test cases is necessary, it is not sufficient on its own for full marks. Additional marks will
be allocated based on the completeness and adherence to all requirements specified in
the project documentation, including code organization, functionality, and adherence
to the design specifications.
ENGG1110 Project
26 of 26
Please follow the steps below to submit your work by the deadline.
1. Rename the modified main.c for part I to main_part1.c
2. Rename the source code for part II to main_part2.c
3. Submit your .c file to the Gradescope.
Please only submit the source file (.c). You may submit many times before the due date,
but the latest attempt will be graded.
9. Late Submission
The late submission penalty is as follows:
• Within 3 days (72 hours): 10% per 24 hours
• 3-7 days: 50% penalty
• More than 7 days: 100% penalty (Your work will not be graded)
NOTE: Submitting the project is crucial in PASSING the course.
相关推荐
用yolov8训练自己的模型并调取摄像头实时检测,新手小白超友好教程!逻辑梳理,从0开始逐步实操❤
帮新手小白学会用yolov8,包含多篇高质量博客整理
177.Agent-LangGraph-MCP的构成说明
MCP架构通过MCP主机、客户端与服务器的协同,实现工具、资源与提示词的统一管理。MCP服务器提供Tools、Resources、Prompts能力,MCP客户端则负责发现、调用与读取,使Agent可按需获取上下文。其核心在于将工具从Agent中抽离,封装为可复用的服务,提升灵活性与可维护性,推动AI应用高效协作。
中科蓝讯AB536X/AB892X芯片开发避坑指南:Downloader配置中那些容易忽略的细节
本文详细解析中科蓝讯AB536X/AB892X芯片开发中Downloader配置的关键细节,包括软开关机实现、触摸灵敏度调试、量产校频等常见问题。特别针对无PR口芯片的替代方案、触摸参数优化、校频流程等易忽略环节提供实用解决方案,帮助开发者规避量产风险,提升开发效率。
Docker Compose:搭建本地多服务开发环境
从一个 Java API、PostgreSQL 和 Redis 开始,配置服务名、端口、环境变量、健康检查、数据卷和依赖关系。理解 Compose 文件如何被解析、项目如何隔离,以及哪些数据不能依赖“重建容器”保留,能够把个人开发环境整理成团队可复用的启动入口。
Android开发者必看:F2FS文件系统如何优化你的手机存储性能(附实测数据对比)
本文深入解析了F2FS文件系统如何针对闪存特性优化Android设备存储性能。通过对比ext4,F2FS采用追加写和冷热数据分离策略,将随机写转化为顺序写,显著提升写入速度并减少GC卡顿。实测数据显示,其在随机写入和SQLite事务等场景下性能提升显著,为开发者提供了优化应用IO性能的关键思路。
实战分享:一文读懂RS-232总线
RS-232标准接口(又称EIARS-232)是常用的串行通信接口标准之一,它是由美国电子工业协会(Electronic IndustryAssociation,EIA)联合贝尔系统公司、调制解调器厂家及计算机终端生产厂家于1970年共同制定,其全名是“数据终端设备(DTE)和数据通信设备(DCE)之间串行二进制数据交换接口技术标准”。
AI全栈实战 | 3.9-01 爬虫入门:requests 加 BeautifulSoup 三分钟跑通,但 90% 的人栽在这 4 个“礼貌“问题上
⚠️:本文内容仅用于。请遵守目标站点的服务条款与相关法律法规,不得对目标服务造成负担,不得采集、传播个人隐私数据。技术是中性的,边界在你手里。爬虫的入门技术(requests 发请求 + BeautifulSoup 解析)三分钟就能学会。真正区分"会用爬虫"和"会做爬虫的人"的,是这篇我们跑通"请求→解析→存储"的最小闭环,然后重点把"合规与礼貌"这根弦给你绷上。
用业务语义织就企业数据之网:SAP Datasphere 的定位、架构与落地场景全解析
SAP Datasphere作为SAP业务数据云的核心组件,通过语义层整合企业内外部数据,支持实时分析与AI应用。其核心功能包括数据集成、语义建模、虚拟化与仓库能力,通过Spaces实现资源隔离,Data Builder和Business Builder分别面向技术和业务建模。该平台与SAP HANA Cloud、SAC等深度集成,支持财务统一分析、供应链可视化等典型场景,并可通过BW bridge实现传统BW资产云化迁移。Datasphere强调开放互联,能与Databricks等生态伙伴协同,为企业提供
spring boot 4集成SQLLite,及其SQLLite的建库
spring boot 4集成SQLLite,及其SQLLite的建库
【论文汇总】Diffusion Models视频生成/视频编辑/可控视频生成/跨模态视频生成
本文总结了Diffusion Models视频生成领域相关的工作,目前共收录142篇,持续更新中。
肖特基二极管的反向恢复过程
本博客简述肖特基二极管反向恢复过程。
【基于 WebSocket 的多用户网页五子棋】—— 数据管理模块
但行好事,莫问前程
YOLOv11改进 | Mamba-YOLOv11-L:基于SSM的高效全局建模,精度与效率的双重突破
摘要: 本文提出Mamba-YOLOv11-L,通过集成状态空间模型(SSM)改进YOLOv11的全局建模能力。针对YOLOv11在复杂场景中全局依赖缺失、精度-效率矛盾等问题,SSM以$O(N)$计算复杂度实现长程语义捕捉。改进后的模型在工业缺陷检测(Recall↑12%)、边缘设备部署(内存↓16%)、多尺度目标检测(小目标mAP↑9%)等场景表现优异,推理速度保持>40 FPS。核心创新包括轻量化SSM模块设计(稀疏状态转移+局部上下文融合)及与YOLOv11骨干的深度集成,代码实现展示了SSM
OpenClaw 深度调查:把 AI 助手做成你自己的控制平面
对 openclaw/openclaw 的完整技术尽调:Gateway 架构、Agent 运行时、工具与沙箱、30 个消息通道、181 个插件、安全信任边界、工程代价与采用建议。17 章 / 10 张图,全部数字标注口径,数据截至 2026-10-31。
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
IDEA 简介:从零认识 IntelliJ IDEA
IDEA 全称,是由 JetBrains 公司开发的一款主流 Java 集成开发环境(IDE)。它集代码编辑、编译、调试、测试、版本控制、构建管理等功能于一体,被大量 Java 开发者视为日常开发的首选工具。所谓 IDE(Integrated Development Environment,集成开发环境),就是把写代码所需的各类工具整合到同一个界面中。相比只用文本编辑器加命令行编译,IDE 能显著减少重复操作,让开发者把精力集中在业务逻辑上。
锂电池充电器电路设计 里面有电路
锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。
TransactionInactiveError:await 之后事务已经不活跃了
TransactionInactiveError 出现于 IndexedDB 事务已结束(非 active 状态)时调用 put、get 等操作。常见于 await 后或 setTimeout 中执行请求,因任务已完成,事务已提交或进入 finished 状态。请求必须在创建事务的同一任务中挂起,否则无效。解决方法:在 onsuccess 回调内同步发起后续操作,或提前将所有请求挂入事务。避免在异步上下文中使用事务操作,确保请求在事务活跃期内完成。
Docker部署linkding:HTTPS与数据备份
部署私人书签库,除了让页面能够打开,还需要考虑几个实际问题:重建容器后数据是否保留、登录和保存是否正常、升级前怎样备份,以及出现 502 或 CSRF 错误时从哪里检查。本文使用 Docker Compose 部署 linkding,采用默认 SQLite 数据库,通过 Caddy 提供 HTTPS,并完成账户创建、数据持久化验证和备份。如果重建后账户或书签消失,应先检查是否换了项目目录、改了挂载路径,或者启动了另一套实例,不要急着重新初始化。遇到权限问题,应根据日志确认具体目录和运行用户,再调整权限。
云计算课程小组PPT汇报任务书
36人分为6组,每组6人;形式:生活案例调研 + 理论解读;汇报时长7‑9min;PPT建议10‑14页。
企业官网源码与数据资产交接:四项权利、五组自动检查
企业官网源码交接不仅要看压缩包,还要核域名、云资源、构建脚本、数据库恢复、权限与密钥。
软件项目交付时,源代码之外还应该交付哪些技术资料?
软件项目交付时,除可运行程序外,还应核对源代码、数据库结构、接口文档、部署运维、测试验收和账号资产。本文从实际交付环节拆解完整资料清单,并说明合同如何约定交付范围、知识产权与维护边界。
大表 ALTER TABLE 怎么做?NineData OnlineDDL 配置与执行实践
介绍NineData OnlineDDL大表变更实践,涵盖执行策略、切表控制、拷贝批次与可视化进度追踪。
Java 项目实战:交友项目后台系统——网关统一鉴权与 B 端管理后台
本次改造通过引入SpringCloud Gateway实现网关统一鉴权与路由,新建mf-admin管理端复用C端域服务(Dubbo调用),实现管理员登录与用户管理四件查询。核心套路:网关白名单+双体系JWT(同工具不同payload)、管理端零直连业务库、分页形态区分(MySQL自动count/Mongo手动count)、浏览器端独立聚合。踩坑12条,附自检清单与后续改造方向,可复用于多角色后台系统。
MySQL报Too many open files?句柄耗尽的排查与参数配置
文章讲清 max_connections 与 open_files_limit 两个额度、句柄被谁占走、分区表为什么最容易踩,给出从 error log 到 /proc/pid/limits 的定位顺序与句柄预算算法。
SQL Server 数据库双备份:简化配置,兼顾本地留存与异机归档
本文针对中小企业SQLServer数据库备份难题,提出简化配置与本地+异机双副本方案。传统原生备份依赖手动脚本,存在配置复杂、传输易中断、日志分散、静默失败等问题。推荐使用图形化工具实现备份、本地留存与异机同步一体化管理,支持断点续传、加密传输、自动清理与版本控制,降低运维负担。双副本策略提升数据安全性,本地快速恢复,异地防硬件故障。建议定期验证恢复流程,确保备份可用性。
Agent 安全实战:间接提示注入的四个攻击面与防御体系
当 Agent 从 "生成内容" 走向 "执行动作",安全边界就从内容合规变成了权限越界。本文拆解间接提示注入在网页抓取、工具返回值、MCP 连接器、长期记忆四个位置的真实攻击路径,对照 Claude、GPT、Gemini 在工具调用权限模型上的设计差异,给出可直接落地的五层防御体系。
Redis 入门详解:核心特性、重要文件与全局命令实战
本文系统介绍了Redis的核心特性、重要文件及全局命令。Redis凭借内存存储、C语言实现和单线程设计,具备极高的读写性能;支持持久化(RDB/AOF)、主从复制与集群架构,适用于缓存、排行榜、计数器等场景,但不适合存储海量冷数据。文中还解析了常见面试题,如为何快速、单线程原理、持久化机制、KEYS *禁用原因及过期键处理策略,强调其在高并发场景下的优势与局限。
【FDE前沿部署工程师实战教程】第62章:Enterprise AI Developer Platform——企业级 AI 开发者平台与低代码 AI 应用工厂
企业从AI能力平台迈向AI应用生产平台,需构建统一的企业级AI开发者平台,将模型、RAG、Agent、Workflow等能力封装为可视化、可复用的开发工具。通过PromptIDE、AgentBuilder、WorkflowBuilder等模块,实现低代码与专业代码协同,降低开发门槛。平台覆盖应用全生命周期管理,集成测试评估、安全治理与CI/CD发布体系,推动AI应用规模化、标准化交付。最终形成“需求→设计→开发→测试→发布→运营”的企业AI应用工厂模式,助力制造等行业的智能化转型。
2942



被折叠的 条评论
为什么被折叠?



