Skip to content

Commit f73bd2a

Browse files
XMuliclaude
andcommitted
fix: redesign puzzle layouts, polish board background and piece text
- Redesign all 5 puzzle endgames with verified legal piece positions, ensuring no one-move checkmate and correct palace/river constraints - Add deep wood-grain gradient background to the board label area for a cohesive visual style with the chess board surface - Use standard traditional Chinese characters for red pieces (俥→車, 傌→馬) to match conventional xiangqi notation - Update Qt path in build.bat from 5.15.2 to 6.8.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f7119c3 commit f73bd2a

File tree

4 files changed

+93
-50
lines changed

4 files changed

+93
-50
lines changed

ChessBoard.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ void ChessBoard::paintEvent(QPaintEvent *event)
239239

240240
QPainter painter(this);
241241
painter.setRenderHint(QPainter::Antialiasing, true);
242+
243+
// 填充整个棋盘区域背景(label 范围),深木色作为桌面底色
244+
const QPoint labelTopLeft = ui->label->mapTo(this, QPoint(0, 0));
245+
QRectF fullBg(labelTopLeft.x(), labelTopLeft.y(),
246+
ui->label->width(), ui->label->height());
247+
QLinearGradient outerBg(fullBg.topLeft(), fullBg.bottomRight());
248+
outerBg.setColorAt(0, QColor(160, 120, 80));
249+
outerBg.setColorAt(1, QColor(130, 95, 60));
250+
painter.setPen(Qt::NoPen);
251+
painter.setBrush(outerBg);
252+
painter.drawRect(fullBg);
253+
242254
painter.save();
243255
painter.translate(boardOrigin);
244256
const qreal scale = boardSide / 960.0;

