JAVA - 如何创建我的退出迷宫?

时间:2016-03-06 20:12:33

标签: java maze

*我试图在迷宫的右侧打开我的RANDOM出口迷宫: Exit Maze 这是我的代码:

private int hauteur;
private int largeur;
private static final int LMURET = 8;
private static final int HMURET = 4;
private char[][] dessinLaby;

public Labyrinthe(int h, int w) //en nbre de cases
{
    this.hauteur = h;
    this.largeur = w;
    this.dessinLaby = new char[this.hauteur*HMURET+1][this.largeur*LMURET+1];       
}
public void dessineOuverture(int j)
    {
        for(int x=(j*LMURET+1)-1; x<j*LMURET+1; x++)
        {
            int a = (int) ( Math.random()*((hauteur*HMURET+1)-2) );

            if( (a%4) != 0)
            {
                for(int b=0; b<2; b++)
                {
                        System.out.println(this.dessinLaby[a][(j*LMURET+1)-1] = ' '); // dans le cas ou ca tombe sur 1
                }
            }
        }
    }

但是没有任何事情发生,你能帮助我吗?*

1 个答案:

答案 0 :(得分:0)

这是你的另一个问题,但如果你使用它,你会得到退出

entity LA_Unit is
    Port ( Cin : in  STD_LOGIC;
           P : in  STD_LOGIC_VECTOR (3 downto 0);
           G  : in  STD_LOGIC_VECTOR (3 downto 0);
           C3 : out  STD_LOGIC;
           C   : out  STD_LOGIC_VECTOR (2 downto 0)
  );
end entity;

architecture rtl of LA_Unit is
  signal C_i : STD_LOGIC_VECTOR(3 downto 0);
begin
  C_i(0) <= (P(0) and Cin) xor G(0);
  C_i(1) <= (P(1) and C_i(0)) xor G(1);
  C_i(2) <= (P(2) and C_i(1)) xor G(2);
  C_i(3) <= (P(3) and C_i(2)) xor G(3);
  C  <= C_i(2 downto 0);
  C3 <= C_i(3);
end architecture