Posts

Showing posts from April, 2017

CSIT 441

Image
I already finished the core part of my program, and I am working on the layout now. I use GUI to set the game layout. First, I create a package Maze, which is a tool for building the interface. So this is what I got now.

CSIT 441

Maze generator The method that I used to generate the maze comes from a Java game design book. And this week, I am still working on how to make a random maze. I build a new method generate. I use a Boolean to mark the sell or square and use random generator to generate a direction. Then I will not visit the squares I marked. Then I still use random generator to generate a number which decide the direction. But here are a lot of situations, I already finished the cases when the  square is at top left, top right, bottom left and bottom right, which have only two direction. In addition, here are two other cases. One for the square at the first lines but the corner, which have four situations at four sides. For this case, I need to generator three different directions. And the last case is the square in the middle, which are all the squares except the outermost layer, so I have (height-2)*(width-2) squares. For this case, I have to generate 4 different directions obviously. Actually, wha

Random Maze Generator

         I was planning to do a KENKEN problem solver but recently I changed my idea for the final project. I am doing the Random Maze Generator now. I am trying to get the Maze randomly and find the solution right away with DFS.          Firstly, I set the size of the maze, and set the first maze as matrix which are the height and the width. Then I got number of the squares are h*w. And I can generate the vertical and horizontal wall randomly according to signs. I need to make the unit square with a Boolean statement: this.notMarked = new boolean[this.height][this.width]; Actually my general idea of the maze generator is trying to take the walls away randomly. So I do need to judge the existence of the both vertical and horizontal walls. Constantly randomly choose one side wall, if it can be separated by the walls of the room which is not connected to each other, then pull down the wall. Then repeat the process until the entre and the exit, resulting in the maze.  And the key prob