DOC PREVIEW
Stanford CS 106A - Study Notes

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Eric Roberts Handout #10CS 106A January 6, 2010Karel ContestDue: 5:00P.M., Wednesday, January 20The first assignment is designed to teach you about Karel’s capabilities and to reinforcebasic programming concepts. Karel is a good medium for teaching such concepts butalso has other virtues. In particular, programming Karel can be a lot of fun. This contestgives you the opportunity to explore this aspect of Karel’s world. It is entirely optional,but gives you a chance for some extra credit in the course.Your mission, should you decide to accept it, is to program Karel to solve an interestingand exciting problem of your own choosing. You can program Karel to produce thedefinitive work of computer art, to illustrate a story, or to tackle a conceptually difficulttask. The entries will be judged by the CS 106A staff (see official rules below), and aprize will be awarded in each of two categories:• Aesthetic merit. This prize is awarded to the program that, in the opinion of thejudges, has the greatest literary, artistic, or entertainment value.• Algorithmic sophistication. This prize is awarded to the Karel program that solves themost challenging task in the most interesting way.PrizesThe first prize in each of the categories will be that we will replace whatever individualscore most negatively affects your grade with a 100%. Thus, if you are one of the twoKarel contest winners, and you bomb an assignment, the midterm, or even the final, wewill overlook that misstep and count it as a 100%. By putting in a little extra effort now,you could reduce substantially the amount of pressure later in the course, which can comein handy. Best of luck!New extensionsFor a couple of years now, I’ve been meaning to add a couple of extensions to Karel thatwould make it easier to write exciting contest entries. I’ve finally done it this quarter,although these extensions are not yet described in Karel the Robot Learns Java. Thesenew extensions are:1. Better support for animation. The old version of Karel made it difficult to writeanimated programs because there was no good way to control the speed of thedisplay. The new version of the SuperKarel class includes a new built-in commandpause(milliseconds);that suspends Karel’s operation for the specified number of milliseconds. The usualapproach to using this statement is to have Karel perform some operation and thenpause for a short time (typically on the order of 20 milliseconds or so) to give thedisplay time to catch up. We will use this same approach when we start writinganimated programs in Java. For more details, you can look at the section on “Simplegraphical animation” on page 122 of the Java book. If you use pause, you will wantto run Karel at the maximum speed.2. A larger range of colors. The new SuperKarel class allows you to paint squares in amuch more expansive range of colors. In the new version, the paintCorner methodhas been extended so that you can call it as– 2 –paintCorner(red, blue, green);where red, blue, and green are numbers between 0.0 and 1.0 indicating the intensityof the corresponding color. For example, callingpaintCorner(1.0, 0.0, 1.0);is identical to callingpaintCorner(MAGENTA);Using more precise values for red, blue, and green allow you to generate millions ofcolors. For example, you can create a nice brown color using the commandpaintCorner(0.35, 0.20, 0.05);The same extension applies to the cornerColorIs extension.Official rules:1. Only students registered in CS 106A are eligible to submit contest entries.2. Only one entry per student will be accepted.3. All entries must be submitted electronically through the submission system in Eclipseand must be received by 5:00P.M. on Wednesday, January 20. Late entries will not beaccepted.4. Each submission must consist of a Karel program and one or more worlds forexecution. In addition, you may submit a short text explanation, not to exceed 250words, describing what Karel is doing.5. Karel programs must limit themselves to the language features described in Karel theRobot Learns Java for the Karel and SuperKarel classes, along with the two newextensions described earlier in this handout. You may not use other features of Java,even though the Eclipse-based version of Karel accepts them. In particular, you maynot declare variables or use the value of the for loop index.6. Contest entries should be sensitive to Stanford’s individual and cultural diversity.Programs or narratives that have the effect of perpetuating negative stereotypes willnot be eligible for prizes.7. Contest entries will be evaluated initially by Eric Roberts and Chris Piech. The bestentries will then be evaluated by representatives of the entire course staff, which willchoose the winners and runners-up in each


View Full Document

Stanford CS 106A - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?