jihan 3
No preview image
Model was written in NetLogo 4.1.2
•
Viewed 191 times
•
Downloaded 30 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This example sets up a box that can be placed anywhere in the world. It is one patch thick.
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;; declare a global variable, halfedge, to be used when the box center is at (0,0) globals [halfedge] ;; setup procedure for case where point (0,0) is lower left corner of Box ;;note slider that sets the size of the box. to setup-corner ; ca ;; clear everything ask patches[ ;; if patches are between (0,0) to (3,edge)... if ( pxcor = 0 and pycor >= 0 and pycor <= edge ) [set pcolor yellow] ;; ... draws left edge in red ;; if patches are between (edge,0) to (edge,edge)... if ( pxcor = edge and pycor >= 0 and pycor <= edge ) [set pcolor red] ;; ... draws right edge in red ;; if patches are between (0,0) to (edge,0)... if ( pycor = 0 and pxcor >= 0 and pxcor <= edge ) [set pcolor red] ;; ... draws bottom edge in red ;; if patches are between (0,edge) to (edge,edge)... if ( pycor = edge and pxcor >= 0 and pxcor <= edge ) [set pcolor red] ;; ... draws upper edge in red ] end ;; setup procedure for case where point (0,0) is in the center of Box to setup-center ;ca ;; clear everything ;; set halfedge as edge divided by two. in case edge is an odd number, ;; halfedge get the integer value of the division. set halfedge int (edge / 2) ask patches[ ;; if patches are between (-halfedge,-halfedge) to (-halfedge,halfedge)... if (pxcor = (- halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws left edge in blue ;; if patches are between (halfedge,-halfedge) to (halfedge,halfedge)... if ( pxcor = (0 + halfedge) and pycor >= (- halfedge) and pycor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws right edge in blue ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)... if ( pycor = (- halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws bottom edge in blue ;; if patches are between (-halfedge,halfedge) to (halfedge,halfedge)... if ( pycor = (0 + halfedge) and pxcor >= (- halfedge) and pxcor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws upper edge in blue ] end ; *** NetLogo 4.0.4 Code Example Copyright Notice *** ; ; (C) 2004 Uri Wilensky. This code may be freely copied, distributed, ; altered, or otherwise used by anyone for any legal purpose. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ; *** End of NetLogo 4.0.4 Code Example Copyright Notice ***
There is only one version of this model, created about 14 years ago by jihan barbara.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.