Showing posts with label AP Comp Sci. Show all posts
Showing posts with label AP Comp Sci. Show all posts

Wednesday, December 30, 2009

AP Comp Sci: Installing and using the Gridworld .JAR file

AP Comp Sci students,

This term we'll be working the Gridworld Case Study. This post is to help you get through installing and using it with Eclipse.

1. Visit the AP Computer Science Gridworld Case Study website, and download the .zip file called 'Code' at that site. A direct link is here, but it is worth visiting the website above at least once. Here's the formal installation guide -- basically the same information as below.

2. Unzip and set aside the .zip file. Do not alter the file structure within the GridWorldCode folder. It should look something like the following (taken on a PC):


3. Open Eclipse. You will now want to make a new Java project. Call this project 'GridWorld Project 1 - Your Name' (in my case, it would be 'GridWorld Project 1 - Byron Philhour'). Before clicking forward, under 'Contents' click on 'Create Project from Existing Source' and navigate within the GridWorldCode folder to the /projects/firstProject folder.


Click next -- do not click 'Finish' yet.

4. You should be in Java Settings now. Click on the 'Libraries' tab and then on the 'Add External JARs' button. Browse into GridWorldCode and select 'gridworld' (this should be a jar file).



Click 'Open' and 'Finish.'

5. Within the Eclipse workbench, navigate to the new project (you are likely already in it). In the /src folder you will find BugRunner.java. Double-click on it to open it. It should look something like this:


6. Compile and run this program. The 'GridWorld' with a single red bug and a single black rock should appear. You have now successfully begun programming with the GridWorld case study. Here's what it should look like now:


Play around.

Cheers,

BJP

Saturday, October 31, 2009

AP Comp Sci: thoughts on JPanel

Asked a fairly open-ended question on a recent exam: "What's the difference between the ColorPanel classes we've been creating & using these past few weeks, and the JPanel class?"

During grading, following came to me: one way of thinking about JPanel is that, for our purposes, it exists primarily to be extended. It is like unmolded clay -- a framework -- that we want to build on. But we wouldn't really use it very much just on its own -- it is too boring.