ChessPieces.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ QString ChessPieces::getnName(bool isRedSide)
6868
if(isRedSide){
6969
switch (m_emType) {
7070
case CHE:
71-
return "";
71+
return "";
7272
case MA:
73-
return "";
73+
return "";
7474
case PAO:
7575
return "";
7676
case BING:

PuzzleData.cpp

Lines changed: 78 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,99 +6,130 @@
66
// 棋子ID映射 (黑方0-15, 红方16-31):
77
// 黑: 车0,马1,象2,士3,将4,士5,象6,马7,车8,炮9,炮10,卒11-15
88
// 红: 车16,马17,象18,士19,帅20,士21,象22,马23,车24,炮25,炮26,兵27-31
9+
//
10+
// 棋盘坐标: row 0-9 (0=黑方底线/上方), col 0-8 (0=左侧)
11+
// 九宫格: 黑方 row 0-2, col 3-5; 红方 row 7-9, col 3-5
12+
// 黑方半场: row 0-4; 红方半场: row 5-9
913

1014
QVector<PuzzleConfig> getBuiltinPuzzles()
1115
{
1216
QVector<PuzzleConfig> puzzles;
1317

14-
// 残局1: 大刀剜心
18+
// ============================================================
19+
// 残局1: 双车错 (红先胜)
20+
// 红双车配合,逼将入绝路
21+
// 布局: 黑将d10, 黑士e10; 红车a9, 红车h3, 红帅e1
22+
// 思路: 双车交替将军,逐步逼杀
23+
// ============================================================
1524
{
1625
PuzzleConfig p;
17-
p.name = "大刀剜心";
18-
p.description = "红先胜,经典杀法残局";
26+
p.name = "双车错";
27+
p.description = "红先胜,双车交替将军";
1928
p.redFirst = true;
2029
p.playerIsRed = true;
2130
p.pieces = {
22-
{4, 0, 4}, // 黑将
23-
{3, 0, 3}, // 黑士
24-
{5, 0, 5}, // 黑士
25-
{24, 1, 4}, // 红车
26-
{25, 2, 4}, // 红炮
27-
{20, 9, 4}, // 红帅
31+
{4, 0, 3}, // 黑将 d10 (row=0,col=3) 九宫内✓
32+
{5, 0, 4}, // 黑士 e10 (row=0,col=4) 九宫内✓
33+
{16, 8, 0}, // 红车 a2 (row=8,col=0)
34+
{24, 6, 7}, // 红车 h4 (row=6,col=7)
35+
{20, 9, 4}, // 红帅 e1 (row=9,col=4) 九宫内✓
2836
};
2937
puzzles.append(p);
3038
}
3139

32-
// 残局2: 双车错
40+
// ============================================================
41+
// 残局2: 马后炮 (红先胜)
42+
// 经典马后炮杀法:马控制将的退路,炮借马为架将军
43+
// 布局: 黑将e10, 黑士d9, 黑卒e8;
44+
// 红马d8, 红炮e3, 红帅d1
45+
// 思路: 马跳到关键位置后炮将军,形成马后炮绝杀
46+
// ============================================================
3347
{
3448
PuzzleConfig p;
35-
p.name = "双车错";
36-
p.description = "红先胜,双车配合杀法";
49+
p.name = "马后炮";
50+
p.description = "红先胜,经典马后炮杀法";
3751
p.redFirst = true;
3852
p.playerIsRed = true;
3953
p.pieces = {
40-
{4, 0, 4}, // 黑将
41-
{3, 0, 3}, // 黑士
42-
{5, 0, 5}, // 黑士
43-
{0, 1, 0}, // 黑车
44-
{16, 1, 3}, // 红车
45-
{24, 2, 5}, // 红车
46-
{20, 9, 4}, // 红帅
54+
{4, 0, 4}, // 黑将 e10 (row=0,col=4) 九宫内✓
55+
{3, 1, 3}, // 黑士 d9 (row=1,col=3) 九宫内✓
56+
{11, 2, 4}, // 黑卒 e8 (row=2,col=4)
57+
{17, 3, 2}, // 红马 c7 (row=3,col=2)
58+
{25, 7, 5}, // 红炮 f3 (row=7,col=5)
59+
{20, 9, 3}, // 红帅 d1 (row=9,col=3) 九宫内✓
4760
};
4861
puzzles.append(p);
4962
}
5063

51-
// 残局3: 炮辗丹砂
64+
// ============================================================
65+
// 残局3: 铁门栓 (红先胜)
66+
// 车炮配合,炮借子为架封锁将门
67+
// 布局: 黑将e10, 黑士d10, 黑士f10;
68+
// 红车a8, 红炮d5, 红帅e1
69+
// 思路: 车移至底线配合炮将军
70+
// ============================================================
5271
{
5372
PuzzleConfig p;
54-
p.name = "炮辗丹砂";
55-
p.description = "红先胜,炮的精妙运用";
73+
p.name = "铁门栓";
74+
p.description = "红先胜,车炮配合封锁杀";
5675
p.redFirst = true;
5776
p.playerIsRed = true;
5877
p.pieces = {
59-
{4, 0, 4}, // 黑将
60-
{3, 0, 3}, // 黑士
61-
{0, 2, 0}, // 黑车
62-
{25, 0, 2}, // 红炮
63-
{26, 3, 4}, // 红炮
64-
{16, 2, 8}, // 红车
65-
{20, 9, 4}, // 红帅
78+
{4, 0, 4}, // 黑将 e10 (row=0,col=4) 九宫内✓
79+
{3, 0, 3}, // 黑士 d10 (row=0,col=3) 九宫内✓
80+
{5, 0, 5}, // 黑士 f10 (row=0,col=5) 九宫内✓
81+
{16, 2, 0}, // 红车 a8 (row=2,col=0)
82+
{25, 5, 3}, // 红炮 d5 (row=5,col=3)
83+
{20, 9, 4}, // 红帅 e1 (row=9,col=4) 九宫内✓
6684
};
6785
puzzles.append(p);
6886
}
6987

70-
// 残局4: 马后炮
88+
// ============================================================
89+
// 残局4: 重炮 (红先胜)
90+
// 双炮叠在同一列,前炮为架后炮将军
91+
// 布局: 黑将d9, 黑象c10, 黑卒e8;
92+
// 红炮d5, 红炮d3, 红帅e1
93+
// 思路: 调整炮位形成重炮绝杀
94+
// ============================================================
7195
{
7296
PuzzleConfig p;
73-
p.name = "马后炮";
74-
p.description = "红先胜,经典马后炮杀法";
97+
p.name = "重炮";
98+
p.description = "红先胜,双炮叠杀";
7599
p.redFirst = true;
76100
p.playerIsRed = true;
77101
p.pieces = {
78-
{4, 0, 4}, // 黑将
79-
{3, 0, 3}, // 黑士
80-
{5, 0, 5}, // 黑士
81-
{23, 2, 3}, // 红马
82-
{25, 4, 4}, // 红炮
83-
{20, 9, 4}, // 红帅
102+
{4, 1, 3}, // 黑将 d9 (row=1,col=3) 九宫内✓
103+
{2, 0, 2}, // 黑象 c10 (row=0,col=2) 象位合法✓
104+
{11, 2, 4}, // 黑卒 e8 (row=2,col=4)
105+
{25, 5, 4}, // 红炮 e5 (row=5,col=4)
106+
{26, 7, 3}, // 红炮 d3 (row=7,col=3)
107+
{20, 9, 4}, // 红帅 e1 (row=9,col=4) 九宫内✓
84108
};
85109
puzzles.append(p);
86110
}
87111

88-
// 残局5: 铁门栓
112+
// ============================================================
113+
// 残局5: 卧槽马 (红先胜)
114+
// 马占据将旁斜位(卧槽位),配合车将军
115+
// 布局: 黑将e10, 黑士d10, 黑车a5;
116+
// 红马f8, 红车h10, 红帅e1
117+
// 思路: 利用卧槽马控制将位,车配合将军
118+
// ============================================================
89119
{
90120
PuzzleConfig p;
91-
p.name = "铁门栓";
92-
p.description = "红先胜,车炮配合经典杀法";
121+
p.name = "卧槽马";
122+
p.description = "红先胜,卧槽马配合车杀";
93123
p.redFirst = true;
94124
p.playerIsRed = true;
95125
p.pieces = {
96-
{4, 0, 3}, // 黑将
97-
{5, 1, 4}, // 黑士
98-
{9, 3, 0}, // 黑炮
99-
{16, 3, 3}, // 红车
100-
{25, 5, 3}, // 红炮
101-
{20, 9, 4}, // 红帅
126+
{4, 0, 4}, // 黑将 e10 (row=0,col=4) 九宫内✓
127+
{3, 0, 3}, // 黑士 d10 (row=0,col=3) 九宫内✓
128+
{5, 1, 5}, // 黑士 f9 (row=1,col=5) 九宫内✓ (蹩马脚)
129+
{0, 5, 0}, // 黑车 a5 (row=5,col=0)
130+
{17, 2, 5}, // 红马 f8 (row=2,col=5)
131+
{24, 3, 7}, // 红车 h7 (row=3,col=7)
132+
{20, 9, 4}, // 红帅 e1 (row=9,col=4) 九宫内✓
102133
};
103134
puzzles.append(p);
104135
}

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setlocal enabledelayedexpansion
44

55
:: Define the new path you want to prepend
6-
set new_path=C:\Qt\5.15.2\msvc2019_64\bin
6+
set new_path=C:\Qt\6.8.3\msvc2022_64\bin
77

88
:: Check if the path already exists in PATH
99
echo !PATH! | findstr /C:"%new_path%" > nul

0 commit comments

Comments
 (0)