Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Introduction

You should do this project if…

  • You feel comfortable with Java.
  • You would like to tackle a challenging problem.
  • You would like to learn more about intermediate Artificial Intelligence algorithms.
  • You would like to work with a bigger code base than what we have used before.
  • You would enjoy working with graphics without the use of an external library. Create graphics from scratch.
  • You like games and algorithms.

Starter Code Files

https://github.com/emlag/Y11SnakePro

Project Setup

Introduction

This project introduces and practices a number of different techniques that are common to software engineering, that is the design and implementation of large software projects. Certainly this assignment can only provide a taste of this important field.

The SnakePro applet is a bigger and more complex beast than you have had to deal with in the past.  Before you begin, we provide you with an overview of the software design behind the Applet you will create. Being asked to work within an established codebase is the norm in the “real world”, so this is good practice. The only difference is that this isn’t a large codebase compared to what you’ll see in industry.

The functionality of the application is broken down into multiple classes. There are three main classes that you’ll be using

  • SnakeProData.java: Responsible for storing all of the data for the board that represents the Board.
  • SnakeProDisplay.java: Responsible for drawing the board on the screen.
  • SnakeProBrain.java: Responsible for the logic of the game, e.g., deciding how to move the snake, as well as handling keystrokes and controlling the timesteps that move the snake forward.

Before you start you will want to make sure that you have the Java Applet Support plugin for IntelliJ:

First navigate to you preferences:

Next you’ll want to search for the Java Applet Support Plugin, install it and click Apply -> OK.

Program Description

This project gives a user control over a spam-seeking snake (you can change the food image if you want!). Key presses from the keyboard change the direction of the snake’s movement in order to intersect snacks (spam) that appear at random places on the screen. For each snack consumed, the snake grows by one segment (a segment is simply one BoardCell). Variations are welcome (see the extra credit section below)!

If you want to change the image for the food, replace the current food.gif file in src/main/java/resources with a different image also called food.gif.