Title: Fun Things: Extra Content Summary
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Fun Things: Extra Content Summary

Running Java Programs outside of Eclipse

- In this set of notes we look at ways to run your program without the assistance of Eclipse. We are only making use of the Java platform.

Playing Sounds in Java

- This section covers a rudimentary program for playing Sound in Java. It works with ".wav" files, but we discuss how to convert any other format (like .mp3) to .wav using another application like "Audacity".
- A trivial sound player is shown that has a lot of limitations.
- A more functional sound player is created using concepts already covered in the course. This enhanced sound player can play a list of sounds, loop and be controlled to skip or stop the sound playing on demand.

JUnit Testing - Basics

- In this lecture, we take the Fraction assignment covered in cps161 and show how you could systematically test this code using an industry favorite testing tool called JUnit. JUnit is built into Eclipse.

JUnit Testing - Extras

- This lecture continues the JUnit lecture concepts. In addition to looking at additional JUnit features, we demonstrate an Eclipse pluggin which allows us to see which lines of our code have been tested: "coverage analysis"

Regular Expressions - String methods

- In this set of notes we introduce the concept of regular expressions and some of the useful methods in the String class that uses them: replaceAll and split.

Regular Expressions Matching

- This set of notes adds some more Regular Expression capabilities and uses it to demonstrate more of the power built into this concept.
- The matches String method is used. Also the classes which really do the work (Pattern and Matcher) are introduced.

Regular Expressions - substrings

- More capabilities of the Matcher and Pattern class are demonstrated. Also we introduce more Regular Expression capabilites. In this set of notes we are matching substrings of a bigger string of text. This is the underlying functionality of the split and replaceAll methods described in a in the "Regular Expressions - String methods" lecture.

Recursion and Stacks basics

- In this lecture we discuss recursion and the alternatives to recursion (often the alternative is using a stack).
- We start out with Factorial and Fibonacci problems. Using recursion with Fibonacci has a performance flaw that is demonstrated. In the lecture we show you how to compensate for the performance flaw in the recursive Fibonacci solution.
- The Knapsack problem is solved using recursion and using a stack.

Recursion: Towers of Hanoi

- In this video we demonstrate solving the Towers of Hanoi with recursion. I consider this an excellent example of where recursion is a great choice!! In general this a tough problem to solve, but recursion makes the solution deceptively simple.

N-Queens Recursion vs. Stack Algorithm

- The N-Queens problem can be defined as having N queens on a board (like a chessboard) which has N rows and N columns. Note that N can be 4, 5, ....8, 9, 10, .... Our job is to place the N queens on the board such that none of the queens can be attacked by any of the other queens.
- In this lecture, we demonstrate 2 ways to solve the problem. One is with recursion and the other is with a stack.
- To demonstrate the algorithm we connect our problem solver to some additional code which draws the board and slows down the solver so that you can see the algorithm in action (we slow it down to have a second between each new step).
- To make all of this happen we make use of earlier concepts discussed in this course including: Threads, sleep, wait, notify, etc.

Maize Stack Algorithm

- In this lecture we take a look at finding a path through a Maize.
- The solution demonstrated in this lecture uses a Stack approach.
- Because the number of combinations you would encounter using a Stack is staggering, we provide some heuristics to provide some intelligence to the Maize stacking algorithm.
- We also demonstrate the algorithm by drawing it in action on the screen using a similar techniques as we used in the N-Queens problem above that uses Threads to slow down the problem solver.
- Further more, if you can solve a Maize then in this lecture we demonstrate that you can create a Maize. The idea is that you start out with a Maize that has few options and ask the solver to try to find a path. When the solver comes back with a failure indication, we then randomly "punch" an additional hole in the Maize and try again. If we punch enough holes in the Maize then eventually our Solver will come up with its first solution. At this point we stop and save the Maize created knowing there is at least one path through the Maize.
- I might point out that similar thinking to the Maize problem can be used for solving other puzzles. For example, I have created Sudoku problem solvers. Additionally by using a created Sudoku problem solver I can create Sudoku puzzles.

Last Modified: July 21, 2015 6:51 AM