I'm currently working on Agent-oriented programming and I need to divide 10 agents into 2 groups and implement a pathfinding algorithm. I've managed to implement a random walk but the group of agents doesn't divide into 2 as expected and I can't understand why because the code doesn't report any errors. I'd like your help to overcome this problem.
/* Initial beliefs and rules */
lowEnergy :- energy(X) & X < 50.
/* Initial goals */
!start.
/* Plans */
+!start <-
.print("hello").
// Define groups based on agent names
group(1) :- .my_name(N) & .member(N, [agentA1, agentA2, agentA3, agentA4, agentA5]).
group(2) :- .my_name(N) & .member(N, [agentA6, agentA7, agentA8, agentA9, agentA10]).
// Define agent-specific beliefs
+!start : .my_name(N) <- .print("My name is ", N).
// Rule to assign teams based on group assignment
+!start : .my_name(N) & group(1) <- +my_group(group1).
+!start : .my_name(N) & group(2) <- +my_group(group2).
// Rule to react to an event based on the agent's group
+some_event : my_group(Group) & group(Group) <- move(S);
.print("Agent in group ", Group, ": Event happened!").
// Rule for agents to find out their team using their name
+find_my_team : .my_name(N) & group(N) <-
.print("I am in group ", N).
+step(S) : lowEnergy <-
recharge.
+step(S) <-
.print("New percepts for step ", S);
.random([n,s,e,w], X);
move(X).