This post covers the week before April Break (3/18/13-3/22/13) and the week after (4/1/13-4/5/13). The first week we finished Chess960 and started a tournament. This week we finished the tournament and started Recursion. We are overriding the Math class by writing our own Math.java static class! We started by overloading the pow() method:
public static int pow(int base, int exp),
public static int pow(double base, int exp),
That way we can test each method separately. We want to compare interation to recursion to the standard Math.pow() method. So, the first pow() uses a product for loop. The second pow() uses recursion based on the fact that base^exp=base*base^(exp-1). The last pow() method with use log() and exp(). My students will be in for a rude awakening when they try to use Math.log() and Math.exp() from the standard java.lang.Math class....
We have a Take Home due this Monday on the Comparable Interface. We will follow recursion with GridWorld Part IV and AP Review! BTW, Chapter 19 on Searching and Sorting Algorithms will be sent home as a reading assignment. Searching and Sorting isn't a big topic on the AP Computer Science exam anymore and we need time for AP Review.
Here's our ScreenCasts and Code for this last week:
myPasteBin code for APCS2012
myProgramr code for APCS2012