Electricity
No preview image
Model was written in NetLogo 4.1.2
•
Viewed 463 times
•
Downloaded 28 times
•
Run 1 time
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This code example is a demo of a basic random walk. At each step, the yellow turtle changes its heading randomly.
THINGS TO NOTICE
The turtle's pen is down, so it leaves a trail behind it in the drawing.
RELATED MODELS
Random Grid Walk Example - the same except that the random walk is constrained to lie on a grid
Comments and Questions
Click to Run Model
breed [circles circle] breed [lights-on light-on] breed [mafseks-on mafsek-on] to setup [ clear all ] end to set-up-mafsek-on set shape "light-on" end to set-up-mafsek-off set shape "mafsek-off" end to set-up-light-on set shape "light-on" end to set-up-battery set shape "battery" end to Closed-Circuit-Serial ca end to open-Circuit-Serial ca end to Burning-light ca end to insert-light ca end to Increasing-electrons ca end to setup-ciruit-Serial 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 = (10) and pycor >= (10) and pycor <= ( 20 ) ) [set pcolor red] ;; ... draws left edge in blue ;; if patches are between (halfedge,-halfedge) to (halfedge,halfedge)... if ( pxcor = (35) and pycor >= (10) and pycor <= (20) ) [set pcolor red] ;; ... draws right edge in blue ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)... if ( pycor = (10) and pxcor >= (10) and pxcor <= (35) ) [set pcolor red] ;; ... draws bottom edge in blue ;; if patches are between (-halfedge,halfedge) to (halfedge,halfedge)... if ( pycor = (20) and pxcor >= (10) and pxcor <= (35) ) [set pcolor red] ;; ... draws upper edge in blue ] set-default-shape circles "circle" create-circles 2 [ setxy 10 10 set size 0.5 set heading 90 ] set-default-shape lights-on "light-on" create-lights-on 1 [ setxy 25 20 set size 3 set heading 90 ] ; set-default-shape mafseks-on "mafsek-on" ; create-mafseks-on 1 [ ; setxy 20 10 ; set size 8 ; set heading 90 ; ] ; repeat 2 [ fd 8 rt 90 ] end to go ask turtles [ ifelse pxcor >= 10 and pxcor <= 34 [ fd 1] [ set heading 0 ] ] ask turtles [ ifelse pycor >= 10 and pycor <= 20 [ fd 1] [ set heading 180 ] ] ask turtles [ ifelse pxcor <= 36 and pxcor >= 10 [ bk 1] [ set heading 360] ] end to setup-ciruit-Parallel ;; 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 = (50) and pycor >= (10) and pycor <= ( 20 ) ) [set pcolor blue] ;; ... draws left edge in blue ;; if patches are between (halfedge,-halfedge) to (halfedge,halfedge)... if ( pxcor = (75) and pycor >= (10) and pycor <= (20) ) [set pcolor blue] ;; ... draws right edge in blue ;; if patches are between (-halfedge,-halfedge) to (halfedge,-halfedge)... if ( pycor = (10) and pxcor >= (50) and pxcor <= (75) ) [set pcolor blue] ;; ... draws bottom edge in blue ;; if patches are between (-halfedge,halfedge) to (halfedge,halfedge)... if ( pycor = (20) and pxcor >= (50) and pxcor <= (75) ) [set pcolor pink] ;; ... draws upper edge in blue if ( pycor = (15) and pxcor >= (50) and pxcor <= (75) ) [set pcolor pink] ] set-default-shape lights-on "light-on" create-lights-on 1 [ setxy 62 15 set size 3 set heading 90 ] set-default-shape lights-on "light-on" create-lights-on 1 [ setxy 62 20 set size 3 set heading 90 ] set-default-shape mafseks-on "mafsek-on" create-mafseks-on 1 [ setxy 62 10 set size 8 set heading 90 ] end
There is only one version of this model, created over 13 years ago by soheir othman.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
soheir othman
מודל החשמל מקבילי-טורי (Question)
שלום שרונה העלנו המודל של מקיבילי / טורי יש לנו כמה שאלותף כאשר מפעילים המודל א. הנקודה לא זזה בפקודת go אם עושים אותה Forever ב. הנורה ואלקטורןן זזים ביחד ג. כל פעם שמפעילים הנקודה מגיעה למקום אחר למשל PXCR = 34 או PXCO =35 וכדומה נשות החשמל נצרת
Posted over 13 years ago
soheir othman
מודל החשמל מקבילי-טורי (Question)
שלום שרונה העלנו המודל של מקיבילי / טורי יש לנו כמה שאלותף כאשר מפעילים המודל א. הנקודה לא זזה בפקודת go אם עושים אותה Forever ב. הנורה ואלקטורןן זזים ביחד ג. כל פעם שמפעילים הנקודה מגיעה למקום אחר למשל PXCR = 34 או PXCO =35 וכדומה נשות החשמל נצרת
Posted over 13 years ago
Sharona T Levy
שאלה זו נענתה בדואל (Question)
1
Posted over 13 years ago
thomas koini
Aggressorf-Defender model (Question)
Hello everybody, can somebody help me concerning creating a code for such a model? Thank you in advance. KR Thomas
Posted about 10 years ago