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点前能发给我

    评论

报告相同问题?

悬赏问题

  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员