4 Corners Game
Model was written in NetLogo 5.2.1
•
Viewed 363 times
•
Downloaded 25 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
turtles-own [score loose] patches-own [number] to setup ca ask patches with [pycor = 14 and pxcor = 14] ; Setting of the 4 corner and the central post [set pcolor green set number 2] ask patches with [pycor = -14 and pxcor = 14] [set pcolor yellow set number 1] ask patches with [pycor = 14 and pxcor = -14] [set pcolor red set number 3] ask patches with [pycor = -14 and pxcor = -14] [set pcolor white set number 4] ask patches with [pycor = 0 and pxcor = 0] [set pcolor orange set number 5] crt 5 ; Creation of 5 turtles and setting of characteristics ask turtle 0 [set color blue set shape "person" set size 3 set xcor 0 set ycor 0 set heading 0] ask turtle 1 [set color red set shape "person" set size 3 set xcor -14 set ycor 15 set heading 0] ask turtle 2 [set color green set shape "person" set size 3 set xcor 14 set ycor 15 set heading 0] ask turtle 3 [set color white set shape "person" set size 3 set xcor -14 set ycor -13 set heading 0] ask turtle 4 [set color yellow set shape "person" set size 3 set xcor 14 set ycor -13 set heading 0] end to foward ask turtles with [pcolor = orange] [set xcor 0 set ycor 0] ask turtles with [pcolor = red] [set xcor -14 set ycor 15] ask turtles with [pcolor = green] [set xcor 14 set ycor 15] ask turtles with [pcolor = yellow] [set xcor 14 set ycor -13] ask turtles with [pcolor = white] [set xcor -14 set ycor -13] end to Start ; This loop is the engine of the random model. ; Depending on the random number, ; the players will choose a specific corner. repeat numero_iteracciones [ let d_centro random 4 let d_esq_1 random 2 let duelo random 2 let patch1 one-of (patches with[number = 1]) let patch2 one-of (patches with[number = 2]) let patch3 one-of (patches with[number = 3]) let patch4 one-of (patches with[number = 4]) let patch5 one-of (patches with[number = 5]) if d_centro = 0 [ ask turtles with [xcor = 0 and ycor = 0] [face patch1 fd distance patch1] ifelse d_esq_1 = 0 [ ask turtles with [xcor = -14 and ycor = 15] [face patch2 fd distance patch2] ask turtles with [xcor = 14 and ycor = -13] [face patch4 fd distance patch4] ] [ask turtles with [xcor = -14 and ycor = 15] [face patch4 fd distance patch4] ask turtles with [xcor = 14 and ycor = -13] [face patch2 fd distance patch2] ] ifelse duelo = 1[ ask turtles with [xcor = 14 and ycor = 15] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = -14 and ycor = -13] [face patch3 fd distance patch3] ] [ask turtles with [xcor = -14 and ycor = -13] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = 14 and ycor = 15] [face patch3 fd distance patch3] ] ] if d_centro = 1 [ ask turtles with [xcor = 0 and ycor = 0] [face patch2 fd distance patch2] ifelse d_esq_1 = 0 [ ask turtles with [xcor = 14 and ycor = 15] [face patch3 fd distance patch3] ask turtles with [xcor = -14 and ycor = -13] [face patch1 fd distance patch1] ] [ask turtles with [xcor = 14 and ycor = 15] [face patch1 fd distance patch1] ask turtles with [xcor = -14 and ycor = -13] [face patch3 fd distance patch3] ] ifelse duelo = 1[ ask turtles with [xcor = 14 and ycor = -13] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = -14 and ycor = 15] [face patch4 fd distance patch4] ] [ask turtles with [xcor = -14 and ycor = 15] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = 14 and ycor = -13] [face patch4 fd distance patch4]] ] if d_centro = 2 [ ask turtles with [xcor = 0 and ycor = 0] [face patch3 fd distance patch3] ifelse d_esq_1 = 0 [ ask turtles with [xcor = -14 and ycor = 15] [face patch2 fd distance patch2] ask turtles with [xcor = 14 and ycor = -13] [face patch4 fd distance patch4] ] [ask turtles with [xcor = -14 and ycor = 15] [face patch4 fd distance patch4] ask turtles with [xcor = 14 and ycor = -13] [face patch2 fd distance patch2] ] ifelse duelo = 1[ ask turtles with [xcor = 14 and ycor = 15] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = -14 and ycor = -13] [face patch1 fd distance patch1] ] [ask turtles with [xcor = 14 and ycor = 15] [face patch1 fd distance patch1] ask turtles with [xcor = -14 and ycor = -13] [face patch5 fd distance patch5 set loose loose + 1] ] ] if d_centro = 3 [ ask turtles with [xcor = 0 and ycor = 0] [face patch4 fd distance patch4] ifelse d_esq_1 = 0 [ ask turtles with [xcor = -14 and ycor = -13] [face patch1 fd distance patch1] ask turtles with [xcor = 14 and ycor = 15] [face patch3 fd distance patch3] ] [ask turtles with [xcor = -14 and ycor = -13] [face patch3 fd distance patch3] ask turtles with [xcor = 14 and ycor = 15] [face patch1 fd distance patch1] ] ifelse duelo = 1[ ask turtles with [xcor = -14 and ycor = 15] [face patch5 fd distance patch5 set loose loose + 1] ask turtles with [xcor = 14 and ycor = -13] [face patch2 fd distance patch2] ] [ask turtles with [xcor = -14 and ycor = 15] [face patch2 fd distance patch2] ask turtles with [xcor = 14 and ycor = -13] [face patch5 fd distance patch5 set loose loose + 1] ] ] foward ] set-current-plot "Chart" ; Setting the plot clear-plot plot [loose] of turtle 0 plot [loose] of turtle 1 plot [loose] of turtle 2 plot [loose] of turtle 3 plot [loose] of turtle 4 end
There is only one version of this model, created over 8 years ago by Mikel Mujika.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
4 Corners Game.png | preview | Preview for '4 Corners Game' | over 8 years ago, by Mikel Mujika | Download |
This model does not have any ancestors.
This model does not have any descendants.