1 / 7

E Pluribus Unum

E Pluribus Unum. I comportamenti emergenti. Istruzioni interessanti. Iniziale ca ask-patches [if (random 20) < 5 [setpc yellow]] count-patches-with [(distance 0 0) < 5] count-pc yellow count-turtles

alamea
Download Presentation

E Pluribus Unum

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. E Pluribus Unum I comportamenti emergenti

  2. Istruzioni interessanti • Iniziale • ca • ask-patches [if (random 20) < 5 [setpc yellow]] • count-patches-with [(distance 0 0) < 5] • count-pc yellow • count-turtles • nsum variabilevicini (considera, per ogni mattonella, il valore di variabile nelle otto mattonelle che la circondano e li somma mettendo il risultato nella variabile vicini )

  3. Il gioco della vita • se una cella ospita un automa vivo, questo continuerà a vivere anche nella generazione successiva solo se 2 o 3 delle otto celle adiacenti ospitano automi vivi; • se una cella vuota ha tre automi adiacenti vivi, allora ospiterà un nuovo automa; • se un automa ha meno di 2 automi adiacenti vivi o più di 3 vivi, esso morirà per inedia o sovrappopolazione.

  4. Gioco della vita: inizio • patches-own [stato somma] • to setup • ask-patches [ • ifelse (random 100) < densità • [setpc yellow] [setpc black] • ifelse pc = yellow [setstato 1] [setstato 0]] • end

  5. La legge della vita • to go • nsum stato somma • ask-patches [ • ifelse pc = yellow [setstato 1] [setstato 0] • ifelse stato = 1 • [if ((somma < 2) or (somma > 3)) [setstato 0]] • [if somma = 3 [setstato 1]] • ifelse stato = 1 [setpc yellow] [setpc black] • ] • end

  6. Cambiamo le regole • Se una cella vive e ha un numero pari di intorni viventi, muore. • Se una cella è morta, e ha un numero pari di intorni viventi, vive • Una cella cambia il suo stato se ha un numero pari di intorni viventi

  7. nuove regole to go ask-patches [ifelse pc = yellow [setstato 1] [setstato 0]] nsum stato somma ask-patches [ ifelse stato = 1 [ifelse (somma mod 2) = 1 [setstato 0] [setstato 1]] [ifelse (somma mod 2) = 1 [setstato 1] [setstato 0]] ifelse stato = 1 [setpc yellow] [setpc black] ] end

More Related