1997-98
NEW MEXICO
HIGH SCHOOL
SUPERCOMPUTING
CHALLENGE

Interim Report


Team Number:

099

School Name:

Santa Fe Prep

Area of Science:

New Developments in Software

Project Title:

A Case of Sharks and Minnows

Project Abstract:

http://mode.lanl.k12.nm.us/97.98/abstracts/099.html

Interim Report:

http://mode.lanl.k12.nm.us/97.98/interims/099.html

Final Report:

http://mode.lanl.k12.nm.us/97.98/finalreports/099/finalreport.html


Computer Ecosystems:

A Case of Sharks and Minnows

------------------

 

New Mexico High School

Supercomputing Challenge

INTERIM REPORT

January 13, 1998

 

 

Santa Fe Preparatory School

Team 099

 

Students:

Eliot Fisher

Spencer Fornaciari

Steve Merlan

Naomi Paine

 

Teacher:

James Taylor

 

Advisor:

Melanie Mitchell

 

 

 

- Table of Contents -

 

Abstract. . . . . . . . . . . . . . . . . . . . . .1

Overview. . . . . . . . . . . . . . . . . . . . .2

PC Programming. . . . . . . . . . . . . . . 3

--Sample PC code . . . . . . . . . . 3; 5

Code Index. . . . . . . . . . . . . . . . . . . 5

 

® ® ® ® ®

 

 

 

 

 

- Abstract -

 

A CASE OF SHARKS AND MINNOWS

 

For this project, we hope to help a simple community of computer-life to adapt and evolve. We will use Darwin’s theory of natural selection, coupled with the general theory of evolution in conjunction with crossovers and mutations to produce a generated ecosystem that evolves in a realistic way. We hope to produce a community that proves stable over time.

 

In terms of process, we hope to begin with a simple environment, perhaps fish and algae living on a cellular automaton lattice. By using C++ we hope to evolve the fish to eat the algae for survival. Once this has been mastered, we will move on to a more complex situation, for example, fish and algae with a predator involved. Both species would then have to evolve via reproduction of the fittest with random mutations and possibly sexual recombination. It is in the products of these couplings that we will see the effects of random mutation and genetic crossovers. Eventually we hope to have created an environment with as many as four or five species involved in a predator/prey food chain of sorts. Perhaps these animals will be of our own creation and perhaps they will be of terrestrial origin.

 

Once we have reached our ultimate goal - a stable community of several species - we will package our finished product into an interface of minimal complexity, using C++, that is capable of maintaining a large community of cyber-life.

 

 

 

- Overview -

 

Over the last few months we have made steady progress toward our goal: the production of a healthy and self-sustaining ecosystem. Using two platforms – PC’s and Macs – we are approaching the problem from several angles. On the whole, our project is moving at a speed that ensure careful study of our results, while also moving rapidly enough to ensure completion by the deadline.

 

On the PC side, we have been delving into arrays as a system of display for our ecosystem, and have begun to touch on classes in order to give our individual entities "personalities." In the latest incarnation of one of our experimental programs, an array is displayed that uses ones and zeroes – delineating fish, the ones, and empty space, the zeroes – that is representative of our ecosystem. Once our knowledge of classes is more comprehensive, we will find ways to allow the fish to move, and then begin adding other elements. These elements will include algae for the fish to feed on, and predators that will feed on the fish.

 

As we move through C++, we are also turning to other tools that will allow us to showcase our work. At the current time, we have begun to move through the simplicities of C++ Builder, and this will become a key part of our final project. In essence, the PC portion of our project is the realization of our work on a more conceptual level – using the Macintosh program "StarLogo."

 

On the conceptual level, this program may prove invaluable, allowing us to produce results in simple lines of code that would require comprehensive knowledge of C++ as well as hundreds of lines of computer code. While we realize that our work in this area cannot be directly applied to the Challenge, the insights are proving more and more valuable as we give the problem new complexities.

 

