Coding a Maze Runner Program in Java | Beginner Java Tutorial

POSTED ON APRIL 28, 2020
A photo of a maze in someone's hands, with the maze solution drawn out in red.

Project Overview

In this project, Juni Instructor Maya will be showing us how to build a Maze Runner.

Read through the project instructions and steps, to try and figure out how to code this project on your own. If you get stuck or need help, watch Maya's video tutorial or view her solution code below!

Who is this for?

  • Language: Java
  • Juni Level: Java Level 1
  • Ages: 12-18
  • Coding Experience: Familiar with basic Java syntax and concepts.

Learning outcomes:

This project will help us learn how to create, fill, and access elements in 2D arrays. It will also help us practice core concepts like while loops, functions, and conditionals!

  • Core concepts: Taking in user input, While loops, 2D arrays, Conditionals
  • Lines of Code: ~50-75 blocks
  • Difficulty: Moderate
  • Est. Time: ~20-45 min, but this varies by student and how creative you get!

Project Demo

First watch Maya run her finished version of her Maze Runner, to better understand what we are trying to create in this project. We've covered the solution code in the demo, so that you can challenge yourself first.

Maya's Demo:

Instructions:

Ask the user for a width, a height, and a simple maze with those dimensions. The maze will be represented as a grid of characters, where * represents walls, is open space, I is the start of the maze, and O is the end!

Here are some example inputs and their respective solutions:

Problem 1 Answer


Try to do the project on your own first, and get creative with it! If you get stuck or want to check your code, check out Maya’s solution and tutorial video below.

Project Solution & Tutorial

Check your answers or get help by viewing Maya's solution and tutorial video:

Maya's tutorial:

Want to keep learning?

We hope you enjoyed Maya's project tutorial!

To keep practicing and learning, please check out all of our coding tutorials on our blog.

Need help?

Looking up your coding questions is one of the best ways to learn!

Another great way to learn is from an experienced coder or instructor. Juni CS instructors like Maya work closely with students ages 8-18, and are specially trained to adapt to each child's unique learning style, pace, and interests.

Read more about our coding courses for kids, or speak with a Juni Advisor today by calling (650) 263-4306 or emailing advisors@learnwithjuni.com to learn which course may be best for your child’s coding journey. You can also read more about how we use Scratch to teach coding.


Related Reading