IN THE NAME OF GOD
Hello.
Thank you very much.
I had assigned obj. to valof(obj_name) at creation time. I tested it and it
returned obj. , but INDATA was not run right. I assigned obj. to a global
variable and used it instead of valof(obj_name).
I wondered very much! Apparently, INDATA is run right, now. Of course, I
have not test the whole of program, still. There are wonderful problems, as
I have feared a little. For example at the following ruleset, I had
assigned false to prb_allrules.
;;;find_dir_for_moving_react_ruleset
define heading_to_target(agent)->dir;
sim_heading_from(sim_coords(agent),sim_coords(mover_target(agent)))
->> dir -> mover_heading(agent);
enddefine;
define :ruleset find_dir_for_moving_react_ruleset;
[DLOCAL
[prb_allrules=true] [prb_sortrules=false]
];
[VARS [list=[]] [counter=0] sim_myself
[head_to_t=heading_to_target(sim_myself)]];
RULE behaviour_is_reasoning
[NOT perform reaction behaviour]
==>
[STOP]
RULE collect_info_about_other_preys
;;;This rule collects information about position of other preys related
to t_line
[LVARS ang dir H/*distance each prey to t_line*/ alpha
[pfdp=pre_finish_distance_prey(sim_myself)]]
[prey ?name ?distance ==][->>temp]
[LVARS [prey_agent=valof(name)]]
[WHERE prey_agent/==mover_target(sim_myself)]
==>
[POP11
sim_heading_from(sim_coords(sim_myself),sim_coords(prey_agent))->dir;
sim_degrees_diff(head_to_t,dir)->ang;
distance*sin(abs(ang))->H;
if (H<=pfdp) then
arcsin(pfdp/distance)->alpha;
cons((ang+alpha),list)->list;/*lower limitation*/
cons((ang-alpha),list)->list;/*uper limitation*/
counter+2->counter;
endif;]
[DEL ?temp]
RULE delete_info_about_target
;;;This rule deletes information about target of predator
[prey ?name ?distance ==][->>temp]
[LVARS [prey_agent=valof(name)]]
[WHERE prey_agent==mover_target(sim_myself)]
==>
[DEL ?temp]
RULE determine_veer_and_determine_new_heading
;;;This rule determines veer value and new heading of predator
[NOT prey ==]
[LVARS veer v1 v2 new_heading
[current_heading=mover_heading(sim_myself)]]
[POP11 if (counter==0) then
0->veer;
endif;
if (counter/=0) then
sort(list)->list;
abs(list(1))->v1;
list(counter)->v2;
if (v1<=v2) then
v1+1->veer;
else
(-1)*(v2+1)->veer;
endif;
endif;
current_heading+veer->new_heading;]
==>
[veer is ?veer]
[new heading is ?new_heading]
[STOP]
enddefine;
and at third rule ,there was not â??[NOT prey ==]â??. If predator see prey(s) at
their field of view, should run rule1 and rule2 for all of preys at their
field of view. Then, runs third rule. If predator does not see any prey,
runs third rule only. But predators that saw prey, didnâ??t enter to third
rule, any times. I didnâ??t understand reason and assigned true to
prb_allrules and added [NOT prey ==] to third rule. Then problem was solved.
Anyway, excuse me for my inconveniences. Of course, I may be forced, give
trouble to you.
Thank you very much, again.
Sincerely,
Jenab.
|