小编Mar*_*ank的帖子

通过迷宫找到所有可能的路径

我正在尝试创建一个程序,它将遍历一个随机生成的迷宫,其中1是开放的,0是墙.从左上角开始到右下角结束.路径可以向上,向下,向左和向右.

目前,我的程序给了我一个解决方案,但我无法让它打印多个路径.

我已经阅读了这个问题的几个不同版本,但我无法找到一个与我的参数相当的版本.

这是我的代码,我省略了随机生成迷宫的部分.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>

int  n, minMatrix, solIndex = 1, minLen = 10000000; //I use the latter 3 variables in order to find the shortest path, not relevant for now


bool solveMaze(int mat[n][n],int x, int y, int sol[][n], int count){

int i, j;
  if((!(x >= 0 && x <n  && y >=0 && y < n)) || mat[x][y] == 0 || sol[x][y] == 1){
    return false;
  }

  if(x == n-1 && y …
Run Code Online (Sandbox Code Playgroud)

maze

7
推荐指数
1
解决办法
1470
查看次数

如何获取当前鼠标指针图像

我想重新使用当前的鼠标指针.我想使用当前选定的鼠标指针图像,并希望底层其他图像.该应用程序是用java编写的

这个想法是,我有一个工具栏,当我使用保存的工具,光标应该是通过垫层操作系统提供的定制工具的图像(磁盘)和置于该鼠标指针图像.

创建自定义curso图像

到目前为止我知道如何更改光标:

Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("images/diskimage.gif");
Point pointerPos = new Point(1,1);
Cursor c = toolkit.createCustomCursor(image , pointerPos, "cursorname");
myPanel.setCursor (c);
Run Code Online (Sandbox Code Playgroud)

我知道如何在彼此上绘制图像,所以我可以创建一个合并的图像.问题是,我不想使用自定义curso图像,而是增强已经使用的游标.

- >但是如何从底层操作系统的光标中获取图像?

java image cursor

5
推荐指数
0
解决办法
1308
查看次数

标签 统计

cursor ×1

image ×1

java ×1

maze ×1