<body><!--'"</title></head>--> <script type="text/javascript"> //OwnerIQ var __oiq_pct = 50; if( __oiq_pct>=100 || Math.floor(Math.random()*100/(100-__oiq_pct)) > 0 ) { var _oiqq = _oiqq || []; _oiqq.push(['oiq_addPageBrand','Lycos']); _oiqq.push(['oiq_addPageCat','Internet > Websites']); _oiqq.push(['oiq_addPageLifecycle','Intend']); _oiqq.push(['oiq_doTag']); (function() { var oiq = document.createElement('script'); oiq.type = 'text/javascript'; oiq.async = true; oiq.src = document.location.protocol + '//px.owneriq.net/stas/s/lycosn.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(oiq, s); })(); } //Google Analytics var _gaq = _gaq || []; _gaq.push(['_setAccount','UA-21402695-19']); _gaq.push(['_setDomainName','tripod.com']); _gaq.push(['_setCustomVar',1,'member_name','aqualabs',3]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); //Lycos Init function getReferrer() { var all= this.document.cookie; if (all== '') return false; var cookie_name = 'REFERRER='; var start = all.lastIndexOf(cookie_name); if (start == -1) return false; start += cookie_name.length; var end = all.indexOf(';', start); if (end == -1) end = all.length; return all.substring(start, end); } function getQuery() { var rfr = getReferrer(); if (rfr == '') return false; var q = extractQuery(rfr, 'yahoo.com', 'p='); if (q) return q; q = extractQuery(rfr, '', 'q='); return q ? q : ""; } function extractQuery(full, site, q_param) { var start = full.lastIndexOf(site); if (start == -1) return false; start = full.lastIndexOf(q_param); if (start == -1) return false; start += q_param.length; var end = full.indexOf('&', start); if (end == -1) end = full.length; return unescape(full.substring(start, end)).split(" ").join("+"); } function generateHref(atag, template){ atag.href=template.replace('_MYURL_', window.location.href.replace('http://', '')).replace('_MYTITLE_','Check%20out%20this%20Tripod%20Member%20site!'); } var lycos_ad = Array(); var lycos_onload_timer; var cm_role = "live"; var cm_host = "tripod.lycos.com"; var cm_taxid = "/memberembedded"; var tripod_member_name = "aqualabs"; var tripod_member_page = "aqualabs/apcompsci.html"; var tripod_ratings_hash = "1511272858:3a2c544e6cb3bd469a3d9fc2fe61a129"; var lycos_ad_category = {"find_what":"ask jeeves.com"}; var lycos_ad_remote_addr = ""; var lycos_ad_www_server = "www.tripod.lycos.com"; var lycos_ad_track_small = "http://members.tripod.com/adm/img/common/ot_smallframe.gif?rand=887961"; var lycos_ad_track_served = "http://members.tripod.com/adm/img/common/ot_adserved.gif?rand=887961"; var lycos_search_query = getQuery(); </script> <script type="text/javascript" src="http://scripts.lycos.com/catman/init.js"></script> <script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); </script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/95963596/TRI_300X250_dfp', [300, 250], 'div-gpt-ad-1450204159126-0').addService(googletag.pubads()); googletag.defineSlot('/95963596/TRI_above_728x90_dfp', [728, 90], 'div-gpt-ad-1450204159126-1').addService(googletag.pubads()); googletag.defineSlot('/95963596/TRI_below_728x90_dfp', [728, 90], 'div-gpt-ad-1450204159126-2').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> <script type="text/javascript"> (function(isV) { if( !isV ) { return; } var adMgr = new AdManager(); var lycos_prod_set = adMgr.chooseProductSet(); var slots = ["leaderboard", "leaderboard2", "toolbar_image", "toolbar_text", "smallbox", "top_promo", "footer2", "slider"]; var adCat = this.lycos_ad_category; adMgr.setForcedParam('page', (adCat && adCat.dmoz) ? adCat.dmoz : 'member'); if (this.lycos_search_query) { adMgr.setForcedParam("keyword", this.lycos_search_query); } else if(adCat && adCat.find_what) { adMgr.setForcedParam('keyword', adCat.find_what); } for (var s in slots) { var slot = slots[s]; if (adMgr.isSlotAvailable(slot)) { this.lycos_ad[slot] = adMgr.getSlot(slot); } } adMgr.renderHeader(); adMgr.renderFooter(); }((function() { var w = 0, h = 0, minimumThreshold = 300; if (top == self) { return true; } if (typeof(window.innerWidth) == 'number' ) { w = window.innerWidth; h = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { w = document.body.clientWidth; h = document.body.clientHeight; } return ((w > minimumThreshold) && (h > minimumThreshold)); }()))); window.onload = function() { var f = document.getElementById("FooterAd"); var b = document.getElementsByTagName("body")[0]; b.appendChild(f); f.style.display = "block"; document.getElementById('lycosFooterAdiFrame').src = '/adm/ad/footerAd.iframe.html'; // DOM Inj Ad (function(isTrellix) { var e = document.createElement('iframe'); e.style.border = '0'; e.style.margin = 0; e.style.display = 'block'; e.style.cssFloat = 'right'; e.style.height = '254px'; e.style.overflow = 'hidden'; e.style.padding = 0; e.style.width = '300px'; var isBlokedByDomain = function( href ) { var blockedDomains = [ "ananyaporn13000.tripod.com", "xxxpornxxx.tripod.com" ]; var flag = false; for( var i=0; i<blockedDomains.length; i++ ) { if( href.search( blockedDomains[ i ] ) >= 0 ) { flag = true; } } return flag; } var getMetaContent = function( metaName ) { var metas = document.getElementsByTagName('meta'); for (i=0; i<metas.length; i++) { if( metas[i].getAttribute("name") == metaName ) { return metas[i].getAttribute("content"); } } return false; } var getCommentNodes = function(regexPattern) { var nodes = {}; var nodesA = []; var preferredNodesList = ['a', 'c', 'b']; (function getNodesThatHaveComments(n, pattern) { if (n.hasChildNodes()) { if (n.tagName === 'IFRAME') { return false; } for (var i = 0; i < n.childNodes.length; i++) { if ((n.childNodes[i].nodeType === 8) && (pattern.test(n.childNodes[i].nodeValue))) { var areaName = pattern.exec(n.childNodes[i].nodeValue)[1]; nodes[areaName] = n; } else if (n.childNodes[i].nodeType === 1) { getNodesThatHaveComments(n.childNodes[i], pattern); } } } }(document.body, regexPattern)); for (var i in preferredNodesList) { if (nodes[preferredNodesList[i]]) { if( isTrellix && nodes[preferredNodesList[i]].parentNode.parentNode.parentNode.parentNode ) { nodesA.push(nodes[preferredNodesList[i]].parentNode.parentNode.parentNode.parentNode); } else { nodesA.push( nodes[preferredNodesList[i]] ); } } } return nodesA; } var properNode = null; var areaNodes = getCommentNodes( new RegExp( '^area Type="area_(\\w+)"' ) ); for (var i = 0; i < areaNodes.length; i++) { var a = parseInt(getComputedStyle(areaNodes[i]).width); if ((a >= 300) && (a <= 400)) { properNode = areaNodes[i]; break; } } var propertyName = getMetaContent("property") || false; if( isTrellix && (properNode) ) { e.src = '/adm/ad/injectAd.iframe.html'; properNode.insertBefore(e, properNode.firstChild); } else if( isTrellix && !( properNode ) ) // Slap the ad eventhought there is no alocated slot { e.src = '/adm/ad/injectAd.iframe.html'; e.style.cssFloat = 'none'; var cdiv = document.createElement('div'); cdiv.style = "width:300px;margin:10px auto;"; cdiv.appendChild( e ); b.insertBefore(cdiv, b.lastChild); } else if( !isBlokedByDomain( location.href ) ) { var injF = document.createElement('iframe'); injF.style.border = '0'; injF.style.margin = 0; injF.style.display = 'block'; injF.style.cssFloat = 'none'; injF.style.height = '254px'; injF.style.overflow = 'hidden'; injF.style.padding = 0; injF.style.width = '300px'; injF.src = '/adm/ad/injectAd.iframe.html'; if( b && ( !isTrellix || ( typeof isTrellix == "undefined" ) ) ) // All other tripod props { var cdiv = document.createElement('div'); cdiv.style = "width:300px;margin:10px auto;"; cdiv.appendChild( injF ); b.insertBefore(cdiv, b.lastChild); } } }( document.isTrellix )); } </script> <div id="tb_container" style="background:#DFDCCF; border-bottom:1px solid #393939; position:relative; z-index:999999999!important"> <!--form name="search" onSubmit="return searchit()" id='header_search' > <input type="text" placeholder="Search" size=30 name="search2" value=""> <input type="button" value="Go!" onClick="searchit()"> </form> <style> form#header_search { width: 916px; margin: 0 auto 8px; position: relative; } form#header_search input { height: 40px; font-size: 14px; line-height: 40px; padding: 0 8px; box-sizing: border-box; background: #F4F2E9; border: 1px solid #BBB8B8; transition: background-color 300ms ease-out, color 300ms ease; } form#header_search input[type="text"] { width: 100%; } form#header_search input[type="text"]:focus { border-color: #A2D054; background-color: #fff; box-shadow: 0 0px 12px -4px #A2D054; } form#header_search input[type="button"] { position: absolute; top: 1px; right: 1px; opacity: 1; background: #DFDCCF; color: #463734; width: 125px; cursor: pointer; height: 38px; border: none; } form#header_search input[type="text"]:focus ~ input[type='button']:hover, form#header_search input[type='button']:hover { background-color: #A5CE56; color: #fff; } form#header_search input[type="text"]:focus ~ input[type='button'] { background-color: #52AEDF; color: #fff; } </style> <script> function searchit(){ // determine environment var search_env if (lycos_ad_www_server.indexOf(".pd.") > -1) { search_env = 'http://search51.pd.lycos.com/a/'; } else if (lycos_ad_www_server.indexOf(".qa.") > -1) { search_env = 'http://search51.qa.lycos.com/a/'; } else { search_env = 'http://search51.lycos.com/a/'; } var search_term = encodeURIComponent(document.search.search2.value) var search_url = search_env+search_term; window.open(search_url); return false } </script--> <style> .adCenterClass{margin:0 auto} </style> <div id="tb_ad" class="adCenterClass" style="display:block!important; overflow:hidden; width:916px;"> <a href="http://adtrack.ministerial5.com/clicknew/?a=637394" title="build your own website at Tripod.com" style="float:left; width:186px; border:0"> <img src="http://ly.lygo.com/ly/tpSite/images/freeAd2.jpg" alt="Make your own free website on Tripod.com" style="border:0; display:block" /> </a> <div id="ad_container" style="display:block!important; float:left; width:728px "> <script type="text/javascript">document.write(lycos_ad['leaderboard']);</script> </div> </div> </div> <script type="text/javascript">document.write(lycos_ad['slider']);</script> <!-- added 7/22 --> <div id="FooterAd" style="background:#DFDCCF; border-top:1px solid #393939; clear:both; display:none; width:100%!important; position:relative; z-index:999999!important; height:90px!important"> <div class="adCenterClass" style="display:block!important; overflow:hidden; width:916px;"> <a href="http://adtrack.ministerial5.com/clicknew/?a=637394" title="build your own website at Tripod.com" style="float:left; display:block; width:186px; border:0"> <img src="http://ly.lygo.com/ly/tpSite/images/freeAd2.jpg" alt="Make your own free website on Tripod.com" style="border:0; display:block; " /> </a> <div id="footerAd_container" style="display:block!important; float:left; width:728px"> <iframe id="lycosFooterAdiFrame" style="border:0; display:block; float:left; height:96px; overflow:hidden; padding:0; width:750px"></iframe> </div> </div> </div> <CENTER> <center><table border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td><A href="/adm/redirect/www"><IMG SRC="/adm/img/popup/tripodsm.gif" ALT="hosted by tripod" WIDTH="116" HEIGHT="26" BORDER="0" VSPACE="2"></A></td> </tr><tr> <td align="center" valign="top" width="468"><IFRAME SRC="http://ln.doubleclick.net/adi/tr.ln/memberembedded;h=misc;sz=468x60;ord=77725052816919?" width=468 height=60 frameborder=0 border=0 marginheight=0 marginwidth=0 vspace=0 scrolling=no></IFRAME></td> </tr> </table><table border="0" cellpadding="0" cellspacing="3" align="center" width="468"> <tr> <td><font size="1" face="verdana, arial, helvetica, sans serif"><a href="http://r.hotbot.com/r/tp_columb/http://ad.doubleclick.net/clk;5282965;3870290;r?http://click.atdmt.com/COL/go/lycsnchm00100771col/direct/01/">Get Five DVDs for $.49 each. Join now.</a></font></td> <td align="right"><font size="1" face="verdana, arial, helvetica, sans serif"><a href="/bin/email_when_updated/display_form">Tell me when this page is updated</a></font></td> </tr> </table></center> <!--insite and popunder--> <script language="javascript" type="text/javascript"> function showUnder(scale) { var expdate = new Date (); var surveyCookieName = "TRIPODPOPUNDER"; var percentOfferedSurvey = 100; var surveyLocation = "/adm/popunder/tripod_popunder.html?"+"member_name=aqualabs&path=theoryofoperation.html&client_ip="; var popupNewWindow = true; expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); var stored_value = GetCookie(surveyCookieName); if (stored_value == null){ SetCookie(surveyCookieName, "under", expdate, "/", ".tripod.com"); trUnder = window.open(surveyLocation,'under','height=300,width=720,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); trUnder.blur(); } } function showInsite(){ var expdate = new Date (); var surveyCookieName = "TRIPODINSITE"; var percentOfferedSurvey = 100; var showSurvey = "(none)"; var surveyLocation = "/adm/redirect/cgi/adm/popunder/insite.html?"+"member_name=aqualabs&path=theoryofoperation.html&client_ip="+"&member_url="+document.location; var popupNewWindow = true; expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); var stored_value = GetCookie(surveyCookieName); if (stored_value == null && showSurvey != "(none)"){ SetCookie(surveyCookieName, "insite", expdate, "/", ".tripod.com"); trInsite = window.open(surveyLocation,'insite','height=300,width=450,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no'); trInsite.blur(); } } function SetCookie (name,value,expires,path,domain,secure){ document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookieVal (offset){ var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name){ var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; if( (document.cookie == null) || (document.cookie.length == null)){ return null; } var i = 0; while (i < clen){ var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } showUnder(); showInsite(); </script></CENTER><center> <SCRIPT language="JavaScript"> <!-- // Cache-busting LUBID bug. var ran = Math.round(Math.random() * 899999) + 100000; var lubid_string = "<img src=\"http://lubid.lycos.com/one.asp?site=members.tripod.com&ord=" + ran + "\" height=\"1\" width=\"1\">"; document.write(lubid_string); //--> </SCRIPT> </body>
Summary of Marine Biology Case Study Classes


