[SCM] applications.git branch, master, updated. 012e7bb71f4e22ecaf044c4eb18a2b3a1cc1f55f
ontologiae
ontologiae at gmail.com
Tue Jul 6 14:11:25 UTC 2010
The following commit has been merged in the master branch:
commit 012e7bb71f4e22ecaf044c4eb18a2b3a1cc1f55f
Author: ontologiae <ontologiae at gmail.com>
Date: Tue Jul 6 16:11:06 2010 +0200
revert generalisation
diff --git a/examples/standard/agent/agent.li b/examples/standard/agent/agent.li
index 80b9005..1db5fdc 100644
--- a/examples/standard/agent/agent.li
+++ b/examples/standard/agent/agent.li
@@ -20,7 +20,7 @@
///////////////////////////////////////////////////////////////////////////////
Section Header
- + name := AGENT(V);
+ + name := AGENT;
- copyright := "2003-2010 Sonntag Benoit";
@@ -35,22 +35,22 @@ Section Public
+ birthtime:UINTEGER_64;
- + current_state:STATE(V);
+ + current_state:STATE;
+ state_time:UINTEGER_64;
- + behavior:STATE(V);
+ + behavior:STATE;
- - make s:STATE(V) <-
+ - make s:STATE <-
(
behavior := s;
set_state s;
birthtime := TIMER.timer_count;
);
- - set_state s:STATE(V) <-
+ - set_state s:STATE <-
[ -? {s != NULL}; ]
- ( + cur:STATE(V);
+ ( + cur:STATE;
(current_state != NULL).if {
cur := current_state;
{cur != NULL}.while_do {
diff --git a/examples/standard/agent/example.li b/examples/standard/agent/example.li
index e861b0f..013eb65 100644
--- a/examples/standard/agent/example.li
+++ b/examples/standard/agent/example.li
@@ -56,14 +56,14 @@ Section Public
//
- init:G_EXPR <-
- ( //+ x,y:INTEGER;
+ ( + x,y:INTEGER;
// Initialization.
screen:=FAST_ARRAY2(UINTEGER_8).create (256,256);
- /*9000.times {
+ 9000.times {
x := screen.upper1.random_upper;
y := screen.upper2.random_upper;
screen.put 1 to (x,y);
- }; */
+ };
G_RAW.create (Self.fix_height.fix_width)
);
@@ -101,8 +101,7 @@ Section Public
- draw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
( + n:UINTEGER_8;
+ xx,yy:INTEGER;
- //+ ant:ANT;
- + ant:PENCIL;
+ + ant:ANT;
clipping (x0,y0) to (x1,y1);
//rectangle_fill (x0,y0) to (x1,y1) color black;
@@ -122,7 +121,7 @@ Section Public
};
};
- WORLD(PENCIL).agents.foreach { a:AGENT(PENCIL);
+ WORLD.agents.foreach { a:AGENT;
ant ?= a;
xx := ant.x * 2;
yy := ant.y * 2;
@@ -131,9 +130,9 @@ Section Public
};
// BSBS: BUG URGENT !!!!!!
- (WORLD(PENCIL).agents.lower).to (WORLD(PENCIL).agents.upper) do { i:INTEGER;
+ (WORLD.agents.lower).to (WORLD.agents.upper) do { i:INTEGER;
`//ICI`;
- ant ?= WORLD(PENCIL).agents.item i;
+ ant ?= WORLD.agents.item i;
xx := ant.x * 2;
yy := ant.y * 2;
//i.print; " ! \n".print;
@@ -197,17 +196,12 @@ Section Public
Section Public
- create_world <-
- ( + state1,state2,state3,state4,life : STATE(PENCIL);
- + pencil:PENCIL;
-
- //+ free,busy,life:STATE;
- //+ ant:ANT;
+ ( + free,busy,life:STATE;
+ + ant:ANT;
//
// Comportement.
//
-
- /*
free := STATE.create "Free" begin_action { x:ANT;
"I am free!\n".print;
@@ -224,34 +218,20 @@ Section Public
} end_action { x:ANT;
//x.put_food screen;
};
- free.to busy if { x:ANT; "free à busy".printline; x.found_food screen };
- busy.to free if { x:ANT; "busy à free".printline; x.found_heap 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;
};
life.has free;
-
-*/
-
- state1 := STATE(PENCIL).create "State 1" action { x:PENCIL; x.move; x.trace screen; };
- state2 := STATE(PENCIL).create "State 2" action { x:PENCIL; x.setdir (1,-1); };
- state3 := STATE(PENCIL).create "State 3" action { x:PENCIL; x.move; x.trace screen; };
- state4 := STATE(PENCIL).create "State 4" action { x:PENCIL; x.setdir (-1,0); };
-
-
- state1.to state2 if { x:PENCIL; x.step = 10};
- state2.to state3 if { x:PENCIL; TRUE};
- state3.to state4 if { x:PENCIL; x.step = 16};
- state4.to state1 if { x:PENCIL; TRUE };
-
-
- 5.times {
- pencil := PENCIL.create life;
+
+ 100.times {
+ ant := ANT.create life;
"create ".print;
- pencil.x.print; '\n'.print;
- WORLD(PENCIL).add pencil;
+ ant.x.print; '\n'.print;
+ WORLD.add ant;
};
- WORLD(PENCIL).run;
+ WORLD.run;
);
diff --git a/examples/standard/agent/state.li b/examples/standard/agent/state.li
index 8db89cb..0aaea69 100644
--- a/examples/standard/agent/state.li
+++ b/examples/standard/agent/state.li
@@ -9,8 +9,8 @@
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRVY; without even the implied warranty of //
-// MERCHVABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
@@ -20,12 +20,12 @@
///////////////////////////////////////////////////////////////////////////////
Section Header
- + name := STATE(V);
+ + name := STATE;
- copyright := "2003-2010 Sonntag Benoit";
- author := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
- - comment := "State in hierarchical FSM";
+ - comment := "The main prototype";
Section Inherit
@@ -33,25 +33,25 @@ Section Inherit
Section Public
- + begin_action:{ V; }; // BSBS: Mettre E
+ + begin_action:{ ANT; }; // BSBS: Mettre E
- + action:{ V; };
+ + action:{ ANT; };
- + end_action:{ V; };
+ + end_action:{ ANT; };
- + transitions:FAST_ARRAY(TRANSITION(V));
+ + transitions:FAST_ARRAY(TRANSITION);
- + sub_state:STATE(V);
+ + sub_state:STATE;
- + parent_state:STATE(V);
+ + parent_state:STATE;
Section STATE
- - update_parent other:STATE(V) <-
+ - update_parent other:STATE <-
(
(parent_state != NULL).if {
parent_state := other;
- transitions.foreach { t:TRANSITION(V);
+ transitions.foreach { t:TRANSITION;
t.state.update_parent other;
};
};
@@ -68,66 +68,66 @@ Section Public
- create n:ABSTRACT_STRING :SELF <-
create n begin_action NULL action NULL end_action NULL;
- - create n:ABSTRACT_STRING begin_action b_a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING begin_action b_a:{ ANT; } :SELF <-
create n begin_action b_a action NULL end_action NULL;
- - create n:ABSTRACT_STRING action a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING action a:{ ANT; } :SELF <-
create n begin_action NULL action a end_action NULL;
- - create n:ABSTRACT_STRING end_action e_a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING end_action e_a:{ ANT; } :SELF <-
create n begin_action NULL action NULL end_action e_a;
- - create n:ABSTRACT_STRING begin_action b_a:{ V; }
- action a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING begin_action b_a:{ ANT; }
+ action a:{ ANT; } :SELF <-
create n begin_action b_a action a end_action NULL;
- - create n:ABSTRACT_STRING begin_action b_a:{ V; }
- end_action e_a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING begin_action b_a:{ ANT; }
+ end_action e_a:{ ANT; } :SELF <-
create n begin_action b_a action NULL end_action e_a;
- - create n:ABSTRACT_STRING action a:{ V; }
- end_action e_a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING action a:{ ANT; }
+ end_action e_a:{ ANT; } :SELF <-
create n begin_action NULL action a end_action e_a;
- - create n:ABSTRACT_STRING begin_action b_a:{ V; }
- action a:{ V; } end_action e_a:{ V; } :SELF <-
+ - create n:ABSTRACT_STRING begin_action b_a:{ ANT; }
+ action a:{ ANT; } end_action e_a:{ ANT; } :SELF <-
( + result:SELF;
result := clone;
result.make n begin_action b_a action a end_action e_a;
result
);
- - make n:ABSTRACT_STRING begin_action b_a:{ V; }
- action a:{ V; } end_action e_a:{ V; } <-
+ - make n:ABSTRACT_STRING begin_action b_a:{ ANT; }
+ action a:{ ANT; } end_action e_a:{ ANT; } <-
(
name := n;
begin_action := b_a;
action := a;
end_action := e_a;
- transitions := FAST_ARRAY(TRANSITION(V)).create_with_capacity 2;
+ transitions := FAST_ARRAY(TRANSITION).create_with_capacity 2;
);
//
// Transition.
//
- - to other:STATE(V) if cmp:{ V; BOOLEAN} <-
+ - to other:STATE if cmp:{ ANT; BOOLEAN} <-
(
- transitions.add_last (TRANSITION(V).create other if cmp);
+ transitions.add_last (TRANSITION.create other if cmp);
);
//
// Sub-state engin.
//
- - has other:STATE(V) <-
+ - has other:STATE <-
(
sub_state := other;
other.update_parent Self;
);
- - run a:AGENT(V) <- // BSBS E!!!
- ( + ant:V;
+ - run a:AGENT <- // BSBS E!!!
+ ( + ant:ANT;
ant ?= a;
(action != NULL).if {
action.value ant;
@@ -135,9 +135,9 @@ Section Public
(parent_state != NULL).if {
parent_state.run a;
};
- transitions.foreach { t:TRANSITION(V);
+ transitions.foreach { t:TRANSITION;
(t.condition.value ant).if {
a.set_state (t.state);
};
};
- );
+ );
\ No newline at end of file
diff --git a/examples/standard/agent/transition.li b/examples/standard/agent/transition.li
index fe4ab58..2f71e81 100644
--- a/examples/standard/agent/transition.li
+++ b/examples/standard/agent/transition.li
@@ -20,7 +20,7 @@
///////////////////////////////////////////////////////////////////////////////
Section Header
- + name := TRANSITION(V);
+ + name := TRANSITION;
- copyright := "2003-2010 Sonntag Benoit";
@@ -33,22 +33,22 @@ Section Inherit
Section Public
- + state:STATE(V);
+ + state:STATE;
- + condition:{ V; BOOLEAN};
+ + condition:{ ANT; BOOLEAN};
//
// Creation.
//
- - create s:STATE(V) if cmp:{ V; BOOLEAN} :SELF <-
+ - create s:STATE if cmp:{ ANT; BOOLEAN} :SELF <-
( + result:SELF;
result := clone;
result.make s if cmp;
result
);
- - make s:STATE(V) if cmp:{ V; BOOLEAN} <-
+ - make s:STATE if cmp:{ ANT; BOOLEAN} <-
(
state := s;
condition := cmp;
diff --git a/examples/standard/agent/world.li b/examples/standard/agent/world.li
index 7a585d1..a75159d 100644
--- a/examples/standard/agent/world.li
+++ b/examples/standard/agent/world.li
@@ -20,7 +20,7 @@
///////////////////////////////////////////////////////////////////////////////
Section Header
- + name := WORLD(V);
+ + name := WORLD;
- copyright := "2003-2010 Sonntag Benoit";
@@ -41,7 +41,7 @@ Section Public
Self
);
- - add a:AGENT(V) <-
+ - add a:AGENT <-
(
agents.add_last a;
"OK\n".print;
@@ -57,7 +57,7 @@ Section Public
// Nothing.
t ?= msg;
(t != NULL).if {
- agents.foreach { a:AGENT(V);
+ agents.foreach { a:AGENT;
a.run;
};
};
--
applications.git
More information about the Lisaac-commits
mailing list