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
- Basic Java Syntax (PPT, PDF)
- Variables and Datatypes (PPT, PDF)
- Arithmetic Operations (PPT, PDF)
Unit 2: Using Objects
- Objects: Instances of Classes (PPT, PDF)
- (OPTIONAL) User Input with Scanner (PPT, PDF)
- Methods (PPT, PDF)
- Strings (PPT, PDF)
- Math Class And Wrapper Classes (PPT, PDF)
Unit 3: Boolean Expressions and if statements
- Boolean Expressions and if-else-else if statements (PPT, PDF)
- Compound Boolean Expressions and Comparing Objects (PPT, PDF)
Unit 4: Iterations
- While Loops (PPT, PDF)
- For Loops (PPT, PDF)
- Nested Loops (PPT, PDF)
(*Optional*)Computer Animation with Processing
- The Basics(PPT, PDF)
- Working with Images(PPT, PDF)
- Controlling an Image with the Keyboard Lab(ZIP)
- Collision Detection(PPT, PDF)
- Tank Collects Coins Lab(Processing)(ZIP)
- Simple Platformer Game(Mario)(PPT, PDF)
- Simple Platformer(Processing, requires Arraylists)(ZIP)
Unit 5: Writing Classes
- Anatomy of a Java Class (PPT, PDF)
- Implementing the Sprite Class(ZIP)
- Controlling a Sprite Using the Keyboard(ZIP)
- Writing Methods (PPT, PDF)
- Variables, Scope and Semantics (PPT, PDF)
Unit 6: Arrays
- Introduction to Arrays(PPT, PDF)
- Largest Ball Object Lab(ZIP)
- For Each and Array Algorithms(PPT, PDF)
Unit 7: ArrayLists
- Introduction to ArrayLists(PPT, PDF)
- ArrayList Lab(Processing)(ZIP)
- Tank Collects Coins Lab(Processing)(ZIP)
- Searching and Sorting(PPT, PDF)
Unit 8: 2D Arrays
- 2D Arrays(PPT, PDF)
- Connect-Four Lab(Processing)(ZIP)
Unit 9: Inheritance
- Inheritance(PPT, PDF)
- Polymorphism(PPT, PDF)
Unit 10: Recursion
- Recursion(PPT, PDF)
- Fractal Circle Lab(Processing)(ZIP)
- Sierspinski Triangle Lab(Processing)(ZIP)
Preparing for the AP Exam
- Preparation for the AP Exam(PPT, PDF)
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.
- Ball Bounces Off Angles This animation challenge simulates a ball drop on an uneven ground. (Demo, Tutorial, Distribution Code) Solutions can be found here.
- Inverse Kinematics: Pulling A String This animation challenge simulates pulling a string with the mouse. (Demo, Tutorial, Distribution Code)
- Billiard Ball Collisions 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
- Eel: 3D Snake Game by Adam Grant.
- Tetris by Jason Mar.
- Space Wars by Ricky Ciliberto.
- Shooter by Ricky Ciliberto.
- Tiny Tanks by Ben Givertz.
- Star Wars Galaga by Damon Prum.
- Tron by Rachel Lee.
- Space Invaders by Kathy Mei.
- Flippy Bird by John Mikulskis.
- Crazy Snakey by John Mikulskis.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.