Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View NatashaTheRobot's full-sized avatar

Natasha Murashev NatashaTheRobot

View GitHub Profile
@NatashaTheRobot
NatashaTheRobot / CheckerboardKarel Solution
Created October 28, 2011 03:57
This is the solution to the CheckerboardKarel problem in the online Stanford CS 106A class
/*
* 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.*;
@NatashaTheRobot
NatashaTheRobot / CollectNewspaperKarel Solution
Created October 28, 2011 04:33
This is the solution to the CollectNewspaperKarel problem in the online Stanford CS 106A class
/*
* 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.
*/
@NatashaTheRobot
NatashaTheRobot / KarelDefendsDemocracy
Created October 31, 2011 01:27
This is the solution to the Karel Defends Democracy Stanford 106A Section Problem
/* 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() {
@NatashaTheRobot
NatashaTheRobot / PythagoreanTheoremSolution
Created November 1, 2011 01:18
This is the solution to the Pythagorean Theorem problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: PythagoreanTheorem.java
* Name:
* Section Leader:
* -----------------------------
* This file is the starter file for the PythagoreanTheorem problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / ProgrammingHierarchySolution
Created November 1, 2011 05:35
This is the solution to the Programming Hierarchy problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: ProgramHierarchy.java
* Name:
* Section Leader:
* ---------------------------
* This file is the starter file for the ProgramHierarchy problem.
*/
import acm.graphics.*;
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / FindRangeSolution
Created November 2, 2011 00:19
This is the solution to the Find Range problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: FindRange.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the FindRange problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / HailstoneSolution
Created November 2, 2011 01:46
This is the solution to the Hailstone problem from Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* File: Hailstone.java
* Name:
* Section Leader:
* --------------------
* This file is the starter file for the Hailstone problem.
*/
import acm.program.*;
@NatashaTheRobot
NatashaTheRobot / FibonacciSequenceSolution
Created November 2, 2011 20:18
This is the solution to the Fibonacci Sequence problem from Section Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
/*
* 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;
@NatashaTheRobot
NatashaTheRobot / RobotFaceSolution
Created November 3, 2011 00:00
This is the solution to the Robot Face problem from Section Assignment 2 of the Stanford CS106A Introduction to Programming Methodology Class
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;
@NatashaTheRobot
NatashaTheRobot / BreakoutBrickSetup
Created November 9, 2011 06:28
This is the solution to step 1 of the Stanford CS106A Breakout game assignment, setting up the bricks.
//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.
*/