Long Nguyen

Resources and online courses for Math and Computer Science.

AP Computer Science Java

This is a resource for teachers and students for AP Computer Science A. This curriculum follows the newly revised 2019 College Board curriculum, which consists of 10 units. In addition, the emphasis is to help students learn how to code 2D arcade games using Processing. In particular, students will work on writing a full platformer game like Super Mario from scratch.

Lecture Notes

The following powerpoint lecture slides are adapted from the book Building Java Programs: A Back to Basics Approach by Stuart Reges and Marty Stepp as well as the Runestone's CS Awesome curriculum.

Unit 1: Primitive Types
  1. Basic Java Syntax (PPT, PDF)
  2. Variables and Datatypes (PPT, PDF)
  3. Arithmetic Operations (PPT, PDF)
Unit 2: Using Objects
  1. Objects: Instances of Classes (PPT, PDF)
  2. (OPTIONAL) User Input with Scanner (PPT, PDF)
  3. Methods (PPT, PDF)
  4. Strings (PPT, PDF)
  5. Math Class And Wrapper Classes (PPT, PDF)
Unit 3: Boolean Expressions and if statements
  1. Boolean Expressions and if-else-else if statements (PPT, PDF)
  2. Compound Boolean Expressions and Comparing Objects (PPT, PDF)
Unit 4: Iterations
  1. While Loops (PPT, PDF)
  2. For Loops (PPT, PDF)
  3. Nested Loops (PPT, PDF)
(*Optional*)Computer Animation with Processing
  1. The Basics(PPT, PDF)
  2. Working with Images(PPT, PDF)
    • Controlling an Image with the Keyboard Lab(ZIP)
    • Basic Circle/Rectangle Collision Detection(ZIP)

Unit 5: Writing Classes
  1. Anatomy of a Java Class (PPT, PDF)
    • Implementing the Sprite Class(ZIP)
    • Collision Detection(ZIP)
  2. Writing Methods (PPT, PDF)
  3. Variables, Scope and Semantics (PPT, PDF)
Unit 6: Arrays
  1. Introduction to Arrays(PPT, PDF)
    • Largest Ball Object Lab(ZIP)
  2. For Each and Array Algorithms(PPT, PDF)
Unit 7: ArrayLists
  1. Introduction to ArrayLists(PPT, PDF)
    • ArrayList Lab(Processing)(ZIP)
    • Tank Collects Coins Lab(Processing)(ZIP)
    • Tank Shoots Crates Lab(Processing)(ZIP)
  2. Searching and Sorting(PPT, PDF)
Unit 8: 2D Arrays
  1. 2D Arrays(PPT, PDF)
    • Grid Connect-Four Lab(Processing)(ZIP)
Unit 9: Inheritance
  1. Inheritance(PPT, PDF)
  2. Polymorphism(PPT, PDF)
Unit 10: Recursion
  1. Recursion(PPT, PDF)
    • Fractal Circle Lab(Processing)(ZIP)
    • Sierspinski Triangle Lab(Processing)(ZIP)

How to Write a Platformer Game in Java

In this short video series course, we will learn how to write a platformer (or side-scrolling) game like Super Mario. We will write this game from scratch with very basic algebra without relying on any physics engine! Here's a short 2-minute preview of the game. The entire Youtube playlist for this curriculum can be found here. The webpage including labs for the curriculum is here.

Coding Challenges

A series of coding challenges. Most are mathematical in focus and require some trignometry. The distribution code is included and provides a template for completing the code. Processing is used for the animation challenges.

  1. Ball Bounces Off Angles
  2. This animation challenge simulates a ball drop on an uneven ground. (Demo, Tutorial, Distribution Code) Solutions can be found here.
  3. Inverse Kinematics: Pulling A String
  4. This animation challenge simulates pulling a string with the mouse. (Demo, Tutorial, Distribution Code)
  5. Billiard Ball Collisions
  6. This animation challenge simulates collisions of billiard balls in 2D. (Tutorial, Distribution Code) Solutions to the two-ball case and the many-ball case with the glitch fix.

Final Projects

Below are some of the most creative programming projects from my students at Boston Latin School. All are written in Java using the Processing IDE and ported to Javascript using ProcessingJS for the browser. I have only tested this on Google Chrome. Let me know if there are any errors. The basic requirements are that their programs are object-oriented with at least three or more objects and that inheritance and polymorphisms are used in a sensible way. Click on the project title to play.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.