目录
109Q游戏(8)123/133/146/165/172/178/184(9-15)
191Q游戏(16)197/203/209/214/219/225/230(17-23)
Orac
Orac是要把所有方块推到目标位置。
这个游戏制作挺精良的,难度挺大的。
(7)
(8)
(11)
有黄色特效的格子是陷阱,只要经过就定住再也出不来了。
(12)
(13)
(14)
(17)
(21)
黄色的不一定是纯陷阱,也有可能既是陷阱又是目的地。
(26)
蓝色特效的格子是一次性墙,用一次就会变成普通格子。
同时,这一关边界的墙没了(只有最下面中间一点点墙还留着),往边界滑动就直接滑出去从而失败了。
(32)
加入了2个方块绑定在一起的机制。
(42)
这一关就是纯粹的调奇偶性。
(44)
4组两两绑定的块。
力扣 490. 迷宫
由空地(用 0 表示)和墙(用 1 表示)组成的迷宫 maze 中有一个球。球可以途经空地向 上、下、左、右 四个方向滚动,且在遇到墙壁前不会停止滚动。当球停下时,可以选择向下一个方向滚动。
给你一个大小为 m x n 的迷宫 maze ,以及球的初始位置 start 和目的地 destination ,其中 start = [startrow, startcol] 且 destination = [destinationrow, destinationcol] 。请你判断球能否在目的地停下:如果可以,返回 true ;否则,返回 false 。
你可以 假定迷宫的边缘都是墙壁(参考示例)。
示例 1:
输入:maze = [[0,0,1,0,0],[0,0,0,0,0],[0,0,0,1,0],[1,1,0,1,1],[0,0,0,0,0]], start = [0,4], destination = [4,4]
输出:true
解释:一种可能的路径是 : 左 -> 下 -> 左 -> 下 -> 右 -> 下 -> 右。
示例 2:
输入:maze = [[0,0,1,0,0],[0,0,0,0,0],[0,0,0,1,0],[1,1,0,1,1],[0,0,0,0,0]], start = [0,4], destination = [3,2]
输出:false
解释:不存在能够使球停在目的地的路径。注意,球可以经过目的地,但无法在那里停驻。
示例 3:
输入:maze = [[0,0,0,0,0],[1,1,0,0,1],[0,0,0,0,0],[0,1,0,0,1],[0,1,0,0,0]], start = [4,3], destination = [0,1]
输出:false
提示:
m == maze.length
n == maze[i].length
1 <= m, n <= 100
maze[i][j] is 0 or 1.
start.length == 2
destination.length == 2
0 <= startrow, destinationrow <= m
0 <= startcol, destinationcol <= n
球和目的地都在空地上,且初始时它们不在同一位置
迷宫 至少包括 2 块空地
class Solution {
public:
int id(int x, int y)
{
return x * col + y;
}
bool inBoard(int r, int c)
{
return r >= 0 && r < row && c >= 0 && c < col;
}
bool dfs(const vector<vector<int>>& grid, vector<int> s, vector<int> d)
{
if(s[0]==d[0]&&s[1]==d[1])return true;
if (m[id(s[0], s[1])])return false;
m[id(s[0],s[1])] = 1;
int dx4[] = { 0,0,1,-1 };
int dy4[] = { 1,-1,0,0 };
for (int i = 0; i < 4; i++) {
int dx = dx4[i], dy = dy4[i];
int r = s[0], c = s[1];
while (inBoard(r + dx, c + dy) && grid[r + dx][c + dy] == 0)r += dx, c += dy;
if (dfs(grid, vector<int>{r, c}, d))return true;
}
return false;
}
bool hasPath(vector<vector<int>>& grid, vector<int>& start, vector<int>& destination) {
row = grid.size();
col = grid[0].size();
m.clear();
return dfs(grid, start, destination);
}
int row;
int col;
map<int, int>m;
};
力扣 505. 迷宫 II
智力游戏——Q游戏系列
智力游戏
中的关卡,所有关卡规则都一样。
15Q游戏(1)27(2)43(3)
15Q游戏(1)
步骤分解:
27(2)
步骤分解:
43(3)
步骤分解:
58Q游戏(4)73(5)85(6)98(7)
58Q游戏(4)
步骤分解:
73(5)
步骤分解:
85(6)
步骤分解:
98(7)
步骤分解:
109Q游戏(8)123/133/146/165/172/178/184(9-15)
109Q游戏(8)
123(9)
133(10)
146(11)
165(12)
172(13)
178(14)
184(15)
191Q游戏(16)197/203/209/214/219/225/230(17-23)
191(16)
197(17)
203(18)
209(19)
214(20)
219(21)
225(22)
230(23)
4399 Q游戏