;; 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 (0,edge)... if ( pxcor = 0 and pycor >= 0 and pycor <= edge ) [set pcolor red] ;; ... 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 = (0 - halfedge) and pycor >= (0 - 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 >= (0 - halfedge) and pycor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws right edge in blue ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)... if ( pycor = (0 - halfedge) and pxcor >= (0 - 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 >= (0 - halfedge) and pxcor <= (0 + halfedge) ) [set pcolor blue] ;; ... draws upper edge in blue ] end ;; This model was created as part of the project: ;; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS. ;; The project gratefully acknowledges the support of the National Science Foundation ;; (REPP Program) -- grant numbers RED #9552950 and REC #9632612. ;; Copyright 1999 by Uri Wilensky. All rights reserved. ;; Converted to NetLogo from StarLogoT, 2001 ;; Permission to use, copy, or modify this software and its documentation ;; is hereby granted, provided that this copyright notice and the original authors' ;; names appear on all copies and supporting documentation. For any other ;; uses of this software, in original or modified form, including but not ;; limited to distribution in whole or in part, specific prior permission ;; must be obtained from Uri Wilensky. These programs shall not be used, ;; rewritten, or adapted as the basis of a commercial software or hardware ;; product without first obtaining appropriate licenses from Uri Wilensky. ;; We make no representations about the suitability of this software for any purpose. ;; It is provided "as is" without express or implied warranty. @#$#@#$#@ CC-WINDOW 11 168 308 343 Command Center BUTTON 52 56 144 87 setup-corner setup-corner NIL 1 T OBSERVER BUTTON 55 105 144 136 setup-center setup-center NIL 1 T OBSERVER SLIDER 197 64 289 88 edge edge 1 25 8 1 1 GRAPHICS-WINDOW 321 10 666 355 12 12 13.8 1 @#$#@#$#@ WHAT IS IT? ----------- This example sets up a box that can be placed anywhere on the screen. It is one patch thick. @#$#@#$#@ arrow true 0 Polygon -7566196 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box true 0 Polygon -7566196 true true 45 255 255 255 255 45 45 45 default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 spacecraft true 0 Polygon -7566196 true true 150 0 180 135 255 255 225 240 150 180 75 240 45 255 120 135 thin-arrow true 0 Polygon -7566196 true true 150 0 0 150 120 150 120 293 180 293 180 150 300 150 turtle true 0 Polygon -7566196 true true 138 75 162 75 165 105 225 105 225 142 195 135 195 187 225 195 225 225 195 217 195 202 105 202 105 217 75 225 75 195 105 187 105 135 75 142 75 105 135 105 person false 0 Circle -7566196 true true 155 20 63 Rectangle -7566196 true true 158 79 217 164 Polygon -7566196 true true 158 81 110 129 131 143 158 109 165 110 Polygon -7566196 true true 216 83 267 123 248 143 215 107 Polygon -7566196 true true 167 163 145 234 183 234 183 163 Polygon -7566196 true true 195 163 195 233 227 233 206 159 truck-down false 0 Polygon -7566196 true true 225 30 225 270 120 270 105 210 60 180 45 30 105 60 105 30 Polygon -8716033 true false 195 75 195 120 240 120 240 75 Polygon -8716033 true false 195 225 195 180 240 180 240 225 truck-right false 0 Polygon -7566196 true true 180 135 75 135 75 210 225 210 225 165 195 165 Polygon -8716033 true false 210 210 195 225 180 210 Polygon -8716033 true false 120 210 105 225 90 210 truck-left false 0 Polygon -7566196 true true 120 135 225 135 225 210 75 210 75 165 105 165 Polygon -8716033 true false 90 210 105 225 120 210 Polygon -8716033 true false 180 210 195 225 210 210 circle true 0 Circle -7566196 true true 35 35 230 @#$#@#$#@ NetLogo 1.0 Beta 5 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@