Friday, March 8, 2013

Teaching AP Computer Science: Continuing CH7+8 Loops and Arrays!




Teaching AP Computer Science: Continuing CH7+8 Loops and Arrays! 

We finished the Roman and Polygon classes emphasizing for loops and ArrayLists to find the area of polygons based on vector cross products. We also did a lot with overriding equals() and toString from the Object class as well as implementing the Comparable interface. We did a lot with inheritance in GridWorld. We haven't done much with interfaces and polymorphism as of yet. Now, we are writing Chess960.java to generate random chess boards and record chess games with a mix of for each loops, while loops, static arrays and ArrayLists as well a 1D and 2D arrays! Version 1 will generate one board using the Random class and String[8]. Version 2 will add an ArrayList of String[8] to Randomly generate all 960 combinations. Then, Version 3 will use String [8][8] to play game!

We finished Chess960V1 and started Chess960V2 this week. V2 uses an ArrayList to keep track of all the boards generated so far to avoid repetition. So that's a 2D data structure: an ArrayList with 960 String[8]!

After all that, I think we'll go back to GridWorld Part IV. We'll also do some chapters on recursion, static classes and, finally, searching and sorting. Don't forget, we covered chapters 1-5 thoroughly before even starting GridWorld Parts I-III.

I think we'll continue Take Home Tuesdays from now until AP Week! We are now ready for Take Home #5 as we are good at loops and arrays. 

Here's our ScreenCasts and Code for this last week:







myPasteBin code for APCS2012
myProgramr code for APCS2012

Well, that's all folks!
Teaching with Technology, 

No comments:

Post a Comment