one constructor, no private variables 

The display class displays a function for display. It has only one function called "show." The show function gets a list of all the fish by calling the Environment function env.AllFish(). It determines the number of rows and columns needed in the display through the corresponding statements int rows = env.NumRows(); and int cols = env.NumCols(); The function show finds the position of the first fish to be displayed by determining if the vector row and column for a certain position is defined. If it is, it displays the fish using the ShowMe function and uses setw(WIDTH) to place it in the correct location. If no fish is found in the position, it instead displays a blank ““ ””.


one constructor, 2 private variables (myFishCreated, myFishCount) 

This class makes an environment available for the fish to swim in and it also keeps track of the positions of the fishes with AllFish() const; when the fishes need to move, it passes on a fishList to another function and then use Update() to relocate the fish to a new position. It can also add fish at empty positions. The private variables, myFishCreated and myFishCount are used for the functions in the class to work with the fish. In the constructor function ““Environment,”” the myWorld matrix is initialized to a size of (0,0) as are myFishCreated and myFishCount. The function resizes the myWorld matrix to determine the size of the environment based on user input of the number of rows and columns. If the user enters information that does not determine the size of it, it will display an error message. The NumRows() and NumCols() functions of this class respectively return the number of rows and columns in the environment matrix. The AllFish() function creates an apvector of type Fish that has myFishCount # of fish and stores each entry of the myWorld matrix in a position. The function returns this apvector. The next function in the class called IsEmpty, returns true for each position grid that does not have a fish. Otherwise it returns false. 


