qq_41555976 2018-11-18 20:27 采纳率: 0%
浏览 745

我有一个代码,能不能帮我把里面的swing和awt改成JavaFx,急需。联系QQ3246798340,可rmb报酬

package _4;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Random;
import java.util.Stack;

/**

  • 迷宫生成算法和迷宫寻路算法
  • @author ygch
    */
    public class Maze {
    private int height;
    private int width;
    private Random r; //随机位置生成器
    private boolean blocked[][];
    boolean[][] visited;//寻路过程中判断某个位置是否已经被访问过
    private Stack path;//寻路过程中保存的路径
    private final int[][] direction={{0, -1}, {1, 0}, {0, 1}, {-1, 0}};

    /**

    • 重构equals函数,方便后面的比较操作 */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Maze other = (Maze) obj; return height == other.height && width == other.width; }

    public Maze(int height, int width) {
    super();
    this.height = height;
    this.width = width;
    //让整个迷宫的大小为奇数,这样可以构造一行路一行墙的迷宫
    if(this.height%2==0) this.height+=1;
    if(this.width%2==0) this.width+=1;
    r = new Random();
    path= new Stack<>();

    //给迷宫四周加上墙
    blocked = new boolean[this.height + 2][this.width + 2];
    visited=new boolean[this.height+2][this.width+2];
    
    // 最左和最右两列置1
    for (int i = 0; i < this.height + 2; i++) {
        blocked[i][0] = true;
        blocked[i][this.width + 1] = true;
    }
    
    // 最上和最下两行置1
    for (int i = 0; i < this.width + 2; i++) {
        blocked[0][i] = true;
        blocked[this.height + 1][i] = true;
    }
    

    }

    public int getHeight()
    {
    return height;
    }

    public int getWidth()
    {
    return width;
    }

部分如上

  • 写回答

1条回答

  • qq_41555976 2018-11-18 20:36
    关注

    希望今天早上10点前能发给我

    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条