Sumbal Model

Sumbal Model preview image

1 collaborator

Default-person sumbal khan (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 117 times • Downloaded 6 times • Run 0 times
Download the 'Sumbal Model' modelDownload this modelEmbed this model

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

breed [ SumbalKhans SumbalKhan]
SumbalKhans-own [trapped?]

to setup
  clear-all
  set-environment
  setupname
  set-agents
  reset-ticks
end 

to go
  ask SumbalKhans with [trapped? = false]
    [
    move-random
    ]
   ask SumbalKhans with [trapped? = true]
  [
    ;move-in-letter
    rt random 30
    lt random 30
    fd 0.1
    ask SumbalKhans with [trapped? = true AND pcolor = white ]
    [
    back 0.1
    ]
  ]
  tick
end 

to set-agents
  create-SumbalKhans 27
  [
    set color green
    set shape "circle"
    set size 3
    set trapped? false
    setxy random-xcor random-ycor
  ]
end 

to set-environment
  resize-world 0 450 0 300 ; i set it to 400 as it is mentioned in assignment i can do it more thn 200
  set-patch-size 1 ; As you mention in assignment that set patch size 1
  ask patches [set pcolor white]
end 

to move-in-letter
  ask SumbalKhans [
   rt random 20
  ]
end 

to move-random
  ask SumbalKhans in-cone 20 5 [ifelse pcolor = red [
    forward 2
  ]
  [
        lt random 60
        rt random 60
        forward 1
      ask SumbalKhans with [pcolor = red]
      [ set trapped? true]
  ]
  ]
end 

to setupname
  ;S
  ask patch 70 272 [ set pcolor red ]
   ask patches with [pxcor >  30 and pxcor < 70 and pycor >  270 and pycor < 274]

      [
       set pcolor red
       ]
    ask patch 30 272 [ set pcolor red ]

  ask patch 50 242 [ set pcolor red ]
   ask patches with [pxcor >  30 and pxcor < 50 and pycor >  240 and pycor < 244]

      [
       set pcolor red
       ]
    ask patch 30 242 [ set pcolor red ]


    ask patch 70 242 [ set pcolor red ]
   ask patches with [pxcor >  50 and pxcor < 70 and pycor >  240 and pycor < 244]

      [
       set pcolor red
       ]
    ask patch 50 242 [ set pcolor red ]




  ask patch 70 212 [ set pcolor red ]
   ask patches with [pxcor >  30 and pxcor < 70 and pycor >  210 and pycor < 214]
      [
       set pcolor red
       ]
    ask patch 30 212 [ set pcolor red ]

    ask patch 28 272 [ set pcolor red ]
   ask patches with [pxcor >  26 and pxcor < 30 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 28 242 [ set pcolor red ]

   ask patch 72 212 [ set pcolor red ]
   ask patches with [pxcor >  70 and pxcor < 74 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 72 242 [ set pcolor red ]

   ; U
   ask patch 140 212 [ set pcolor red ]
   ask patches with [pxcor >  100 and pxcor < 140 and pycor >  210 and pycor < 214]
      [
       set pcolor red
       ]
    ask patch 100 212 [ set pcolor red ]

   ask patch 142 212 [ set pcolor red ]
   ask patches with [pxcor >  140 and pxcor < 144 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 142 242 [ set pcolor red ]

    ask patch 142 272 [ set pcolor red ]
   ask patches with [pxcor >  140 and pxcor < 144 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 142 242 [ set pcolor red ]


  ask patch 98 212 [ set pcolor red ]
   ask patches with [pxcor >  96 and pxcor < 100 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 98 242 [ set pcolor red ]

    ask patch 98 272 [ set pcolor red ]
   ask patches with [pxcor >  96 and pxcor < 100 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 98 242 [ set pcolor red ]

  ;M
    ; 200 230
   ask patch 212 212 [ set pcolor red ]
   ask patches with [pxcor >  210 and pxcor < 214 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 212 242 [ set pcolor red ]

    ask patch 212 272 [ set pcolor red ]
   ask patches with [pxcor >  210 and pxcor < 214 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 212 242 [ set pcolor red ]


  let x 171
  let y 271
  While [ x < 190 AND y > 230 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x + 1
    set y y - 1
  ]
  set x 171
  set y 272
    While [ x < 191 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x + 1
    set y y - 1
  ]
  set x 172
  set y 272
    While [ x < 191 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x + 1
    set y y - 1
  ]
  set x 172
  set y 273
    While [ x < 191 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x + 1
    set y y - 1
  ]
  ;/
  set x 210
  set y 273
    While [ x > 190 AND y > 230 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x - 1
    set y y - 1
  ]

  set x 210
  set y 272
    While [ x > 190 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x - 1
    set y y - 1
  ]
  set x 210
  set y 271
    While [ x > 190 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x - 1
    set y y - 1
  ]
  set x 210
  set y 270
    While [ x > 190 AND y > 231 ]
  [
    ask patch x y
      [
       set pcolor red
       ]
    set x x - 1
    set y y - 1
  ]
  ask patch 168 212 [ set pcolor red ]
   ask patches with [pxcor >  166 and pxcor < 170 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 168 242 [ set pcolor red ]

    ask patch 168 272 [ set pcolor red ]
   ask patches with [pxcor >  166 and pxcor < 170 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 168 242 [ set pcolor red ]

  ; B

     ask patch 282 212 [ set pcolor red ]
   ask patches with [pxcor >  280 and pxcor < 284 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 282 242 [ set pcolor red ]

    ask patch 282 272 [ set pcolor red ]
   ask patches with [pxcor >  280 and pxcor < 284 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 282 242 [ set pcolor red ]


  ask patch 258 212 [ set pcolor red ]
   ask patches with [pxcor >  256 and pxcor < 260 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 258 242 [ set pcolor red ]

    ask patch 258 272 [ set pcolor red ]
   ask patches with [pxcor >  256 and pxcor < 260 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 258 242 [ set pcolor red ]

  ask patch 280 212 [ set pcolor red ]
   ask patches with [pxcor >  240 and pxcor < 280 and pycor >  210 and pycor < 214]
      [
       set pcolor red
       ]
    ask patch 240 212 [ set pcolor red ]

   ask patch 280 272 [ set pcolor red ]
   ask patches with [pxcor >  240 and pxcor < 280 and pycor >  270 and pycor < 274]

      [
       set pcolor red
       ]
    ask patch 240 272 [ set pcolor red ]

    ask patch 280 242 [ set pcolor red ]
   ask patches with [pxcor >  260 and pxcor < 280 and pycor >  240 and pycor < 244]

      [
       set pcolor red
       ]
    ask patch 260 242 [ set pcolor red ]


  ;A
     ask patch 352 212 [ set pcolor red ]
   ask patches with [pxcor >  350 and pxcor < 354 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 352 242 [ set pcolor red ]

    ask patch 352 272 [ set pcolor red ]
   ask patches with [pxcor >  350 and pxcor < 354 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 352 242 [ set pcolor red ]


  ask patch 308 212 [ set pcolor red ]
   ask patches with [pxcor >  306 and pxcor < 310 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 308 242 [ set pcolor red ]

    ask patch 308 272 [ set pcolor red ]
   ask patches with [pxcor >  306 and pxcor < 310 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 308 242 [ set pcolor red ]

   ask patch 350 272 [ set pcolor red ]
   ask patches with [pxcor >  310 and pxcor < 350 and pycor >  270 and pycor < 274]

      [
       set pcolor red
       ]
    ask patch 310 272 [ set pcolor red ]

   ask patch 330 242 [ set pcolor red ]
   ask patches with [pxcor >  310 and pxcor < 330 and pycor >  240 and pycor < 244]

      [
       set pcolor red
       ]
    ask patch 310 242 [ set pcolor red ]


    ask patch 350 242 [ set pcolor red ]
   ask patches with [pxcor >  330 and pxcor < 350 and pycor >  240 and pycor < 244]

      [
       set pcolor red
       ]
    ask patch 330 242 [ set pcolor red ]

  ;L

  ask patch 378 212 [ set pcolor red ]
   ask patches with [pxcor >  376 and pxcor < 380 and pycor >  212 and pycor < 242]
      [
       set pcolor red
       ]
   ask patch 378 242 [ set pcolor red ]

    ask patch 378 272 [ set pcolor red ]
   ask patches with [pxcor >  376 and pxcor < 380 and pycor <  272 and pycor > 242]
      [
       set pcolor red
       ]
   ask patch 378 242 [ set pcolor red ]

   ask patch 420 212 [ set pcolor red ]
   ask patches with [pxcor >  380 and pxcor < 420 and pycor >  210 and pycor < 214]
      [
       set pcolor red
       ]
    ask patch 380 212 [ set pcolor red ]
end 

to-report get-trapped
  report count SumbalKhans with [trapped? = true]
end 

to-report get-untrapped
  report count SumbalKhans with [trapped? = false]
end 

There is only one version of this model, created almost 6 years ago by sumbal khan.

Attached files

File Type Description Last updated
Sumbal Model.png preview Preview for 'Sumbal Model' almost 6 years ago, by sumbal khan Download

This model does not have any ancestors.

This model does not have any descendants.