בתהליך למודל
No preview image
Model was written in NetLogo 4.1.2
•
Viewed 93 times
•
Downloaded 14 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 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] breed [mafseks-off mafsek-off] breed [battery batteries] to setup [ clear all ] end to set-up-mafsek-on-ciruit-Serial set-default-shape mafseks-on "mafsek-on" create-mafseks-on 1 [ setxy 20 11 set size 12 set heading 180 ] end to set-up-mafsek-off-ciruit-Serial set-default-shape mafseks-off "mafsek-off" create-mafseks-off 1 [ setxy 20 10 set size 12 set heading 90 ] end to set-up-light-on-ciruit-Serial set-default-shape lights-on "light-on" create-lights-on 1 [ setxy 25 20 set size 3 set heading 90 ] end to set-up-electron-ciruit-Serial set-default-shape circles "circle" create-circles 2 [ setxy 10 10 set size 0.5 set heading 90 ] end to set-up-battery-ciruit-Serial set-default-shape battery "battery" create-battery 1 [ setxy 30 9 set size 12 set heading 360 ] end to set-up-light-on-Parallel-circuit 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 ] end to set-up-mafsek-on-Parallel-circuit set-default-shape mafseks-on "mafsek-on" create-mafseks-on 1 [ setxy 58 11 set color white set size 8 set heading 180 ] end to set-up-mafsek-off-Parallel-circuit set-default-shape mafseks-off "mafsek-off" create-mafseks-on 1 [ setxy 58 11 set color white set size 8 set heading 180 ] end to set-up-electron-Parallel-circuit set-default-shape circles "circle" create-circles 2 [ setxy 50 10 set size 0.5 set heading 90 ] end to set-up-battery-Parallel-circuit set-default-shape battery "battery" create-battery 1 [ setxy 68 9 set size 12 set heading 360 ] 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 ask patches[ ;; if patches are between (10,10) to (10,20)... if (pxcor = (10) and pycor >= (10) and pycor <= ( 20 ) ) [set pcolor red] ;; ... draws left edge in red ;; if patches are between (35,10) to (35,20)... if ( pxcor = (35) and pycor >= (10) and pycor <= (20) ) [set pcolor red] ;; ... draws right edge in red ;; if patches are between (10,10) to (35,10)... if ( pycor = (10) and pxcor >= (10) and pxcor <= (35) ) [set pcolor red] ;; ... draws bottom edge in red ;; if patches are between (10,20) to (35,20)... if ( pycor = (20) and pxcor >= (10) and pxcor <= (35) ) [set pcolor red] ;; ... draws upper edge in red ] set-up-light-on-ciruit-Serial set-up-mafsek-on-ciruit-Serial set-up-electron-ciruit-Serial set-up-battery-ciruit-Serial end to go-Serial-circuit ask circles [ ifelse pxcor >= 10 and pxcor <= 34 [ fd 0.5] [ set heading 0 ] ] ask circles [ ifelse pycor >= 10 and pycor <= 19.5 [ fd 0.5] [ set heading 270 ] ] ask circles [ ifelse pxcor <= 36 and pxcor >= 11 [ fd 0.5] [ set heading 180] stop ] ; ask circles ; ; [ ifelse ; pycor <= 11 and pycor >= 10 [ fd 0.5] ; [ set heading 90] ; ] ; repeat 2 [ fd 8 rt 90 ] end to setup-ciruit-Parallel ask patches[ ;; if patches are between (50,10) to (50,20)... if (pxcor = (50) and pycor >= (10) and pycor <= ( 20 ) ) [set pcolor blue] ;; ... draws left edge in blue ;; if patches are between (75,10) to (75,20)... if ( pxcor = (75) and pycor >= (10) and pycor <= (20) ) [set pcolor blue] ;; ... draws right edge in blue ;; if patches are between (50,10) to (75,10)... if ( pycor = (10) and pxcor >= (50) and pxcor <= (75) ) [set pcolor blue] ;; ... draws bottom edge in blue ;; if patches are between (50,20) to (75,20)... if ( pycor = (20) and pxcor >= (50) and pxcor <= (75) ) [set pcolor pink] ;; ... draws upper edge in pink ;; if patches are between (50,15) to (75,15)... if ( pycor = (15) and pxcor >= (50) and pxcor <= (75) ) [set pcolor pink] ;; ... draws middle edge in pink ] set-up-light-on-Parallel-circuit set-up-mafsek-on-Parallel-circuit set-up-battery-Parallel-circuit set-up-electron-Parallel-circuit end to go-Parallel-circuit ask circles [ ifelse pxcor >= 50 and pxcor <= 75 [ fd 1] [ set heading 0 ] ] ask circles [ ifelse pycor >= 10 and pycor <= 30 [ fd 1] [ set heading 0 ] ] ; ask circles ; [ ifelse ; pxcor <= 34 and pxcor >= 10 [ bk 1] ; [ set heading 360] ; ] end
There is only one version of this model, created over 13 years ago by amal zaher.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
amal zaher
שאלות לשרונה
שלום שרונה רב הזמן עבדנו על הזזת האלקטרון ע"י שינוי צבע הפאטשים, אבל בסוף חזרנו לשיטה שלנו והצלחנו לסובב את האלקטרון השאלה שלנו האם יש פקודה שתפסיק הזזת הכדור? למה כשעושים הרצה למעגל אחד הכדור זז בשני המעגלים? תודה נתראה מחר בעזרת השם
Posted over 13 years ago
amal zaher
שאלות לשרונה
שלום שרונה רב הזמן עבדנו על הזזת האלקטרון ע"י שינוי צבע הפאטשים, אבל בסוף חזרנו לשיטה שלנו והצלחנו לסובב את האלקטרון השאלה שלנו האם יש פקודה שתפסיק הזזת הכדור? למה כשעושים הרצה למעגל אחד הכדור זז בשני המעגלים? תודה נתראה מחר בעזרת השם
Posted over 13 years ago