Top Topics in our Forum';
**Interactive parallelogram. Click and drag points to see properties, formula adjust

A+    A−    B  
Algebra
Games
Geometry
Interactive
Trigonometry
Forum




AddThis Social Bookmark Button

Grid World

import info.gridworld.grid.*;

Grid World Resources

Current Unit
Classes

import info.gridworld.actor.Bug;

/**
 * A BoxBug traces out a square "box" of a given size. 
* The implementation of this class is testable on the AP CS A and AB exams. */ public class BoxBug extends Bug { private int steps; private int sideLength; /** * Constructs a box bug that traces a square of a given side length * @param length the side length */ public BoxBug(int length) { steps = 0; sideLength = length; } /** * Moves to the next location of the square. */ public void act() { if (steps < sideLength && canMove()) { move(); steps++; } else { turn(); turn(); steps = 0; } } }

Top
AddThis Social Bookmark Button