[SCM] applications.git branch, master, updated. bec53a95c528e1115bf34736ea47c2a6092fa6e5

ontologiae ontologiae at ordinateur-de-ontologiae-3.local
Tue Mar 30 17:16:33 UTC 2010


The following commit has been merged in the master branch:
commit bec53a95c528e1115bf34736ea47c2a6092fa6e5
Author: ontologiae <ontologiae at ordinateur-de-ontologiae-3.local>
Date:   Tue Mar 30 19:15:50 2010 +0200

    Update agent example

diff --git a/examples/standard/agent/example.li b/examples/standard/agent/example.li
index 5a07e18..013eb65 100644
--- a/examples/standard/agent/example.li
+++ b/examples/standard/agent/example.li
@@ -26,6 +26,10 @@ Section Header
 
   - author    := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
   - comment   := "The main prototype";
+  - lip  <-
+    (
+        add_lib "-L/usr/X11R6/lib/";
+    );
   
 Section Inherit
 
@@ -55,7 +59,7 @@ Section Public
   ( + x,y:INTEGER;
     // Initialization.
     screen:=FAST_ARRAY2(UINTEGER_8).create (256,256);
-    300.times {
+    9000.times {
       x := screen.upper1.random_upper;
       y := screen.upper2.random_upper;
       screen.put 1 to (x,y);
@@ -102,15 +106,17 @@ Section Public
     clipping (x0,y0) to (x1,y1);
     //rectangle_fill (x0,y0) to (x1,y1) color black;
     //
+    screen.inspect.printline;
     (screen.lower2).to (screen.upper2) do { y:INTEGER;
-      (screen.lower1).to (screen.upper1) do { x:INTEGER;        
+      //"coucou".printline;
+      (screen.lower1).to (screen.upper1) do { x:INTEGER;
         n := screen.item (x,y);
         xx := x * 2;
         yy := y * 2;
         (n = 0).if {          
-          rectangle_fill (xx,yy) to (xx+1,yy+1) color black;	
+          rectangle_fill (xx,yy) to (xx+2,yy+2) color black;	
         } else {
-          rectangle_fill (xx,yy) to (xx+1,yy+1) color red;	
+          rectangle_fill (xx,yy) to (xx+2,yy+2) color red;	
         };
       };
     };        
@@ -120,18 +126,18 @@ Section Public
       xx := ant.x * 2;
       yy := ant.y * 2;
       //i.print; " ! \n".print;
-      rectangle_fill (xx,yy) to (xx+1,yy+1) color white;
+      rectangle_fill (xx,yy) to (xx+2,yy+2) color white;
     };
     
-    /* BSBS: BUG URGENT !!!!!!
+    // BSBS: BUG URGENT !!!!!!
     (WORLD.agents.lower).to (WORLD.agents.upper) do { i:INTEGER;
       `//ICI`;
       ant ?= WORLD.agents.item i;
       xx := ant.x * 2;
       yy := ant.y * 2;
-      i.print; " ! \n".print;
-      rectangle_fill (xx,yy) to (xx+1,yy+1) color white;
-    };*/
+      //i.print; " ! \n".print;
+      rectangle_fill (xx,yy) to (xx+2,yy+2) color white;
+    };
     
   );
 
@@ -210,10 +216,10 @@ Section Public
     } action { x:ANT;
       x.move;
     } end_action { x:ANT;
-      x.put_food screen;
+      //x.put_food screen;
     };
-    free.to busy if { x:ANT; x.found_food screen };
-    busy.to busy if { x:ANT; x.found_food screen };
+    free.to busy if { x:ANT; /*"free à busy".printline; x.found_food screen*/ (1.random_to 9) = 3 };
+    busy.to free if { x:ANT; /*"busy à free".printline; */x.found_heap screen/* (1.random_to 5) = 3*/ };
     
     life := STATE.create "Life" action { x:ANT;
       x.move;

-- 
applications.git



More information about the Lisaac-commits mailing list