This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: CheckerboardKarel.java | |
* ---------------------------- | |
* When you finish writing it, the CheckerboardKarel class should draw | |
* a checkerboard using beepers, as described in Assignment 1. You | |
* should make sure that your program works for all of the sample | |
* worlds supplied in the starter folder. | |
*/ | |
import stanford.karel.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: CollectNewspaperKarel.java | |
* -------------------------------- | |
* At present, the CollectNewspaperKarel subclass does nothing. | |
* Your job in the assignment is to add the necessary code to | |
* instruct Karel to walk to the door of its house, pick up the | |
* newspaper (represented by a beeper, of course), and then return | |
* to its initial position in the upper left corner of the house. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Karel is cleaning up the voting ballot. | |
* The vote only counts if the middle rectangle is punched, | |
* which means there are no beepers present. | |
*/ | |
import stanford.karel.SuperKarel; | |
public class defendDemocracyKarel extends SuperKarel { | |
public void run() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: PythagoreanTheorem.java | |
* Name: | |
* Section Leader: | |
* ----------------------------- | |
* This file is the starter file for the PythagoreanTheorem problem. | |
*/ | |
import acm.program.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: ProgramHierarchy.java | |
* Name: | |
* Section Leader: | |
* --------------------------- | |
* This file is the starter file for the ProgramHierarchy problem. | |
*/ | |
import acm.graphics.*; | |
import acm.program.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: FindRange.java | |
* Name: | |
* Section Leader: | |
* -------------------- | |
* This file is the starter file for the FindRange problem. | |
*/ | |
import acm.program.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: Hailstone.java | |
* Name: | |
* Section Leader: | |
* -------------------- | |
* This file is the starter file for the Hailstone problem. | |
*/ | |
import acm.program.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is the solution to the Section Handout #2 from the | |
* Stanford CS106A online class | |
*/ | |
import acm.program.*; | |
public class FibonacciSequence extends ConsoleProgram { | |
private static final int MAX_TERM_VALUE = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import acm.graphics.*; | |
import acm.program.*; | |
import java.awt.*; | |
public class DrawFace extends GraphicsProgram { | |
private static final int head_width = 100; | |
private static final int head_height = 200; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//adding an individual brick object | |
private GRect brick; | |
//drawing all the bricks necessary for the game | |
private void drawBricks(double cx, double cy) { | |
/*need to have several columns in each row | |
* so there need to be two for loops, | |
* one for loop for the rows and one for loop for the columns. | |
*/ |
OlderNewer