- C++ Programming -

As we have mentioned before, in the overview, arrays and classes are currently the avenue from which we are approaching the problem. Our "0-Array" program that was mentioned is probably one of the better examples of our approach to the problem of displaying the movements of several organisms at once.

 

The 0-Array

#include <iostream.h>

#include <stdlib.h>

#include <conio.h>

#include <math.h>

 

#define max(a,b) (((a) > (b)) ? (a) : (b))//An odd error in Tclite forced us to copy these 2

#define min(a,b) (((a) < (b)) ? (a) : (b))//statements into the file for it to work. You may

int main (void) { //not need them for this program to work.

Clrscr();

int x, y;

int array [10][10]; //declares array as a 10 by 10 grid

 

for (x=0;x<10;x++) {

for (y=0;y<10;y++) {

array[x][y] = random(4);

cout<<max(array[x][y]-2,0) << " ";//this line causes the array to have an "affinity" for 0’s

}

cout << "\n\n";}

cout << "\n\nHit enter to continue";

getch(); }

 

This program is the most representative of our progress, both because of its elegant simplicity and the basic problem solving that was executed in order to find a way to make the array display more zeroes than ones. Although the beginnings of a class are included at the end of another version of this program, our knowledge is not yet complete enough for the class to function as we would like it too.

 

We have also turned to C++ Builder as a source for the display of our final project, and are learning the basics of the program. Thus far we have mainly concentrated on learning arrays, that will eventually be coupled with classes to produce an ecosystem in the most basic sense.

 

Because of the amount of information that we will have to display on our array, we have also looked to "three-dimensional" arrays that will allow objects to exist over one another, rather than requiring objects to have their own cell. Please see the Code Appendix, Code 1.2 for the code to this particular program. Although we have considered displaying letters or symbols, rather than numbers, neither system could stand on its own. In order to interpret the results, we will need to find a system that displays both attributes in an easy to read configuration. Thus far, the best system that we have discussed is using bitmaps in lieu of letters, with numbers displayed in one of the corners. While this is not entirely feasible in C++, it may be easier to accomplish in C++ Builder.

 

- Code Index -

Code 1.1: The 0-Array

#include <iostream.h>

#include <stdlib.h>

#include <conio.h>

#include <math.h>

 

#define max(a,b) (((a) > (b)) ? (a) : (b))//An odd error in Tclite forced us to copy these 2

#define min(a,b) (((a) < (b)) ? (a) : (b))//statements into the file for it to work. You may

int main (void) { //not need them for this program to work.

clrscr();

int x, y;

int array [10][10]; //declares array as a 10 by 10 grid

 

for (x=0;x<10;x++) {

for (y=0;y<10;y++) {

array[x][y] = random(4);

cout<<max(array[x][y]-2,0) << " ";//this line causes the array to have an "affinity" for 0’s

}

cout << "\n\n";}

cout << "\n\nHit enter to continue";

getch(); }

 

Code 1.2: The 3D Array

#include <iostream.h>

#include <stdlib.h>

#include <math.h>

#include <conio.h>

 

#define max(a,b) (((a) > (b)) ? (a) : (b))// same error, different program

#define min(a,b) (((a) < (b)) ? (a) : (b))

 

void main () {

int i, x, y, a;

clrscr();

 

int array [10][10][10];// notice there are three coordinates this time

 

for (x = 0;x <10;x++){

for (y=0; y < 10;y++){

for (a = 0; a< 10;a++){

array [x][y][a] = random(9);// random numbers from 0 -8 are displayed in the grid’s cells

cout << array [x][y][a] << " ";

}

cout << "\n";

}}

cout <<"Hit enter to continue\n";

getch();}

 

Team Members:

Sponsoring Teacher(s):

Project Advisor(s):


New Mexico High School Supercomputing Challenge
http://mode.lanl.k12.nm.us