2 constructors, 3 private variables: int myId, Position myPos, bool amIDefined 

This program creates fish for the environment to work with. It also assigns each fish an unique id number. The Fish class also uses many private variables like amIDefined, and myId to make sure each fish is defined and identified properly. The class can also move fishes on a individual basis by moving them in the environ class. The private variable, myPos, defines each fish's position and can be accessed for display. The ID function returns the ID of the fish if it meets the precondition that the fish is not undefined. The location function returns the position of the fish via the value of myPos. The fish class also allows the fish to be made into a stringized form of the fish in an apstring by called to the ToString function. The move function in the fish class moves the fish if it is possible. An object of type Neighborhood is given the value of the number of empty spaces around it by calling to the EmptyNeighbors function in the nbrhood class. A random number is chosen in order to pick from the available empty spaces. The environment is then updated. To be able to see your fish on the screen, the ShowMe function must be used. This function returns a capital letter corresponding to the integer ID of the fish, or a *. The fish class also allows for fish to be added one by one to manually north, south, east, or west using the EmptyNeighbors function. To check if there is an empty space in the surrounding areas of the fish and add it to the space, the AddIfEmpty function is called. 


one constructor, 2 private variable: int myCount, apvector myList 

This class keeps track of the environment neighborhood, the area around each fish. Its critical use is to determine if each fish has room before he moves. It can also return a string version of all the positions in the neighborhood. Number of positions are also available for display. The private variable, myCount, is used to keep track of the positions in the class. The nbrhood class is used to return the status of the fish tank for example, the size function returns the size of the fish tank using the myCount variable because the myCount variable is the number of positions in the class. It is able to return the index-th position in the Neighborhood via the Select function because its parameters include an int variable with the index value inside it. After, it returns the value of the index-th position by checking its position in the apvector. By using an apvector variable, the apvector can be extracted one by one and added to the apstring to create one big string that represents the neighborhood. A position may be added if there is space for it in the neighborhood. Because the apvector represents the fish tank, the function gets apvector and if there is enough room for another space, then it is added. If added, the myCount is incremented. 


