Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2eec824

Browse files
committed
notes
1 parent441dba7 commit2eec824

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎dfs/FiveChessman.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public static Coordinate findWin(int[][] in) {
7676
}
7777

7878
// row, col 代表我们现在正在扫描的点的坐标
79+
// side 记录目前是哪一方的棋子
80+
// direction 记录扫描方向,有四个方向扫描:右,右下,左下,下。
81+
// num: 代表扫描到第几个棋子了。
7982
publicstaticCoordinatefindWinHelp(int[][]in,intcol,introw,intside,intdirection,Visit[][]visit,intnum) {
8083
// 扫描不可以超过范围
8184
if (col >=in.length ||row >=in.length ||row <0 ||col <0) {
@@ -87,6 +90,7 @@ public static Coordinate findWinHelp(int[][] in, int col, int row, int side, int
8790
returnnull;
8891
}
8992

93+
// 必须是同边的棋子。例如,都是1,或都是2.
9094
if (side !=in[row][col]) {
9195
returnnull;
9296
}
@@ -96,10 +100,12 @@ public static Coordinate findWinHelp(int[][] in, int col, int row, int side, int
96100
returnnewCoordinate(col,row);
97101
}
98102

103+
// 如果未设置标记,新建标记。
99104
if (visit[row][col] ==null) {
100105
visit[row][col] =newVisit(false,false,false,false);
101106
}
102107

108+
// 对各个方向进行不同的搜索方向。
103109
if (direction ==0) {
104110
if (visit[row][col].right) {
105111
returnnull;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp