Ants/Kolokoltseva: различия между версиями

Материал из Поле цифровой дидактики
Новая страница: « =Remix Remix Ants --- patches-own [ chemical ;; amount of chemical on this patch food ;; amount of food on this patch (0, 1, or 2) nest? ;; true on nest patches, false elsewhere nest-scent ;; number that is higher closer to the nest food-source-number ;; number (1, 2, or 3) to identify the food sources ] ;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setup procedures ;;; ;;;;;;;;;;;;;;;;;;;;;;;; to setup c...»
 
Нет описания правки
Строка 1: Строка 1:


=Remix
 
Remix
Remix
Ants
Ants

Версия от 09:47, 23 апреля 2026


Remix Ants

--- patches-own [

 chemical             ;; amount of chemical on this patch
 food                 ;; amount of food on this patch (0, 1, or 2)
 nest?                ;; true on nest patches, false elsewhere
 nest-scent           ;; number that is higher closer to the nest
 food-source-number   ;; number (1, 2, or 3) to identify the food sources

]

Setup procedures ;;;

to setup

 clear-all
 set-default-shape turtles "bug"
 create-turtles population
 [ set size 2         ;; easier to see
   set color red  ]   ;; red = not carrying food
 setup-patches
 reset-ticks

end

to setup-patches

 ask patches
 [ setup-nest
   setup-food
   recolor-patch ]

end

to setup-nest  ;; patch procedure

 ;; set nest? variable to true inside the nest, false elsewhere
 set nest? (distancexy 0 0) < 5
 ;; spread a nest-scent over the whole world -- stronger near the nest
 set nest-scent 200 - distancexy 0 0

end