title: Pacman maze in Java
body: <p>So I'm building the pacman game in Java to teach myself game programming.</p>
  
  <p>I have the basic game window with the pacman sprite and the ghost sprites drawn, the pacman moves with the arrow keys, doesn't move beyond the walls of the window, etc. Now I'm trying to build the maze, as in this picture:</p>
  
  <p><img src="https://upload.wikimedia.org/wikipedia/en/5/59/Pac-man.png" alt="Pacman maze"></p>
  
  <p>Without giving me the direct/complete solution to this, can someone guide me as to how this can be built? I'm talking only about the boundaries and the pipes('T' marks) here which you can't go through and you have to go around. Not the dots which the pacman eats yet.</p>
  
  <p>Here are my questions:</p>
  
  <p>1) What's the most efficient algorithm/method for creating this maze? Will it have to be drawn each time the paint() method is called or is there a way to draw it only at the start of the game and never again?</p>
  
  <p>2) How will this actually be drawn to the screen? I assume the <code>fillRect()</code> will be used?</p>
  
  <p>3) Any hints on collision detection (so the pacman/ghosts can't go through the walls) would be helpful.</p>
  
  <p>4) Any hints on how the vacant space between the pipes will be calculated so the dots can be filled between them will also be very helpful.</p>
  
  <p>Thanks</p>