GridWorld
Encyclopedia
GridWorld is a computer program case study written in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 for use with the AP
Advanced Placement Program
The Advanced Placement program is a curriculum in the United States and Canada sponsored by the College Board which offers standardized courses to high school students that are generally recognized to be equivalent to undergraduate courses in college...

 Computer Science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

 program. It serves as an example of object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 (OOP) embedded in a more complicated design project than most students have worked with before. GridWorld is the successor to the Marine Biology Simulation Case Study, which was used from 2000–2007.

The GridWorld framework was designed and implemented by Cay Horstmann, based on the Marine Biology Simulation Case Study. The narrative was produced by Chris Nevison and Barbara Cloud Wells, Colgate University
Colgate University
Colgate University is a private liberal arts college in Hamilton, New York, USA. The school was founded in 1819 as a Baptist seminary and later became non-denominational. It is named for the Colgate family who greatly contributed to the university's endowment in the 19th century.Colgate has 52...

.

Actors

The GridWorld Case Study employs an Actor class to construct objects in the grid. The Actor class manages the object's color, direction, location, what the object does in the simulation, and how the object interacts with other objects.

Actors are broken down into the classes "Flower", "Rock", "Bug", and "Critter", which inherit the Actor class and often override certain methods (most notably the Act method). Flowers can't move, and when forced to Act, they become darker. Flowers are dropped by Bugs and eaten by Critters. Rocks are also immobile and aren't dropped or eaten. Bugs move directly ahead of themselves, unless blocked by a rock or another bug, in which case the Bug will make a 45 degree turn and try again. They drop flowers in every space they occupy, eat flowers that are directly on their space of grid, and are consumed by Critters. Critters move in a random direction to a space that isn't occupied by a Rock or other Critter and consume Flowers and Bugs.

Extensions

The Case Study also includes several extensions of the above classes. "BoxBug" extends "Bug" and moves in a box shape if its route is not blocked. "ChameleonCritter" extends "Critter" and does not eat other Actors, instead changing its color to match the color one of its neighbors. "Crab Critter" moves left or right and only eats Actors in front of it, but otherwise extends the "Critter" class.

Students often create their own extensions of the Actor class. Some common examples of student created extensions are Warden organisms
Four Lords of the Diamond
The Four Lords of the Diamond is a series of four science fiction novels by author Jack L. Chalker. Each volume of the series primarily follows a duplicate of a government agent as he lands on his prison planet and begins to both investigate the menace to the civilized worlds and find his position...

 and SimCity-like structures, in which objects of certain types create objects of other types based on their neighbors (much like the game of Life
Conway's Game of Life
The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970....

). Students have even created a version of the games Pac-Man
Pac-Man
is an arcade game developed by Namco and licensed for distribution in the United States by Midway, first released in Japan on May 22, 1980. Immensely popular from its original release to the present day, Pac-Man is considered one of the classics of the medium, virtually synonymous with video games,...

, Fire Emblem
Fire Emblem
is a fantasy tactical role-playing video game franchise developed by Intelligent Systems , the maker of Advance Wars , and published by Nintendo...

, and Tetris
Tetris
Tetris is a puzzle video game originally designed and programmed by Alexey Pajitnov in the Soviet Union. It was released on June 6, 1984, while he was working for the Dorodnicyn Computing Centre of the Academy of Science of the USSR in Moscow, Russian Soviet Federative Socialist Republic...

.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK