Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: need help creating a maze program

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help creating a maze program

    Hi everyone!

    Im new to the forum and this is my first post. I want to create a maze where i am able to move around with a dot. But i cant even create the maze it only shows a blank window and im rly confused in what to do.
    So i hope u can help me, correct the code for me and tell me what do to next.

    I would rly appreciate the help and ty in advance.
    btw im a beginner so try to make it as simple as possible ty...

    My code this far is:

    class Mazegame {
     
        public static void main(String[] args) {
    	new Mazegame().run();
        }
     
        void run() {
    	Game game = new Game();
    	game.run();
        }
    }
     
    class Game {
     
        private DotWindow w;
        private int width;
        private int height;
     
        public void run() {
    	setup();
        }
     
        private void setup() {
    	w = new DotWindow(50, 50, 10);
    	w.setDot(0, 25, Color.RED);
    	generate(width, height);
        }
     
        private void generate(int width, int height) {
    	width = Keyboard.nextInt("ange bredd: ");
    	height = Keyboard.nextInt("ange höjd: ");
    	int[][] maze = MazeGenerator.generate(width, height);
    	for(int x = 1; x < width - 1; x++) {
    	    for(int y = 1; y < height - 1; y++) {
     
    	    }	
    	}
        }
    }
    Last edited by copeg; February 2nd, 2011 at 03:10 PM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: need help creating a maze program

    For future reference, please use the format your code to make it readable (read the announcements post at the top of every forum for instructions - I've edited your post this time).

    You've posted a limited amount of code for us to help out. The window class that isn't posted is important in diagnosing the problem

Similar Threads

  1. Creating a java program to "Beat" Snake web app?
    By AkOndray in forum AWT / Java Swing
    Replies: 2
    Last Post: December 5th, 2010, 12:36 AM
  2. Recursion Maze
    By sman1234 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 28th, 2010, 11:40 AM
  3. Creating program Blackjack - Dr.Java
    By TheUntameable in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 20th, 2010, 12:54 PM
  4. Need help creating this program
    By ixjaybeexi in forum File I/O & Other I/O Streams
    Replies: 25
    Last Post: October 19th, 2009, 07:08 AM
  5. Problem in recursion for Solving Maze Recursively program
    By _Coder1985 in forum Algorithms & Recursion
    Replies: 1
    Last Post: April 29th, 2009, 04:37 AM