2 constructors, 2 private variables: int myRow, int myCol 

The 2 constructors in this class define a position and can also be defined when a position is specified. Its accessing function can return positions that are adjacent to the current position. The accessing function of Row() and Col() can be used to return current position (that's what myRow and myCol is used for). Position also can return the position north of the fish, south of the fish, east of the fish, and west of the fish. The North, South, East, and West function returns the position respectively north, south, east, and west. This is done by modifying the value of myRow and myCol. In the north function, myRow is decremented. In the south function, myRow is incremented. In the east function, myCol is incremented. In the west function, myRow is decremented. The position class is vital to the determining the position of a specific area in the fish tank, and the area north, south, east, and west of that specific spot. The position class can also be attached to an apstring. The position function can also be used to prevent two fishes from moving into the same space.


2 constructors, no private variables 

This class is used to generate random numbers for the other classes to randomly move the fishes in their positions. Only integers and double type numbers are available for return in the RandGen class. There are different types of obtaining a random number. A random number can be generated by different methods. Based on the parameters given by the user, a random number can be made with only integers, with decimals and integers, with numbers between 0 and 1, and numbers between zero and a specific number provided by the user. In the marine biology case, a random integer is called to represent the movement of the fish. This is because a fish moves randomly throughout the environment. RandInt returns a random integer. RandReal returns a random double.


One constructor, no private variables 

This class simulates the movement of the fish. In the Step function, the vector containing the fishList is declared and the environment is called. It moves the fishes once in the environment. The Run function then moves the fishes a number of times that is passed by value to the function, and depends on the number of steps the user wants to see. 


No constructors, no private variables 

This class contains 3 useful functions for use by other classes. The IntToString(int n) returns n to string form. It is used in the ToString() function of the Fish class to convert myId to a string.. This can be used for the id's of the fishes. There is also void Sort(apvector & list, int numElts). This is provided to sort the list top-down/left-right by position. There is also the void DebugPrint(int level, const apstring & msg). The integer parameter level specifies the amount of detail desired for debugging output. The level parameter can be set by modifying utils.cpp.